test: widen m9_2 cancel-race harvest margin (macOS CI flake)

The fake server sleeps 250ms before responding; a 350ms total budget
left 100ms for two pipe transits + thread scheduling, which flaked on
loaded macOS runners — and the queued-stdin-writer hop added by the
typing-perf arc narrows it further. The contract under test is
cancel-after-queue-before-manager-tick, which any
long-enough-for-the-response wait preserves.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Levi Neuwirth 2026-06-10 12:03:44 -04:00
parent e8b5b94a4d
commit 15a764d87a
1 changed files with 9 additions and 4 deletions

View File

@ -536,10 +536,15 @@ fn m9_2_cancelled_sibling_wins_over_queued_response() {
.read_resource(sid, "file:///race")
.expect("read c");
// Let the fake server finish its delayed response, then harvest
// the supervisor event queue without giving McpManager a chance
// to process it yet.
std::thread::sleep(Duration::from_millis(350));
// Let the fake server finish its delayed response (it sleeps
// 250ms), then harvest the supervisor event queue without giving
// McpManager a chance to process it yet. The margin over the
// fake's delay must absorb two pipe transits plus the request's
// queued-stdin-writer hop under CI load (a 100ms margin flaked on
// macOS runners); a generous wait does not weaken the contract —
// the race under test is cancel-AFTER-queue-BEFORE-manager-tick,
// which holds for any wait long enough for the response to land.
std::thread::sleep(Duration::from_millis(1000));
sup.borrow_mut().tick();
// Cancel only b after the response is queued but before