You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: resolve stdio transport race condition for concurrent tool calls (#529)
* fix: resolve stdio transport race condition for concurrent tool calls
Fixes#528 by replacing goroutine-per-request pattern with a worker pool
to prevent multiple goroutines from accessing the non-thread-safe bufio.Reader.
- Add worker pool pattern with configurable size (default: 5 workers)
- Add buffered queue for tool calls (default: 100 capacity)
- Protect concurrent writes with mutex
- Maintain backward compatibility while fixing the race condition
- Add comprehensive test for concurrent tool calls
🤖 Generated with [opencode](https://opencode.ai)
Co-Authored-By: opencode <[email protected]>
* fix: address golangci-lint errcheck warnings
- Add error checking for Write operations in concurrent tool calls test
- Ensures all error return values are properly handled
🤖 Generated with [opencode](https://opencode.ai)
Co-Authored-By: opencode <[email protected]>
* refactor: remove redundant mutex around thread-safe sync.Map
sync.Map is already thread-safe and doesn't require additional mutex protection.
This simplifies the test code while maintaining the same functionality.
🤖 Generated with [opencode](https://opencode.ai)
Co-Authored-By: opencode <[email protected]>
* refactor: improve test control flow and add configuration bounds validation
- Replace goto statements with labeled break for more idiomatic Go
- Reduce test timeout from 5s to 2s for faster test execution
- Add upper bounds validation for worker pool size (max 100) and queue size (max 10000)
- Add tests to verify configuration bounds are respected
- Log warnings when configuration values exceed maximum limits
Addresses remaining CodeRabbit review feedback.
🤖 Generated with [opencode](https://opencode.ai)
Co-Authored-By: opencode <[email protected]>
* fix: use maximum values instead of defaults when limits exceeded
When WithWorkerPoolSize or WithQueueSize receive values exceeding their
maximum limits, use the maximum allowed value instead of falling back
to the default. This better aligns with user expectations when they
request large pool/queue sizes.
🤖 Generated with [opencode](https://opencode.ai)
Co-Authored-By: opencode <[email protected]>
* test: update stdio tests to expect maximum values when limits exceeded
Update test expectations to match the new behavior where WithWorkerPoolSize
and WithQueueSize use maximum values instead of defaults when the requested
size exceeds limits.
🤖 Generated with [opencode](https://opencode.ai)
Co-Authored-By: opencode <[email protected]>
---------
Co-authored-by: opencode <[email protected]>
0 commit comments