Skip to content

fix(server): validate cursors when pagination is disabled - #6045

Merged
zzstoatzz merged 2 commits into
PrefectHQ:mainfrom
xu91102:codex/validate-unpaginated-cursors
Nov 10, 2026
Merged

zzstoatzz merged 2 commits into
PrefectHQ:mainfrom
xu91102:codex/validate-unpaginated-cursors

Conversation

@xu91102

@xu91102 xu91102 commented Oct 26, 2026

Copy link
Copy Markdown
Contributor

Description

Fixes #6035. With the default list_page_size=None, requests such as tools/list with cursor="not-a-real-cursor" currently return a successful first page, while the same cursor with pagination enabled returns -32602. Validate non-empty cursors through the existing decoder before the unlimited-listing return, so tools, resources, resource templates, prompts, and the Skills extension apply the same error policy. Cursorless, empty-cursor, valid unpaged-cursor and configured-pagination behavior remain unchanged.

Regression coverage exercises the real MCP request path for each list type. The client cycle tests now use a protocol peer that owns its opaque cursors, preserving empty-string, constant/cycling-cursor and maximum-page safeguards without changing production client behavior. The pagination docs describe the error; the MCP specification recommends this response with SHOULD rather than MUST. Full pytest: 9902 passed, 14 skipped, 16 xfailed; whole-tree prek and documentation checks passed.

Contribution type

  • Bug fix (simple, well-scoped fix for a clearly broken behavior)
  • Documentation improvement
  • Enhancement

Checklist

  • This PR addresses an existing issue (or fixes a self-evident bug)
  • I have read CONTRIBUTING.md
  • I have added tests that cover my changes
  • I have run uv run prek run --all-files and all checks pass
  • I have self-reviewed my changes
  • If I used an LLM, it followed the repo's contributing conventions (not generic output)

🤖 Generated with Codex.

Co-authored-by: Dylan Momplaisir 10041654+DMomplaisir@users.noreply.github.com

Reuse CursorState.decode in the unlimited-listing branch and preserve
opaque client cursor cycle safeguards through a real protocol peer.

Fixes PrefectHQ#6035

🤖 Generated with Codex.

Co-authored-by: Dylan Momplaisir <10041654+DMomplaisir@users.noreply.github.com>
@marvin-context-protocol marvin-context-protocol Bot added bug Something isn't working. Reports of errors, unexpected behavior, or broken functionality. server Related to FastMCP server implementation or server-side functionality. labels Oct 26, 2026
@xu91102
xu91102 marked this pull request as ready for review October 26, 2026 04:49
@github-actions

This comment has been minimized.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-10-26T04:50:20.207819Z
We couldn’t complete this review. Comment @codex review to try again.
6dd3128 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@zzstoatzz
zzstoatzz merged commit 4917bee into PrefectHQ:main Nov 10, 2026
24 checks passed
zzstoatzz added a commit that referenced this pull request Nov 10, 2026
* Revert "fix: preserve referenced schema definitions (#5588)"

This reverts commit 5f1d152.

* Revert "fix(server): rebuild tool argument errors instead of echoing pydantic's (#6107)"

This reverts commit 8fba5f7.

* Revert "Advertise the MCP Apps extension only when the server serves an app (#5062)"

This reverts commit b89222b.

* Revert "fix(tasks): retain results after tool removal (#5507)"

This reverts commit 711575a.

* Revert "fix(client): Prevent stale ClientGroup refreshes from replacing newer routes (#5543)"

This reverts commit 365d5d2.

* Revert "fix(prompts): honor field aliases when rendering prompts (#5836)"

This reverts commit a450fd8.

* Revert "Stop FastMCP callable caches from retaining dropped tools (#6147)"

This reverts commit 713f247.

* Revert "feat(auth): Add KeystoneTokenVerifier (#6264)"

This reverts commit c33f3de.

* Revert "fix(json-schema): keep x-unsupported-pattern when a format is set (#5731)"

This reverts commit dc9849d.

* Revert "Roll back the tool stamp when a tool registration is rejected (#5798)"

This reverts commit d6566c5.

* Revert "fix(server): validate cursors when pagination is disabled (#6045)"

This reverts commit 4917bee.

* Revert "Keep constraints on scalar schema references (#6041)"

This reverts commit e5176c9.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working. Reports of errors, unexpected behavior, or broken functionality. bypass-issue-check server Related to FastMCP server implementation or server-side functionality.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Invalid list cursors are ignored when list_page_size is unset

2 participants