Repository navigation
test(windows): run the stdio probe's stderr stubs as Python scripts - #23799
Conversation
TestProbeServerStderrCapture spawned four /bin/sh stubs as the MCP server command. Windows cannot execute a script file directly, so each spawn failed with WinError 193 before the child wrote anything: two tests were strict xfails there, and the bound and redaction tests passed on an error that carried no stderr at all. Each stub is now a Python script run by sys.executable, so the probe reads a real child's stderr on every platform. The bound and redaction tests also assert that a tail was captured, and the two xfail lines go. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
First Principles Review (Opus 5.5, fork) — ⏭️ skippedRevision |
UX Review (Opus 5.5, fork) — ⏭️ skippedRevision |
Opus 5.5 Review (fork) — ✅ no blocking findingsReviewed |
GPT 6.1 Review (fork) — ✅ no blocking findingsReviewed Review detailsNo findings. |
|
PR Readiness on
The Security Scope, Opus 5.5, GPT 6.1, First Principles and UX lanes all published for this head. A fork cannot re-run workflows: could a maintainer re-run run 40116728973? |
Design Review (Opus 5.5, fork) — ✅ PASSDesign-level review of Design-Verdict: PASS This is a test-only change. It fixes the root cause (shell-script stubs Windows can't spawn), and the added [DESIGN-REVIEWED] d3fbe1f Description read[DESCRIPTION-READ] 39fde9c4cd15ec8837e341b18d51547fb2fea76dd0f90fe03c012f80783f4596 That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
KiroCrewCaptain
left a comment
There was a problem hiding this comment.
Tier 1 auto-approve: test (2 files). Criteria: no conflict, no requested changes, security path denylist clean, design-doc gate clean, security checklist all-NO, no reviewer-lane findings, readiness signal fresh for this head SHA, declared category matches the diff. Category: test-only change that runs the stdio probe's stderr stubs as Python scripts so they work on Windows.
Problem / Motivation
Goal: the stdio probe's stderr-capture tests read a real child's stderr on Windows too, so the two listed as Windows xfails pass there and the bound and redaction tests stop passing on an error that has no stderr.
TestProbeServerStderrCaptureintest/test_mcp_discovery_probe_stdio.pypasses a/bin/shscript as the MCP servercommandin four tests. Windows cannot execute a script file directly, so on a Windows host each spawn fails with[WinError 193] %1 is not a valid Win32 applicationbefore the child writes anything:test_stderr_captured_when_child_exits_before_responseandtest_successful_probe_does_not_mention_stderrare strict xfails intest/windows-expected-failures.txt.test_stderr_tail_is_boundedandtest_credential_in_stderr_is_redactedare not listed, and they pass: each asserts that the error is short and holds no secret, which an error with no stderr tail satisfies trivially. From main on a Windows host the probe logsMCP probe failed [verbose]: [WinError 193] ...andMCP probe failed [leaky]: [WinError 193] ..., and both pass.Why it matters
The stderr tail is what turns an opaque "no response" into the server's real failure, such as a traceback or a missing module. Its redaction keeps a credential the server printed out of doctor output and the dashboard. On Windows none of the four tests reaches that code: two are strict xfails and two pass without it.
Not a goal
probe_serverdrains, bounds or redacts stderr.test_real_grandchild_is_reaped's/bin/shlauncher, which models a POSIX process group and is skipped off POSIX.What changed (motivation → approach → change)
WinError 193. Two tests fail, and two pass without reading any stderr.command, which only a POSIXexecvecan run, through its shebang.test/test_mcp_discovery_probe_stdio.py: each stub is a Python script that does what the shell one did, run ascommand=sys.executable, args=[str(stub)]. That is the spellingtest_mcp_discovery_probe_spawn_policy.pyalready uses for a real probe child. The healthy stub answersinitializeandtools/listwith the request's own id and ignores theinitializednotification, as the shellcasedid.chmod 0o755goes, because a script handed to the interpreter needs no execute bit.test_stderr_tail_is_boundedandtest_credential_in_stderr_is_redactedalso assert thatstderr:is in the error. The bound and the redaction are then measured on a captured tail on every platform, and a stub that cannot spawn fails them instead of passing.test/windows-expected-failures.txt.Backwards compatibility
Compatible: test-only; no product code changes.
Removes nothing: two strict-xfail lines go and two assertions are added; no assertion is dropped.
Tests
test/test_mcp_discovery_probe_stdio.pyandtest/test_windows_gap_list.pyon a Windows host with the lines removed: 43 passed, 5 skipped, on Python 3.13.5 and on 3.12.13. That host'ssys.executableis a venv redirector, which stays alive as the interpreter's parent (testing-conventions), so the real child here is two processes deep.test_stderr_tail_is_boundedandtest_credential_in_stderr_is_redactedon the same host: both pass while the probe logs[WinError 193]for each. The addedstderr:assertion refuses exactly that.check_comment_history,check_brand_name,check_file_line_capandtest_flake_pattern_ratchet.pypass. Trial merges with my other open list edits (test(windows): burn down six path-separator xfails #23777, test(windows): burn down the gateway-run xfails by patching the rlimit seam #23781, test(windows): pin USERPROFILE in the two subagent cwd tilde tests #23786, test(windows): write the materialize fixtures with LF, skip the symlink case #23788) and with test: decode repository files as utf-8 in tests that read them as text #23775 are clean.Proof: not provable -- test-only change
Manual verification
N/A — test-only change; the Windows runs above are the check, and the Windows matrix runs these tests on this PR.
Related Issues
Fixes #23798
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)Contribution License Agreement
🤖 Generated with Claude Code