feat(server): allow integrations to raise the response cap per-tool#182
Merged
Conversation
Adds PerToolMaxResponseBytesIntegration, an optional interface that lets an integration raise the 50KB default response cap for a single tool without loosening the safety net for the rest of its surface. The existing MaxResponseBytesIntegration override remains the fallback when no per-tool value is declared. Wires the new interface into responseLimitFor and threads the tool name through the project router and handleExecute callsites, then puts it to use on github_get_pull_diff (raw unified diff, no projection/pagination knob, 1MB cap) so PR review agents stop hitting "Response exceeded 50KB" for normal-sized PRs.
acmacalister
approved these changes
Jun 3, 2026
acmacalister
approved these changes
Jun 3, 2026
Collaborator
acmacalister
left a comment
There was a problem hiding this comment.
Clean PR — builds, tests pass (race detector clean), lint 0 issues. The layered priority logic in responseLimitFor is exactly right, the compile-time assertion in the GitHub adapter is a nice safety net, and the test matrix covers all three meaningful scenarios (honored, isolation, wins-over-integration-cap) on both the main and project-router paths. LGTM.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
PerToolMaxResponseBytesIntegration, an optional interface that lets an integration raise the 50KB default response cap for a single tool without loosening the safety net for the rest of its surface. The integration-wideMaxResponseBytesIntegrationoverride remains the fallback when no per-tool value is declared.responseLimitForcallsites (server.handleExecuteandProjectRouter.makeExecuteHandler) so the new interface runs on both the standard and project-scoped paths.github_get_pull_diff(raw unified diff, no projection/pagination knob, 1MB cap). The agents PR review flow has been hitting "Response exceeded 50KB" for normal-sized PRs (a 21-file/5k-line PR is ~200KB); this unblocks it without touching the other 195 GitHub tools.Motivation
The model kept calling
github_get_pull_diff, Switchboard kept rejecting the 193KB diff response, and the agent ran out of recovery moves. Switchboard already had a per-integration cap override (Confluence at 256KB), but raising the cap integration-wide for GitHub would weaken the safety net for the other 195 tools that should stay compact. The per-tool override targets the one tool that legitimately needs more headroom.Test plan
gofmt -w . && go vet ./...go build ./...go test ./... -count=1golangci-lint run(0 issues)TestHandleExecute_PerToolCap{Honored,DoesNotLeakToOtherTools,WinsOverIntegrationCap}on the server path;TestProjectRouter_ExecutePerToolCapon the project router path;TestMaxResponseBytesForToolon the GitHub integration.💘 Generated with Crush