Repository navigation
test(browser): cover stderr backpressure during MCP startup - #138022
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: blocked before merge. Reviewed September 4, 2026, 4:54 AM ET / 08:54 UTC. ClawSweeper reviewWhat this changesExtends the browser plugin’s existing subprocess test with quiet and 2 MiB stderr cases whose initialization replies wait for the write to complete. Merge readiness⛔ Blocked before merge - 1 item remains The rewritten PR retains useful backpressure coverage absent from current main. The prior composition concern is resolved, and no introduced correctness defect was found. Priority: P2 Review scores
Verification
How this fits togetherThe browser plugin uses an MCP subprocess to control an existing Chrome session. Its connection owner drains subprocess diagnostics while initialization completes, then admits browser tool calls. flowchart LR
A[Browser operation] --> B[Session lease]
B --> C[MCP connection owner]
C --> D[Browser control subprocess]
D --> E[Bounded stderr collector]
E --> F[Initialization completes]
F --> G[Tool result and cleanup]
Before merge
Agent review detailsSecurityNone. PR surfaceTests +8. Total +8 across 1 file. View PR surface stats
Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep the single early stderr collector and protect its liveness through the existing real-subprocess fixture, without another runtime path or test-only production seam. Do we have a high-confidence way to reproduce the issue? Not applicable to a remaining current-main bug: the runtime repair has landed. The supplied controlled before/after run reports the intended verbose-startup failure with the old owner and success with the current owner. Is this the best way to solve the issue? Yes for the inspected OpenClaw boundary: extending the existing fixture adds a meaningful liveness assertion while preserving diagnostic and cleanup checks, with no parallel implementation. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 216360ad87d8. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
History |
Extend the real-child fixture from #137993 with quiet and 2 MiB startup stderr cases. Gate the initialize response on the write callback while retaining actual tool-call and EOF/PID cleanup assertions. The runtime fix remains owned by #137993; this change is test-only. Verified an intended pre-drain RED, identical GREEN, 140 owner/sibling tests, all 19 changed checks, and an independent code review.
bd06637 to
a5d40b8
Compare
|
@clawsweeper re-review This PR has been rewritten as test-only coverage after #137993 landed the canonical runtime fix. It extends that existing real-child fixture with quiet/2 MiB callback-gated startup cases instead of retaining a duplicate runtime change or subprocess fixture. The identical test reproduced the pre-drain handshake timeout and passed on main; all 140 owner/sibling tests and 19 changed checks passed. |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Direct SDK inspection closes the remaining reviewer limitation: the installed For exact head |
|
Merged via squash.
|
…#138022) Extend the real-child fixture from openclaw#137993 with quiet and 2 MiB startup stderr cases. Gate the initialize response on the write callback while retaining actual tool-call and EOF/PID cleanup assertions. The runtime fix remains owned by openclaw#137993; this change is test-only. Verified an intended pre-drain RED, identical GREEN, 140 owner/sibling tests, all 19 changed checks, and an independent code review.
Canonical runtime fix: #137993
Related broader recovery work: #135868
What Problem This Solves
Adds a regression for a real MCP child whose initialize reply waits for a large stderr write to finish. #137993 already landed the early stderr drain and startup diagnostics; this PR now contains only complementary test coverage, with no production changes.
Why This Change Was Made
A small diagnostic write does not prove pipe-backpressure liveness. Extend #137993's existing real-child fixture instead of retaining this PR's separate subprocess fixture: the successful-startup case now covers zero and 2 MiB of stderr, with the initialize response gated by the actual write callback. Input handling stays active throughout so shutdown can still consume EOF. Existing 9 KB failure/redaction cases, real tool-call assertions, bounded diagnostic checks and exact-child cleanup checks remain in place. Net change: eight test lines; zero production lines.
User Impact
No new behavior, configuration, dependency, retry or timeout. The test protects the initialization fix already owned by #137993 against a future move back to post-handshake stderr draining.
Evidence
On the pinned main composition, temporarily substituting the exact pre-drain connection owner from the parent of #137993 produced the intended RED: quiet passed; the 2 MiB case failed with the unchanged production 30-second handshake timeout. Cleanup assertions passed. Restoring the exact current-main owner made the identical two cases GREEN. The existing 40-second regression case bound was retained; no timeout was increased.
All five relevant owner/sibling suites passed: 140 tests, zero failures/skips, including all three existing startup diagnostic failure cases, both startup/tool-call controls, session ownership, snapshot behavior and bounded UTF-8 diagnostics.
Fresh independent Codex review through P3 found no actionable findings. The full canonical changed-file gate passed all 19 selected stages, including extension-test typechecking, formatting, all three Knip scans, dependency/plugin guards and scoped lint (595.181 seconds). Exact-head CI run 33853333970 attempt 2 is green; only the incomplete advisory audit and its dependent gate were rerun on the unchanged head. Earlier-head CI is not reused. This is real local subprocess/stdio proof, not a physical Chrome UI session. The cause of the original Watch CI timeout remains unproven. The broader #135868 work remains untouched.
Two local setup failures were preserved: an inherited CI setting selected unavailable Corepack, and the initial review PATH omitted the installed Codex CLI. The normal local package-manager environment and explicit installed CLI resolved those setup issues without product, assertion, or timeout changes.
Final SDK and CI verification
Direct SDK inspection closes the remaining reviewer limitation: the installed
@modelcontextprotocol/sdk1.30.0 creates and exposes its stderrPassThroughin the constructor, pipes the child into it duringstart(), and closes via stdin EOF followed by bounded TERM/KILL escalation. This confirms the pre-connect drain contract already implemented by #137993; no SDK or production code changes are needed here.For exact head
a5d40b84d7625d6e9e0154c537c5d4362120535f, the identical real-child RED/GREEN, all 140 owner/sibling tests, all 19 changed-file stages, and fresh independent Codex review through P3 are complete. CI attempt 2 is green after an unchanged-head rerun of the incomplete advisory audit and its dependent gate. The latest Claw review found no introduced correctness defects. This is real local subprocess/stdio evidence, not a physical Chrome UI session or proof of the original Watch CI timeout's cause.