Repository navigation
fix(mcp): bound catalog pagination - #116845
Conversation
|
Codex review: needs maintainer review before merge. Reviewed July 31, 2026, 9:25 AM ET / 13:25 UTC. ClawSweeper reviewWhat this changesThis PR replaces separate MCP catalog pagination loops with a shared collector that preserves opaque cursors while bounding pages, items, bytes, deadline, and cancellation for node-host tools and agent-session tools, resources, and prompts. Merge readinessThe bounded shared paginator looks like a focused response to a real MCP catalog availability problem, with prior review findings addressed and detailed exact-head Testbox evidence in the PR body. Keep this PR open for maintainer review because it intentionally changes timeout and failure behavior for existing multi-page MCP servers, its branch is behind current Priority: P2 Review scores
Verification
How this fits togetherOpenClaw queries configured MCP servers for paginated capability catalogs, then turns those results into node-host tool descriptors and agent-session tools, resources, and prompts. This change inserts one shared guardrail layer between MCP list responses and the runtime-specific filtering, ordering, and publication paths. flowchart LR
A[Configured MCP server] --> B[Paginated catalog response]
C[Timeout and cancellation] --> D[Shared bounded paginator]
B --> D
D --> E[Cursor and size limits]
E --> F[Node-host tool descriptors]
E --> G[Agent-session tools resources prompts]
F --> H[Published capabilities]
G --> H
Decision needed
Why: This is a compatibility and availability tradeoff rather than a mechanical correctness question: the patch deliberately changes the operating contract for existing MCP catalog loading. Before merge
Agent review detailsSecurityNone. PR surfaceSource +187, Tests +591. Total +778 across 6 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Copy recommended automerge instructionTechnical reviewBest possible solution: Retain one shared bounded paginator, but land it only after maintainers accept the aggregate-timeout and cap policy for existing MCP servers, the branch is refreshed onto current Do we have a high-confidence way to reproduce the issue? Yes, from source and supplied focused tests: a list response with an empty, repeated, cyclic, or endless cursor, or a sequence exceeding the aggregate deadline, follows the reported unsafe pagination path. The supplied Testbox report states these cases were exercised on the branch, though this read-only review could not independently execute them. Is this the best way to solve the issue? Yes, conditionally: centralizing the invariant in one collector is more maintainable than separately patching node-host and each agent-session list loop. The remaining question is whether the aggregate deadline and fixed caps are the intended compatibility contract for existing servers. AGENTS.md: unclear because the file could not be read completely. Codex review notes: model internal, reasoning high; reviewed against aaab981ab097. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
|
Maintainer decision on the final reviewed head
This completes the current ClawSweeper rank-up moves without introducing needless commit churn. |
|
Merged via squash.
|
* fix(node-host): bound MCP tool pagination * fix(node-host): bound MCP catalog duration * style(node-host): format MCP pagination test * fix(mcp): share bounded pagination * fix(mcp): keep pagination types private * test(mcp): normalize abort rejection * fix(mcp): enforce pagination deadline after loading * fix(mcp): stabilize pagination deadline ownership
What Problem This Solves
Fixes an issue where an MCP server could keep node-host or agent-session catalog loading alive indefinitely with repeated or endless pagination cursors, multiply the configured timeout per page, grow retained results without bound, or silently lose later pages when the valid opaque cursor was an empty string.
Why This Change Was Made
One shared MCP pagination owner now governs node-host tools and session-bundle tools, resources, and prompts. It preserves opaque cursors, detects cursor cycles, caps pages/items/serialized bytes, applies one absolute deadline with remaining per-page budgets, composes caller cancellation, and rechecks cancellation/deadline after synchronous final-page processing. Each runtime keeps its existing filtering and ordering behavior and isolates only the offending MCP server.
User Impact
A malformed or unresponsive MCP server can no longer hang catalog startup or utility listing indefinitely, starve healthy sibling servers, or force unbounded catalog accumulation. Normal multi-page servers continue to return complete ordered results within their configured budget.
Evidence
tbx_01kyw39g39ng77pbnpvdmr1b4g, run30631751241.@modelcontextprotocol/sdk1.30.0 source/types confirm that cursors are arbitrary strings (including empty),nextCursoris optional, and request timeout/maxTotalTimeoutare per SDK request; OpenClaw therefore owns the multi-page deadline.No protocol, configuration, dependency, persisted-state, or MCP output-shape changes.