Skip to content

Commit 069c407

Browse files
committed
Widen the stdio round-trip test's termination grace and overall timeout
The test patches PROCESS_TERMINATION_TIMEOUT so the spawned server can unwind, save its subprocess coverage data, and print the clean-exit line before the kill escalation. One heavily starved Windows CI runner stalled the child past the previous 10s grace, so it was killed before printing and the stderr assertion failed with empty output. The post-stdin-close tail is normally well under a second even on loaded Windows runners, so double the grace to 20s (and the outer fail_after to 30s); the grace wait returns as soon as the child exits, so passing runs are unaffected.
1 parent ddb7b78 commit 069c407

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

tests/interaction/transports/test_stdio.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,10 @@ async def test_tool_call_and_notification_round_trip_over_a_stdio_subprocess(
6161
# post-print kill can no longer silently lose the data file -- see _stdio_server.main). The
6262
# production 2s default is too tight for the unwind+save tail on loaded Windows runners
6363
# (measured in-situ p99 of the whole test is ~7s); a kill before the print fails the stderr
64-
# assertion below loudly rather than tripping the coverage gate. Not under test.
65-
monkeypatch.setattr(stdio, "PROCESS_TERMINATION_TIMEOUT", 10.0)
64+
# assertion below loudly rather than tripping the coverage gate. The 20s grace covers even a
65+
# badly starved runner (a >10s stall has been seen once in CI) and costs nothing when the
66+
# child exits promptly. Not under test.
67+
monkeypatch.setattr(stdio, "PROCESS_TERMINATION_TIMEOUT", 20.0)
6668

6769
received: list[LoggingMessageNotificationParams] = []
6870

@@ -85,8 +87,8 @@ async def collect(params: LoggingMessageNotificationParams) -> None:
8587
errlog=errlog,
8688
)
8789

88-
# Must exceed session time plus the patched PROCESS_TERMINATION_TIMEOUT (10s).
89-
with anyio.fail_after(20):
90+
# Must exceed session time plus the patched PROCESS_TERMINATION_TIMEOUT (20s).
91+
with anyio.fail_after(30):
9092
async with Client(transport, logging_callback=collect) as client:
9193
assert client.initialize_result.server_info.name == "stdio-echo"
9294
result = await client.call_tool("echo", {"text": "across\nprocesses"})

0 commit comments

Comments
 (0)