TDD: Add test for race condition in McpClient.start() double initialization #10915

Merged
HAL9000 merged 1 commits from tdd/mcp-race-condition-start into master 2026-05-02 21:57:56 +00:00

1 Commits

Author SHA1 Message Date
HAL9000 72b2c991b8 TDD: Add test for race condition in McpClient.start() double initialization
CI / benchmark-publish (pull_request) Has been skipped
CI / lint (pull_request) Successful in 1m4s
CI / quality (pull_request) Successful in 1m32s
CI / helm (pull_request) Successful in 34s
CI / build (pull_request) Successful in 46s
CI / security (pull_request) Successful in 1m39s
CI / push-validation (pull_request) Successful in 39s
CI / typecheck (pull_request) Successful in 2m18s
CI / integration_tests (pull_request) Successful in 4m56s
CI / e2e_tests (pull_request) Successful in 5m28s
CI / unit_tests (pull_request) Successful in 9m1s
CI / docker (pull_request) Successful in 1m37s
CI / coverage (pull_request) Successful in 16m23s
CI / status-check (pull_request) Successful in 7s
Adds a Behave TDD issue-capture test for bug #10438: McpClient.start()
releases the threading.RLock after setting _state to STARTING but before
calling connect() and discover_tools(). Concurrent callers can both pass
the _started idempotency check and call discover_tools() multiple times.

The test uses @tdd_expected_fail so CI passes while the bug is unfixed.
A counting mock transport records connect() and discover_tools() calls.
Five threads call start() concurrently through a threading.Barrier to
maximise the chance of the race manifesting.

ISSUES CLOSED: #10402
2026-05-02 21:30:45 +00:00