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

未关闭
#3,316 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
76/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
github, go
领域
api, backend

调研方向

Start in pullrequests.go at the pull_request_read dispatch and review the existing method validation before dispatching. Use utils.NewToolResultError for unsupported pagination parameters, naming the selected method and parameter; done means mismatched page/perPage or after inputs return clear validation errors instead of being ignored.

由索引模型根据 Issue 内容生成。

描述

Describe the bug

pull_request_read exposes two pagination mechanisms in one schema:

  • page / perPage — used by get_files, get_commits, get_reviews, get_comments, get_check_runs
  • after (cursor) — used only by get_review_comments

When a caller passes a parameter the selected method doesn't use, the
server silently drops it and returns results as if it were never sent.
There is no error, warning, or hint in the response.

The schema description for after does say "used only by the
get_review_comments method", and the code comment confirms other methods
"ignore after" — but for an LLM caller a description is guidance, not
enforcement. The model sees a pagination cursor in the schema, receives a
page of files, and passes after to fetch the next page. It gets the first
page again and has no signal that anything was ignored.

The symmetric case also applies: passing page to get_review_comments
is silently ignored.

Steps to reproduce

  1. Call pull_request_read with method: "get_files" on a PR with more
    than one page of changed files, perPage: 10.
  2. Take any non-empty string as after and call again with the same
    method, perPage: 10, after: "<value>".
  3. Observe: the response is identical to step 1. No error.

Or:

  1. Call with method: "get_review_comments", page: 2.
  2. Observe: page is ignored, first page is returned.

Expected behavior

A pagination parameter that the selected method cannot honour should
produce a validation error naming the method and the parameter, e.g.
method "get_files" uses page/perPage pagination; "after" is not supported. This is consistent with how the tool already rejects an
unknown method.

Why this matters

Silent parameter drops are worst-case for agentic callers: the tool reports
success with a plausible payload, so the model has no reason to retry.
This is the same failure class as #2347 (silent truncation), and a
follow-up to #2489, which added after to the schema but did not add the
guard.

Suggested fix

Before dispatching on method, check whether the caller supplied a
pagination parameter the method doesn't use, and return
utils.NewToolResultError with a clear message. A small helper in
pullrequests.go covers all nine methods.

Happy to open a PR.

主要语言
Go
星标
33.1k
派生
5k
平均合并
2 天 15 小时
30 天内合并 PR
27

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

github/github-mcp-server 的其他 Issue

查看 github/github-mcp-server 的全部 Issue

相似的 Issue

更多 Go Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。