Add paged or per-file diff #124
Labels
No labels
Compat/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/OpenSpec
Kind/Security
Kind/Testing
Priority/Critical
Priority/High
Priority/Low
Priority/Medium
RFC - Request For Comments
Reviewed/Confirmed
Reviewed/Duplicate
Reviewed/Invalid
Reviewed/Won't Fix
Status/Abandoned
Status/Blocked
Status/Need More Info
hermes-attempted
hermes-needs-clarification
hermes-ready
hermes-review
hermes-wip
human-required
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
agentic-forges/forgejo-mcp#124
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Currently, it seems that
get_pull_request_diff(which seems to be lacking fromREADME.md) is the only means for the agent to request a diff between source and target branch. However, since it supports no paging, this can easily lead to a result that blows up the model's context window. We thus do a manual cut-off for the return value, but then the agent only gets part of the diff and has no means of getting the rest.It would probably be best to give the agent the means to query the files that changed (maybe paged, but that's less crucial here) as well as the possibility to get the diff for a specific file (definitely paged). This would allow it to not look at every diff but be more selective.
Actually, come to think of it, also
list_pull_request_filesandlist_pull_reviewsare susceptible to having too long an output. I restricted the length to 16kB, and they easily break this limit. So maybe a uniform approach to all functions might be more sensible.EDIT: And of course
get_file_contentis a heavy hitter as well. Here specifying a line-based range might be best, like most tools do for agent interaction.Thanks for the report — confirmed valid against current
main(dec5be5). Triage notes:What's already paged
list_pull_request_filesandlist_pull_reviewsalready acceptpage/limit(defaults 1 / 50). If your 16 kB envelope cap clips them, the fix on the agent side is to request a smallerlimit. Server-side defaults could probably be tightened, but the knobs exist.What's not paged (the real gaps)
get_pull_request_diff— single blob, no paging, no per-file filter. Confirmed inoperation/pull/pull.go:386-395. This is the worst offender for context blowups.get_file_content— no line-range params. Confirmed inoperation/repo/file.go:25-33. A large file is returned in full.get_pull_request_diffandlist_pull_request_filesare not in the tool table. Will fix alongside.Proposed direction
file_pathparameter toget_pull_request_diffso the agent can fetch one file at a time. Implementable client-side by parsing the unified diff and slicing ondiff --gitboundaries if the SDK has no native support. Pair this withlist_pull_request_filesso the agent has a cheap file index first.max_bytes/offsetbyte-range params on the raw diff. Per-file is the cleaner abstraction.get_file_contentline range: addstart_line/end_lineparams; slice server-side fromGetFileoutput. Cheap to implement, no SDK change needed.Marking
Kind/Enhancement+Priority/Medium. Will scope an implementation PR; per-file diff first since it gives the biggest win for the smallest API surface.