TDD: Add test for timer firing after cancellation in McpClient #11159

Merged
HAL9000 merged 8 commits from tdd/mcp-client-timer-cancel-race into master 2026-06-17 06:57:01 +00:00

8 Commits

Author SHA1 Message Date
CleverAgents Bot ab983e5ccb fix(mcp): close timer shutdown scheduling race
CI / load-versions (pull_request) Successful in 27s
CI / push-validation (pull_request) Successful in 35s
CI / lint (pull_request) Successful in 38s
CI / typecheck (pull_request) Successful in 1m1s
CI / security (pull_request) Successful in 1m7s
CI / build (pull_request) Successful in 32s
CI / quality (pull_request) Successful in 1m14s
CI / helm (pull_request) Successful in 40s
CI / unit_tests (pull_request) Successful in 5m40s
CI / docker (pull_request) Successful in 1m44s
CI / integration_tests (pull_request) Successful in 9m17s
CI / coverage (pull_request) Successful in 9m48s
CI / status-check (pull_request) Successful in 3s
CI / load-versions (push) Successful in 11s
CI / push-validation (push) Successful in 27s
CI / lint (push) Successful in 44s
CI / quality (push) Successful in 48s
CI / typecheck (push) Successful in 1m2s
CI / build (push) Successful in 37s
CI / security (push) Successful in 1m10s
CI / helm (push) Successful in 40s
CI / unit_tests (push) Successful in 5m4s
CI / docker (push) Successful in 1m34s
CI / integration_tests (push) Successful in 8m43s
CI / coverage (push) Successful in 9m39s
CI / status-check (push) Successful in 3s
CI / benchmark-publish (push) Has been cancelled
CI / benchmark-regression (push) Has been cancelled
2026-06-17 02:36:59 -04:00
drew a103d755ce test(mcp): cover timer shutdown scheduling guards 2026-06-17 02:36:59 -04:00
drew 3ffc8f6a8e style(test): ruff format tdd timer cancel race steps (rebase fixup)
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-17 02:36:59 -04:00
controller-ci-rerun 12b864edd8 chore: re-trigger CI [controller] 2026-06-17 02:36:59 -04:00
HAL9000 39465fe614 Remove @tdd_expected_fail tag (bug is now fixed) 2026-06-17 02:36:59 -04:00
HAL9000 decc315371 Fix McpClient timer race condition (#10516) 2026-06-17 02:36:59 -04:00
HAL9000 99f3176fc8 fix(tests): remove type ignore suppressions from TDD timer race test
Steps file had two `# type: ignore[assignment]` comments on lines 130 and
204 which violated the CONTRIBUTING.md rule against inline type error
suppression. Removed both to comply with full static typing requirements.
2026-06-17 02:36:59 -04:00
HAL9000 a6a5f72a00 TDD: Add test for timer firing after cancellation in McpClient
Add a TDD issue-capture test (tagged @tdd_issue, @tdd_issue_10516,
@tdd_expected_fail) that proves the race condition in
McpClient._schedule_idle_timer() where timer.start() is called
outside the lock, allowing a timer to fire even after shutdown()
has called _cancel_idle_timer().

The test uses concurrent scheduling threads to trigger the race
window and verifies that _check_idle() fires when _shutting_down
is True, confirming the bug exists.

Closes #10516
2026-06-17 02:36:59 -04:00