Skip to content

feat(server): allow integrations to raise the response cap per-tool#182

Merged
daltoniam merged 1 commit into
mainfrom
feat/per-tool-response-cap
Jun 3, 2026
Merged

feat(server): allow integrations to raise the response cap per-tool#182
daltoniam merged 1 commit into
mainfrom
feat/per-tool-response-cap

Conversation

@daltoniam
Copy link
Copy Markdown
Owner

@daltoniam daltoniam commented Jun 3, 2026

Summary

  • 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 integration-wide MaxResponseBytesIntegration override remains the fallback when no per-tool value is declared.
  • Threads the tool name through both responseLimitFor callsites (server.handleExecute and ProjectRouter.makeExecuteHandler) so the new interface runs on both the standard and project-scoped paths.
  • Puts the interface to use on 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=1
  • golangci-lint run (0 issues)
  • New unit tests pin both callsites: TestHandleExecute_PerToolCap{Honored,DoesNotLeakToOtherTools,WinsOverIntegrationCap} on the server path; TestProjectRouter_ExecutePerToolCap on the project router path; TestMaxResponseBytesForTool on the GitHub integration.

💘 Generated with Crush

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.
@daltoniam daltoniam merged commit 810b266 into main Jun 3, 2026
5 checks passed
@daltoniam daltoniam deleted the feat/per-tool-response-cap branch June 3, 2026 22:38
Copy link
Copy Markdown
Collaborator

@acmacalister acmacalister left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

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.

2 participants