Skip to content

fix(pull_request_read): reject pagination parameters the selected method does not support - #3317

Open
larik15 wants to merge 1 commit into
github:mainfrom
larik15:fix/pull-request-read-pagination-guard
Open

larik15 wants to merge 1 commit into
github:mainfrom
larik15:fix/pull-request-read-pagination-guard

Conversation

@larik15

@larik15 larik15 commented Sep 21, 2026

Copy link
Copy Markdown

What

pull_request_read accepts two pagination styles in one schema — page/perPage
for the REST-backed list methods and after (a GraphQL cursor) for
get_review_comments. A parameter the selected method could not use was
dropped silently, so a caller passing after to get_files received the
first page again with no signal that nothing had advanced.

This adds a guard before the method dispatch that returns a tool error naming
the method and the unsupported parameter:

  • get_review_comments rejects page
  • get_files, get_commits, get_reviews, get_comments, get_check_runs reject after
  • get, get_diff, get_status reject all three, since they return a single object

Calls that already use the right parameters are unaffected.

Why

For an LLM caller a schema description is guidance, not enforcement. The
description for after already says it is only for get_review_comments,
but the model still sees a pagination cursor in the schema and reaches for
it when it wants the next page of files. Silent drops are the worst outcome
for that caller: the response is plausible, so it never retries.

Follow-up to #2489, which exposed after in the schema but did not add the
guard; same failure class as #2347.

Testing

go test ./pkg/github/... passes. Added Test_rejectUnsupportedPagination
covering the accepted and rejected combination for each method group.

Fixes #3316

@larik15
larik15 requested a review from a team as a code owner September 21, 2026 09:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

pull_request_read silently ignores pagination parameters that don't apply to the selected method

1 participant