Increase default payload size threshold from 1KB to 10KB#807
Conversation
Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Updates the gateway’s default inline-vs-disk payload cutoff to allow larger tool responses to be returned inline before falling back to on-disk storage, while keeping the threshold configurable via existing flag/env/config mechanisms.
Changes:
- Increased the default payload size threshold from 1024 bytes (1KB) to 10240 bytes (10KB).
- Updated inline documentation/comments to reflect the new 10KB default.
- Updated CLI flag default test expectations for the new threshold.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| internal/config/config_payload.go | Bumps DefaultPayloadSizeThreshold to 10240 and updates the default comment. |
| internal/config/config_core.go | Updates GatewayConfig.PayloadSizeThreshold default comment to 10KB. |
| internal/cmd/flags_logging.go | Bumps CLI default defaultPayloadSizeThreshold to 10240. |
| internal/cmd/flags_logging_test.go | Updates default-threshold test assertion to 10240. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // DefaultPayloadSizeThreshold is the default size threshold (in bytes) for storing payloads to disk. | ||
| // Payloads larger than this threshold are stored to disk, smaller ones are returned inline. | ||
| // Default: 1024 bytes (1KB) | ||
| const DefaultPayloadSizeThreshold = 1024 | ||
| // Default: 10240 bytes (10KB) | ||
| const DefaultPayloadSizeThreshold = 10240 |
There was a problem hiding this comment.
The default threshold is now documented as 10KB here, but there are other repo docs/examples still stating the default is 1024 bytes (e.g., PAYLOAD_THRESHOLD_IMPLEMENTATION.md and config.example-payload-threshold.toml). Please update those references in the same PR to keep documentation consistent with the new default.
Raises the inline payload threshold to accommodate larger tool responses before falling back to disk storage.
Changes
Constants: Updated
DefaultPayloadSizeThresholdfrom1024to10240in:internal/config/config_payload.gointernal/cmd/flags_logging.goDocumentation: Updated comments to reflect 10KB default in
config_core.goandconfig_payload.goTests: Updated test expectations in
flags_logging_test.goBehavior
Payloads ≤ 10KB now returned inline; larger payloads stored to disk at
{payloadDir}/{sessionID}/{queryID}/payload.json.Threshold remains configurable via
--payload-size-thresholdflag,MCP_GATEWAY_PAYLOAD_SIZE_THRESHOLDenv var, orpayload_size_thresholdconfig field.Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
example.com/tmp/go-build2815537700/b275/launcher.test /tmp/go-build2815537700/b275/launcher.test -test.testlogfile=/tmp/go-build2815537700/b275/testlog.txt -test.paniconexit0 -test.timeout=10m0s -test.v=true /opt/hostedtoolcache/go/1.25.6/x64/src/runtime/cgo1.25.6 cfg 64/pkg/tool/linux_amd64/vet -pthread -Wl,--no-gc-sect-unsafeptr=false -fmessage-length/tmp/go-build1973070374/b003/vet.cfg 64/pkg/tool/linux_amd64/vet 6552�� /opt/hostedtoolcache/go/1.25.6/x64/src/runtime/c-errorsas cfg nfig/composer/vendor/bin/as --gdwarf-5 --64 -o as(dns block)invalid-host-that-does-not-exist-12345.com/tmp/go-build67267443/b001/config.test /tmp/go-build67267443/b001/config.test -test.testlogfile=/tmp/go-build67267443/b001/testlog.txt -test.paniconexit0 -test.timeout=10m0s -test.v=true go --global 64/bin/as user.email(dns block)nonexistent.local/tmp/go-build2815537700/b275/launcher.test /tmp/go-build2815537700/b275/launcher.test -test.testlogfile=/tmp/go-build2815537700/b275/testlog.txt -test.paniconexit0 -test.timeout=10m0s -test.v=true /opt/hostedtoolcache/go/1.25.6/x64/src/runtime/cgo1.25.6 cfg 64/pkg/tool/linux_amd64/vet -pthread -Wl,--no-gc-sect-unsafeptr=false -fmessage-length/tmp/go-build1973070374/b003/vet.cfg 64/pkg/tool/linux_amd64/vet 6552�� /opt/hostedtoolcache/go/1.25.6/x64/src/runtime/c-errorsas cfg nfig/composer/vendor/bin/as --gdwarf-5 --64 -o as(dns block)slow.example.com/tmp/go-build2815537700/b275/launcher.test /tmp/go-build2815537700/b275/launcher.test -test.testlogfile=/tmp/go-build2815537700/b275/testlog.txt -test.paniconexit0 -test.timeout=10m0s -test.v=true /opt/hostedtoolcache/go/1.25.6/x64/src/runtime/cgo1.25.6 cfg 64/pkg/tool/linux_amd64/vet -pthread -Wl,--no-gc-sect-unsafeptr=false -fmessage-length/tmp/go-build1973070374/b003/vet.cfg 64/pkg/tool/linux_amd64/vet 6552�� /opt/hostedtoolcache/go/1.25.6/x64/src/runtime/c-errorsas cfg nfig/composer/vendor/bin/as --gdwarf-5 --64 -o as(dns block)this-host-does-not-exist-12345.com/tmp/go-build2815537700/b284/mcp.test /tmp/go-build2815537700/b284/mcp.test -test.testlogfile=/tmp/go-build2815537700/b284/testlog.txt -test.paniconexit0 -test.timeout=10m0s -test.v=true /opt/hostedtoolcache/go/1.25.6/x64/src/runtime/c-c=4 cfg 64/pkg/tool/linux_amd64/vet --gdwarf-5 --64 -o 64/pkg/tool/linux_amd64/vet 6552�� ache/go/1.25.6/x64/src/net cfg .test --gdwarf-5 --64 -o .test(dns block)If you need me to access, download, or install something from one of these locations, you can either:
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.