Repository navigation
fix(mcp): paginated listings no longer time out after a forward clock step - #137206
Conversation
… step collectMcpPaginatedItems() kept its absolute deadline on Date.now() while the abort timer ran on the event loop. A forward wall-clock step during a page load made the synchronous deadline check report "timed out" for a listing that was still well within its budget; a backward step left only the timer to enforce it. Keep the deadline on performance.now(). Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01HCNKceEs9sPdb6aHK3FqPf
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: blocked before merge. Reviewed September 4, 2026, 10:45 AM ET / 14:45 UTC. ClawSweeper reviewWhat this changesThe branch changes shared MCP pagination deadline checks to use a monotonic clock and adds regression coverage for a forward wall-clock adjustment. Regression provenancePossible regression — probable (reviewed change; reproduction). No predecessor PR is attributed. Merge readiness⛔ Blocked before merge - 2 items remain Keep open. Current main and the latest release still use wall-clock deadline checks; the exact PR head consistently uses a monotonic clock at the shared owner, with no blocking correctness or security finding. The remaining merge gate is a complete green required-check rollup for the refreshed exact head. Priority: P2 Review scores
Verification
How this fits togetherMCP pagination collects paged tool, resource, and prompt inventories from MCP servers. Its bounded result feeds both node-host tools and bundled-agent MCP capabilities. flowchart LR
A[MCP server pages] --> B[Shared pagination collector]
C[Timeout and abort signals] --> B
B --> D[Monotonic deadline check]
D --> E[Bounded item inventory]
E --> F[Node host tools]
E --> G[Bundled agent MCP tools]
Before merge
Agent review detailsSecurityNone. PR surfaceSource 0, Tests +25. Total +25 across 2 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Retain the shared monotonic-clock repair and merge it once the refreshed exact head has a complete green required-check rollup. Do we have a high-confidence way to reproduce the issue? Yes, from source: current main compares a wall-clock deadline after every page while the collector’s timer is duration-based, so a forward wall-clock step can satisfy the synchronous timeout condition before the elapsed budget expires. The supplied real CLI/Gateway baseline trace independently reports that outcome. Is this the best way to solve the issue? Yes. Moving both reads of the existing shared deadline to the monotonic clock is the narrow owner-boundary repair; it preserves the timer, abort propagation, limits, and per-request timeout instead of adding caller-specific compensation. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 523221e3767f. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (6 earlier review cycles)
|
…t firing its timer Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01HCNKceEs9sPdb6aHK3FqPf
|
The MCP fix passes the real headless-node CLI/Gateway proof, all 156 focused tests, changed-file lint, and independent review at The remaining failure in CI run 33740210960, attempt 2, is the unrelated Refreshing the PR's CI merge context against current main by closing and immediately reopening it. The contributor's head and implementation remain unchanged. No failed-check bypass is being used. |
|
The refreshed head is The previous close/reopen did not refresh the integration tree. Both remaining failed jobs in run 33877951701 checked out the old The new head passed the same real headless-node CLI, paired Gateway, and functional three-page MCP server proof:
All 157 focused tests passed on the refreshed head (34 + 123 in the raw summaries; my earlier total of 156 was incorrect). The original current-main failure proof remains valid. No host clock, production clock function, manager, runtime, test assertion, or timeout limit was replaced or weakened. The earlier clock-spy finding remains disproved by the actual Vitest timer lifecycle: fake timers replace the performance object, and Exact-head CI 33882857173, attempt 2, is now green. All 155 job records are complete. The one failed-job recovery used GitHub-hosted Ubuntu and the correct refreshed integration; the projection-persistence test passed without source or assertion changes. Fresh evidence-enabled independent review and the guarded merge dry-run both passed. No CI exception is used. AI-assisted verification; contributor attribution is preserved. |
sylvesterkaczmarek
left a comment
There was a problem hiding this comment.
Runtime change is correct. One issue: restore the performance.now() spy after the synchronous-deadline test; vi.useRealTimers() does not restore spies, so the next test can inherit the mocked clock.
Merge the current main snapshot to include its landed Gateway and spawn fixture repairs. Closing and reopening the PR retained the old synthetic merge checkout. Preserve the contributor commits and the unchanged two-file pagination repair.
|
Thanks @coderdailyone! Merged as 6505c061f012, preserving your implementation and attribution. Proof: normal built headless-node CLI, real paired Gateway, and a functional three-page MCP server.
No-step controls passed. Refreshed head ceb053b34aa2 passed 157 focused tests, formatting, lint, fresh evidence-enabled independent review, and CI run 33882857173, attempt 2. Guarded landing used no failed-check exception. AI-assisted verification. |
…9-prep * commit '407a8f453c0f0306af1ddc0aafa8697c1d49a9e7': (312 commits) perf(ui): coalesce automation event refreshes (#138065) fix: reject incomplete Skill Workshop directory reads (#138082) test(ui): decouple rendering checks from generated wording (#138283) perf: avoid temporary entries in bounded JSON traversal (#138017) fix(irc): render complete messages before splitting (#138328) perf: prepare worker trajectory payloads only for recorded events (#138086) fix(mcp): paginated listings no longer time out after a forward clock step (#137206) fix(codex): page native transcripts and bound UI previews (#136282) feat(gateway): apply more settings without restarting (#138112) fix(docs): preserve mirrored ClawHub maturity links (#138241) fix(test): own UI animation and legacy database setup (#138296) fix(tts): preserve literal directives in Markdown code (#138319) fix: load chat widgets behind authenticated gateways (#138074) chore(ui): cover native approval finalization (#137259) fix(cron): cancel conditions before main-session handoff (#138313) fix(backup): preserve text after embedded NUL characters (#138327) fix(android): align composer control sheets (#137442) fix(ci): wait for replacement PR runs instead of stale failures (#138307) fix(sessions): keep Gateway responsive with long transcripts (#138094) fix(computer): map window inputs to delivered image coordinates (#138271) ... # Conflicts: # scripts/release-check.ts # test/release-check.test.ts
… step (openclaw#137206) Keep the shared MCP pagination deadline on performance.now so wall-clock adjustments cannot expire listings before their configured duration. Preserve the existing timer, synchronous deadline checks, abort propagation, parsing, page/item/byte bounds and request budgets. Verified the normal headless node CLI and a real paired Gateway against a functional three-page MCP server. Main failed after 228 ms under a +60-second process-local clock step; the refreshed head listed all three tools in 310 ms and invoked the third-page tool successfully. No-step and genuine-timeout controls passed. All 157 focused tests passed. Co-authored-by: coderdailyone <[email protected]> Co-authored-by: Ayaan Zaidi <[email protected]>
What Problem This Solves
Fixes an issue where operators using MCP servers would see tool, resource, or prompt listings fail after a forward system-clock adjustment, even though the listing was still within its configured timeout.
Why This Change Was Made
The shared pagination collector used wall time for its synchronous deadline checks but an elapsed-time timer for cancellation. Both deadline reads now use
performance.now(). The timer, cancellation, page and item limits, byte budget, parsing, and per-request timeout remain unchanged.The synchronous checks remain necessary: page processing can cross the deadline before the timer callback runs. Fixing the shared owner covers node-host tools and bundled-agent tool, resource, and prompt listings without adding caller-specific policy.
Related: #135281.
User Impact
Paginated MCP listings keep their configured duration budget across wall-clock adjustments. Slow listings still time out. No configuration or public API changes.
Evidence
Verified on Node 24.19.0 with the normal built
openclaw node runCLI, a real paired Gateway, and a functional MCP SDK 1.30.0 server. The server exposes three executable tools over three pages. The configured timeout is 2,000 ms.8849e7073e193bf0d69652f7439e7d4c9df56bd2.434934b9ea63fe06d80946f7cd11af21197b6e42.node.describeandnode.invokemethods.performance.now()andhrtimeadvanced normally. No host clock change,Date.nowreplacement, direct manager import, or replacement runtime.Elapsed results above start at the first server request. The actual node CLI clock observations were:
The same product flow ran from fresh process instances for each control. The third-page call used a different input each time, and the server recorded that downstream call.
Validation:
pnpm buildpassed for both revisions in a secretless isolated Linux container.node scripts/run-vitest.mjs src/agents/mcp-pagination.test.ts src/node-host/mcp.test.ts src/node-host/mcp.recovery.test.ts src/agents/agent-bundle-mcp-runtime.test.ts: 156 tests passed across four files.git diff --checkpassed.The MCP SDK request timer and abort behavior were checked directly. The separate Codex Rust collectors already use elapsed-time durations; this change does not alter them.
AI-assisted verification. Contributor implementation and attribution are preserved.
Refreshed-head verification
Head
ceb053b34aa2f2758b0515b313a65c80a747da4bmerges main09ca6ca8ad897b0015dc9e0252bd48b9bd35c723while retaining both contributor commits. The two MCP files are byte-identical to the original head; the PR diff remains unchanged.The normal build and the same real CLI/Gateway/server proof passed again on Node 24.20.0. The clock-step listing completed in 310 ms and the third-page tool returned a fresh input. No-step behavior passed, and the genuine slow-page control timed out at about 1,990 ms. Inside the actual node CLI, wall time advanced 60,100 ms while monotonic time advanced about 99 ms. All 157 focused tests passed (34 + 123 in the raw summaries; the earlier refreshed-head total of 156 was incorrect).
Landing status
Exact-head CI 33882857173, attempt 2, is green with all 155 job records complete. The failed-job recovery used GitHub-hosted Ubuntu and the verified refreshed integration
85e17635; the unrelated projection-persistence timeout passed without source or assertion changes. Fresh evidence-enabled independent review also passed with no accepted findings. Guarded merge dry-run passed with no CI exception.The suggested clock-spy cleanup was verified against Vitest 4.1.11 and is not needed: fake timers install a separate performance object, and the existing
vi.useRealTimers()cleanup restores the native object. A standalone dependency probe confirmed that the next test's fake clock has no spy and advances normally. Existing focused coverage and exact-head review remain valid.