Skip to content

fix(test): stabilize MCP catalog recovery timing - #150887

Merged
steipete merged 1 commit into
mainfrom
upd/flake-bundle-mcp-dispose-timeout
Sep 17, 2026
Merged

steipete merged 1 commit into
mainfrom
upd/flake-bundle-mcp-dispose-timeout

Conversation

@steipete

Copy link
Copy Markdown
Contributor

Related: #150364

What Problem This Solves

The MCP catalog recovery regression test can time out on its final successful HTTP call when a CI worker is busy, as seen in job 105166410906 on #150803.

User Impact

Improves CI reliability. Production behavior, request timeout values, configuration, dependencies, and schemas are unchanged.

Why This Change Was Made

The fixture used the same 50 ms wall-clock deadline for six deliberate hangs and the final successful call. The test now advances that deadline only after the server receives each intentionally hung request. Real HTTP traffic, the 500 ms overlap observation window, the single-flight assertion, and successful tool execution remain covered. It also waits for the client to publish the recovered catalog instead of treating the server's response submission as completion.

This is a pre-existing test timing race exposed under load, not a regression from #150364. The test and per-server recovery owner are unchanged by #150364, and its unused-server retirement path is not invoked here. A temporary 100 ms response stall reproduces the exact RequestTimeout(50) on the old parent even after full catalog publication; the repaired fixture passes the same stall. The temporary stall is not included in this change.

The HTTP fixture moves into a focused test helper so the existing oversized test file shrinks without a baseline change or suppression.

Evidence

  • Linux attribution: pinned main 18f505eb41e8 and parent e1d457ede625 each passed 20 whole-file runs (128 tests/run) and 20 original-order disposeSession timeout group runs (10 tests/run), with zero natural failures.
  • Controlled stall: the old fixture fails with the original timeout on macOS and on the pre-fix(mcp): stop unused servers from accumulating across sessions #150364 Linux parent; the repaired fixture passes on both platforms without changing any timeout value.
  • The original 109-file agentic-agents-core-runtime-hosted-3 shard selection passed 14 Linux iterations and seven macOS iterations. macOS iteration 8 failed only in the untouched reload marker test; the repaired target passed in all eight macOS attempts. The shard was not rerun. This separate failure was classified as host overload, and the completed proof was accepted.
  • As a separate one-time check, revokes transferred active work while unrelated transport cleanup is pending passed in isolation with one worker and no other work in this worktree: 3.121 s test time, 34.96 s total wall time (/usr/bin/time -p). No retry was used.
  • All 99 session-reset tests passed across six suites on Linux.
  • node scripts/check-changed.mjs passed in full. Fresh Codex branch review (--mode branch --base origin/main --max-priority P1) is scoped-clean on 86acccd39914305fe3e09db320a73bacdb06b9e2, with no accepted P0/P1 findings.
  • Production LOC: 0. Tests and test support: +186/-179 (net +7), primarily fixture extraction.

Control the six intentional request timeouts from observed HTTP request arrival,
retain the real overlap observation window, and await client catalog publication
before the final successful call. Extract the HTTP fixture to keep the existing
oversized test file from growing.

The 50 ms successful-call deadline was a pre-existing test timing race exposed
under load, not a regression from #150364. Production behavior and timeout values
are unchanged.

Validation: 20 file and 20 original-order group runs at both Linux revisions;
controlled stall fails before and passes after on Linux and macOS; 99 session-reset
tests and check:changed pass. The separate reload marker case passed its single
isolated one-worker run in 3.121s (34.96s total wall time).

Related: #150364
CI evidence: https://github.com/openclaw/openclaw/actions/runs/35209479990/job/105166410906
@clawsweeper

clawsweeper Bot commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: M maintainer Maintainer-authored PR labels Sep 17, 2026
@steipete
steipete marked this pull request as ready for review September 17, 2026 12:31
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 17, 2026
@clawsweeper

clawsweeper Bot commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 17, 2026, 8:39 AM ET / 12:39 UTC.

ClawSweeper review

What this changes

The PR stabilizes an MCP catalog recovery test by controlling intentional timeouts, awaiting catalog publication, and extracting its HTTP server fixture.

Merge readiness

✅ Ready for maintainer review

The timing repair remains useful: current main retains the vulnerable fixture. No actionable correctness or security findings were identified, and this maintainer-owned PR is protected from automatic closure.

Priority: P2
Reviewed head: 86acccd39914305fe3e09db320a73bacdb06b9e2

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused test repair that preserves meaningful recovery coverage and supplies relevant validation, with no identified blocking defect.
Proof confidence 🌊 off-meta tidepool Not applicable: The ordinary contributor-proof gate is exempt for this maintainer-owned test repair; the body additionally reports before-and-after controlled stalls through the session runtime and real HTTP transport on Linux and macOS.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The ordinary contributor-proof gate is exempt for this maintainer-owned test repair; the body additionally reports before-and-after controlled stalls through the session runtime and real HTTP transport on Linux and macOS.
Evidence reviewed 8 items Introduced test behavior: The complete changed test and extracted fixture preserve HTTP transport, six intentional failures, the real 500 ms overlap window, the single-flight assertion, and successful execution. Deferred request-arrival signals precede timer advancement; catalog diagnostics must clear before the final call.
Current main still needs the repair: Fetched main still uses wall-clock request expiration and treats the server-side pending-list count reaching zero as completion before reading the published catalog.
Production recovery boundary: The unchanged runtime creates the request timeout before invoking the client, recycles after three locally timed-out requests, and maintains a per-server in-flight catalog promise. The combined runtime derives its visible catalog from those server owners. This test exercises OpenClaw’s in-process runtime; no changed behavior depends on the Codex harness.
Findings None None.
Security None None.

How this fits together

OpenClaw’s session MCP runtime discovers tools from connected servers and rebuilds their catalogs after connection failures. This test checks that recovering one server does not duplicate another server’s pending discovery request.

flowchart TD
  A[Test requests] --> B[Session MCP runtime]
  B --> C[Two local HTTP servers]
  C --> D[Intentional request hangs]
  D --> E[Controlled timeout advancement]
  E --> B
  B --> F[Single-flight catalog recovery]
  F --> G[Published catalog and successful tool call]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Tests +7. Total +7 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 2 186 179 +7
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 186 179 +7

Review metrics

None.

Technical review

Best possible solution:

Keep recovery coverage at the real HTTP boundary while synchronizing deliberate failures and observing client publication explicitly.

Do we have a high-confidence way to reproduce the issue?

Yes: source shows the old successful HTTP call competing with a 50 ms wall-clock deadline, and the PR reports a controlled 100 ms stall reproducing that failure before the fix. This review did not execute the reproduction.

Is this the best way to solve the issue?

Yes: synchronizing intentional timeouts and waiting for client publication addresses the fixture races without increasing production deadlines or weakening the single-flight assertion.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 6a7b1e41d281.

Labels

Label changes:

  • add P2: This is a bounded repair for a documented CI timing race, with no production behavior change.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The ordinary contributor-proof gate is exempt for this maintainer-owned test repair; the body additionally reports before-and-after controlled stalls through the session runtime and real HTTP transport on Linux and macOS.

Label justifications:

  • P2: This is a bounded repair for a documented CI timing race, with no production behavior change.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The ordinary contributor-proof gate is exempt for this maintainer-owned test repair; the body additionally reports before-and-after controlled stalls through the session runtime and real HTTP transport on Linux and macOS.

Evidence

What I checked:

  • Introduced test behavior: The complete changed test and extracted fixture preserve HTTP transport, six intentional failures, the real 500 ms overlap window, the single-flight assertion, and successful execution. Deferred request-arrival signals precede timer advancement; catalog diagnostics must clear before the final call. (src/agents/agent-bundle-mcp-runtime.test.ts:6301, 86acccd39914)
  • Current main still needs the repair: Fetched main still uses wall-clock request expiration and treats the server-side pending-list count reaching zero as completion before reading the published catalog. (src/agents/agent-bundle-mcp-runtime.test.ts:6454, 6a7b1e41d281)
  • Production recovery boundary: The unchanged runtime creates the request timeout before invoking the client, recycles after three locally timed-out requests, and maintains a per-server in-flight catalog promise. The combined runtime derives its visible catalog from those server owners. This test exercises OpenClaw’s in-process runtime; no changed behavior depends on the Codex harness. (src/agents/agent-bundle-mcp-runtime.ts:597, 86acccd39914)
  • Timer dependency contract: The introduced vi.waitFor call depends on Vitest 5.0.0, pinned by the target package.json. Its implementation uses safe polling timers, advances fake time during polling, and clears polling on success; the final tool call therefore runs after polling has stopped. (packages/vitest/src/integrations/wait.ts:29, f441c6fab25e)
  • Latest release comparison: The v2026.9.4 test still contains the old timeOutServer implementation, without the request-arrival and captured-real-timer changes. The release check used GitHub contents after local release-object inspection failed. (src/agents/agent-bundle-mcp-runtime.test.ts:6131, 3a9d69db306c)
  • Validation supplied with the PR: The captured body at sourceRevision d65189f560b8e6451d085a076dc445ba096449a596efec9ec9adaa930b7e97e5 reports a controlled 100 ms response stall failing before and passing after on Linux and macOS, original-order repeated runs, and changed checks passing. The separate reload-marker failure is disclosed. These are contributor-reported results; this read-only review did not execute tests. (86acccd39914)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@steipete
steipete merged commit 324208c into main Sep 17, 2026
167 checks passed
@steipete
steipete deleted the upd/flake-bundle-mcp-dispose-timeout branch September 17, 2026 12:57
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 18, 2026
Stabilize the MCP catalog recovery regression under busy CI workers. The fixture
previously raced the final healthy HTTP call against a 50 ms wall-clock deadline
and observed server response submission before client catalog publication.

Synchronize six intentional timeouts with observed HTTP request arrival, retain
the real 500 ms overlap window and single-flight assertion, and await the
published catalog before successful tool execution. Extract the HTTP fixture so
the oversized test file shrinks without a baseline change or suppression.

Production behavior, timeout values, configuration, dependencies, and schemas are
unchanged. This was a pre-existing fixture timing race exposed under load, not a
regression from openclaw#150364. Production LOC: 0; tests and support: +186/-179.

Validation: controlled 100 ms response stalls failed before and passed after on
Linux and macOS; 99 session-reset tests and changed checks passed. The PR records
14 Linux and seven macOS original-shard passes; macOS attempt eight hit the
separate untouched reload-marker failure, while this target passed. The separate
marker test passed its single isolated check. Exact-head CI run 35221633216 is
green with zero pending checks. The accepted Codex review is scoped-clean and
ClawSweeper reported no actionable findings or before-merge items.

Related: openclaw#150364
CI: https://github.com/openclaw/openclaw/actions/runs/35221633216
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: M status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant