xiaodu55 e7576f9f5b
fix(tests): stop mcp task service tests hanging forever on Windows (#5941)
Running the suite on native Windows blocked forever inside
test_mcp_task_service.py, and the whole shard with it. Root cause chain:

1. The tests patch _CANCELLATION_DRAIN_TIMEOUT_SECONDS to 0.01s. On
   Windows + CPython 3.12, asyncio.wait_for over an already-created task
   with a 10ms timeout raises TimeoutError immediately (measured 30/30 on
   3.12.13, 0/30 on 3.11.9, same host; 50ms works on 3.12) - the claim
   never gets its first scheduling slice inside the drain window.
2. _claim_with_cancellation_release therefore abandons the instant claim
   to the background handoff; when it completes, the handoff calls
   repo.release_poll_claim_after_cancellation - which
   OrdinaryReleaseBatchRepository (the test fake) does not implement,
   so the release dies with AttributeError.
3. The test then waits unbounded on repo.release_started.wait(), which
   can now never fire: the whole suite hangs.

- add the missing release_poll_claim_after_cancellation to the fake so
  it matches the repository contract the service drives
- raise the patched drain 0.01 -> 0.25 and the outer caller wait 0.2 ->
  0.5 so the race window is above Windows timer granularity and the
  handoff-vs-outer-timeout ordering the assertions expect is preserved
- bound release_started.wait() so a contract/timing regression fails in
  seconds instead of hanging the run

The file now completes on Windows in ~12s (previously hung forever);
Linux/CI semantics are unchanged - the claims still complete well inside
the drain there.
2026-09-27 14:45:30 +08:00
..