Repository navigation
fix: intermittent MCP question fixture cleanup failures - #150690
Conversation
Join the fixture owner before releasing its held handshake so loaded runners cannot fail on a 1,000 ms polling deadline. Cover failures before and after question registration and retain cleanup on test cancellation. Related: #150399
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. Reviewed September 17, 2026, 3:19 AM ET / 07:19 UTC (Revision 2). ClawSweeper reviewWhat this changesThe PR makes MCP question tests await fixture cleanup directly, covers failure before and after question registration, and preserves recovery after test timeout. Merge readiness✅ Ready for maintainer review This remains a useful, focused repair: current main retains the disposal poll, and no actionable patch defect was found. The previous review’s draft blocker is resolved. Priority: P3 Review scores
Verification
How this fits togetherThe MCP question fixture sends local HTTP tool requests through OpenClaw’s question tool to a synthetic Gateway backed by the real question manager. Its teardown must finish requests and tool cancellation before releasing servers and isolated state. flowchart TD
A[Test starts question request] --> B[Local MCP HTTP server]
B --> C[Question tool and Gateway client]
C --> D[Question registration barrier]
D --> E[Injected fixture failure]
E --> F[Abort requests and join cleanup]
F --> G[Assert settlement and no pending questions]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceTests +21. Total +21 across 1 file. View PR surface stats
Review metricsNone. Technical reviewBest possible solution: Keep cleanup synchronized with its existing fixture owner while preserving registration-stage assertions and finite timeout recovery. Do we have a high-confidence way to reproduce the issue? Yes: current main still polls disposal under an independent deadline, and the PR records a controlled 1,100 ms handshake-delay reproduction. This read-only review verified the source path without executing that probe. Is this the best way to solve the issue? Yes: awaiting the existing cleanup owner removes the premature polling deadline without increasing test timeouts, weakening assertions, or adding another cleanup implementation. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 68b4251368c1. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
|
Merged via squash.
|
Join the fixture owner before releasing its held handshake so loaded runners cannot fail on a 1,000 ms polling deadline. Cover failures before and after question registration and retain cleanup on test cancellation. Related: openclaw#150399
Related: #150399
What Problem This Solves
Fixes intermittent CI failures in the MCP question fixture when transport cleanup outlasts the test's default 1,000 ms polling deadline.
User Impact
No user-visible runtime change. Unrelated pull requests can complete this fixture without a false cleanup failure.
Why This Change Was Made
The failing assertion checked
disposed, not registration.withQuestionGateway.holdNextHello()signals receipt ofconnectwhile withholdinghello-ok; the test deliberately throws after that signal, beforequestion.requestcan register.withCliQuestionLoopback()aborts the HTTP request and joins its response, the MCP listener/work scope, tool cancellation, and the question Gateway before closing fixture state. Theask_userregistration failure also awaits its Gateway cancellation RPCs. Only then didrun.finally()setdisposed, whilevi.waitFor()sampled every 50 ms and failed after 1,000 ms.The test now awaits that same
runowner while hello remains held. It verifies request settlement and pending-question cleanup, and covers fixture failure both before and after registration.onTestFinishedretains recovery on assertion failure or test timeout; a cancellation check prevents slow setup from starting a late request. Unexpected cleanup errors still propagate. Normal test deadlines are unchanged.#138214 added the registration barrier and ordered cleanup, but this disposal poll remained. #149154 changed prepared CLI capture activation; this regression uses an attach grant and does not call
prepare().Evidence
Observed occurrence: checks-node-compact-large-18, run 35178148472 / job 105064503656, PR #150399 at
584a7517b:expected false to be true, old test line 545, case duration 1,666 ms.The local baseline did not reproduce spontaneously. The controlled probe held the cancellation connection using the existing hello barrier and introduced an event-loop stall before releasing it; that temporary fault injection is absent from the final diff.
Both stress samples use Node 24.21.0 on macOS arm64,
CI=1,NODE_OPTIONS=--max-old-space-size=8192,OPENCLAW_VITEST_MAX_WORKERS=2,OPENCLAW_TEST_PROJECTS_PARALLEL=1, andtest/vitest/vitest.gateway-core.config.ts(threads,isolate: true), matching the target CI group's worker/isolation settings.src/gateway/mcp-http*.test.tsfiles: 197 tests passed.node scripts/check-changed.mjs: passed, including gateway-root test types, formatting, guards, dead-export scans, and lint.git diff --check: passed.The change is limited to test sequencing and recovery. No documentation update is needed for runtime behavior.