fix: resources/list pagination + replay tolerance for protocol drift (MCP 2.0 prep) - #254
Conversation
|
ClawSweeper status: review started. I am starting a fresh review of this pull request: fix: resources/list pagination + replay tolerance for protocol drift (MCP 2.0 prep) This is item 1/1 in the current shard. Shard 0/1. This placeholder means the worker is alive and reading the current context. I will edit this same comment with the actual review when the claws are done clicking. Crustacean status: shell secured, claws on keyboard, evidence pebbles being sorted. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 99a483231c
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| for (let page = 1; page < MAX_RESOURCE_LIST_PAGES && response.nextCursor; page += 1) { | ||
| response = await client.listResources({ ...requestParams, cursor: response.nextCursor }); |
There was a problem hiding this comment.
Preserve old replay recordings when auto-paging resources
When replaying a recording captured before this change, a resources/list response may include nextCursor even though the old runtime stopped after that first page and therefore recorded no second resources/list request. This loop now immediately sends the cursor request against ReplayTransport, which has no corresponding recorded send/recv and throws a replay mismatch instead of returning the recorded result; gate auto-pagination in replay mode or make replay tolerate missing follow-up pages so existing paginated resource recordings remain usable.
Useful? React with 👍 / 👎.
Preparation for the MCP 2026-07-28 ("MCP 2.0") migration. Two independent fixes on the current SDK v1 line:
nextCursorand aggregates all pages (bounded at 100), matching what tools/list already did. Callers passing an explicitcursorstill get single-page behavior.protocolVersion, clientcapabilities, or mcporterclientInfodrift from what was recorded.initializeframes are matched on structure, and the recorded initialize result is adapted to the version the live client requested (SDK v1.30 rejects unknown initialize-result versions). This keeps every existing recording usable across the upcoming SDK v2 bump.Both covered by focused regression tests (pagination aggregate/explicit-cursor/cap; replay across a synthetic
2099-01-01recording). Full suite: 908 passed. Autoreview clean.Part 1 of the MCP 2.0 series; next: SDK v2 migration with dual-era negotiation.
🤖 Generated with Claude Code