Repository navigation
perf(test): synchronize MCP lifecycle tests - #124389
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Land-ready proof for exact head
No production code, docs, config, dependencies, or release surfaces changed. Production LOC: |
|
Codex review: needs maintainer review before merge. Reviewed August 15, 2026, 11:44 PM ET / August 16, 2026, 03:44 UTC. ClawSweeper reviewWhat this changesThe PR replaces fixed MCP lifecycle-test delays with filesystem release gates that wait for real stdio test-server progress. Merge readinessKeep open. Current main still uses the fixed 500 ms and 750 ms test delays; this focused maintainer PR replaces them with state-observing gates in the real stdio harness. No correctness or security defect was found, though the behind-base branch needs the routine exact-head refresh before landing. Priority: P3 Review scores
Verification
How this fits togetherAgent MCP runtime tests launch real stdio child servers, build a tool catalog, and route tool calls through live runtime sessions. The changed test harness holds a flowchart LR
A[MCP lifecycle test] --> B[Real stdio child server]
B --> C[Server log and release file]
C --> D[Catalog retry or reconnect]
D --> E[Sibling tool routing]
E --> F[Lifecycle assertions]
Before merge
Agent review detailsSecurityNone. PR surfaceTests +30. Total +30 across 1 file. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Retain the real-stdio lifecycle coverage and use explicit server-state release gates for both retry and reconnect paths, eliminating elapsed-time synchronization. Do we have a high-confidence way to reproduce the issue? Not applicable: this PR improves test synchronization rather than repairing a user-reported runtime failure; the PR body supplies a focused Testbox validation path. Is this the best way to solve the issue? Yes. The release gates observe the real stdio lifecycle boundary that the tests need, whereas fixed sleeps only approximate it. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 5943cd0362e0. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Merged via squash.
|
What Problem This Solves
Two MCP runtime lifecycle regressions spend about two seconds waiting on fixed child-process initialization delays. The sleeps make a focused 91-test owner suite materially slower while still relying on elapsed time rather than observing the lifecycle state each case needs.
Why This Change Was Made
Replace the 500 ms catalog-retry delay and the 750 ms-per-process reconnect delay with filesystem release gates already supported by the real stdio test server. Each test now waits until the replacement server has received its second
tools/list, proves the healthy sibling remains callable while recovery is blocked, then releases the exact operation under test.The suite still exercises the real MCP SDK, child processes, stdio transport, stale-while-revalidate catalog path, SIGKILL close handling, fail-closed disconnected calls, sibling routing, and replacement PID. No production code changes.
User Impact
Maintainer test feedback is faster and less timing-dependent. Runtime behavior is unchanged.
Evidence
Controlled same-Testbox A/B on
tbx_01m049k24ea63j530ermpf157x, one excluded warmup plus two retained samples per state, one worker, distinct filesystem module caches, import diagnostics, and/usr/bin/time -v:CPU and peak RSS were effectively flat, so this PR makes no resource-usage claim.
Validation:
check:changedcore-test gate on the retained Testbox, including core test typecheck and targeted lint.origin/main: no accepted/actionable findings.catalog retry blocked the triggering turnwhile the release gate is closed.Testbox hydration run: https://github.com/openclaw/openclaw/actions/runs/31924169948