Skip to content

Commit f4aca19

Browse files
authored
Increase default payload size threshold from 1KB to 10KB (#807)
Raises the inline payload threshold to accommodate larger tool responses before falling back to disk storage. ## Changes - **Constants**: Updated `DefaultPayloadSizeThreshold` from `1024` to `10240` in: - `internal/config/config_payload.go` - `internal/cmd/flags_logging.go` - **Documentation**: Updated comments to reflect 10KB default in `config_core.go` and `config_payload.go` - **Tests**: Updated test expectations in `flags_logging_test.go` ## Behavior Payloads ≤ 10KB now returned inline; larger payloads stored to disk at `{payloadDir}/{sessionID}/{queryID}/payload.json`. Threshold remains configurable via `--payload-size-threshold` flag, `MCP_GATEWAY_PAYLOAD_SIZE_THRESHOLD` env var, or `payload_size_threshold` config field. > [!WARNING] > > <details> > <summary>Firewall rules blocked me from connecting to one or more addresses (expand for details)</summary> > > #### I tried to connect to the following addresses, but was blocked by firewall rules: > > - `example.com` > - Triggering command: `/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` > - Triggering command: `/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` > - Triggering command: `/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` > - Triggering command: `/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` > - Triggering command: `/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: > > - Configure [Actions setup steps](https://gh.io/copilot/actions-setup-steps) to set up my environment, which run before the firewall is enabled > - Add the appropriate URLs or hosts to the custom allowlist in this repository's [Copilot coding agent settings](https://github.com/github/gh-aw-mcpg/settings/copilot/coding_agent) (admins only) > > </details> <!-- START COPILOT CODING AGENT TIPS --> --- 💡 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](https://gh.io/copilot-coding-agent-tips) in the docs.
2 parents 97783f0 + 68fb651 commit f4aca19

4 files changed

Lines changed: 5 additions & 5 deletions

File tree

internal/cmd/flags_logging.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import (
1313
const (
1414
defaultLogDir = "/tmp/gh-aw/mcp-logs"
1515
defaultPayloadDir = "/tmp/jq-payloads"
16-
defaultPayloadSizeThreshold = 1024 // 1KB default threshold
16+
defaultPayloadSizeThreshold = 10240 // 10KB default threshold
1717
)
1818

1919
// Logging flag variables

internal/cmd/flags_logging_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ func TestPayloadSizeThresholdFlagDefault(t *testing.T) {
7171
os.Unsetenv("MCP_GATEWAY_PAYLOAD_SIZE_THRESHOLD")
7272

7373
result := getDefaultPayloadSizeThreshold()
74-
assert.Equal(t, 1024, result, "Default should be 1024 bytes")
74+
assert.Equal(t, 10240, result, "Default should be 10240 bytes")
7575
}
7676

7777
func TestPayloadSizeThresholdEnvVar(t *testing.T) {

internal/config/config_core.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ type GatewayConfig struct {
5757

5858
// PayloadSizeThreshold is the size threshold (in bytes) for storing payloads to disk.
5959
// Payloads larger than this threshold are stored to disk, smaller ones are returned inline.
60-
// Default: 1024 bytes (1KB)
60+
// Default: 10240 bytes (10KB)
6161
PayloadSizeThreshold int `toml:"payload_size_threshold" json:"payload_size_threshold,omitempty"`
6262
}
6363

internal/config/config_payload.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ const DefaultPayloadDir = "/tmp/jq-payloads"
77

88
// DefaultPayloadSizeThreshold is the default size threshold (in bytes) for storing payloads to disk.
99
// Payloads larger than this threshold are stored to disk, smaller ones are returned inline.
10-
// Default: 1024 bytes (1KB)
11-
const DefaultPayloadSizeThreshold = 1024
10+
// Default: 10240 bytes (10KB)
11+
const DefaultPayloadSizeThreshold = 10240
1212

1313
func init() {
1414
// Register default setter for PayloadDir and PayloadSizeThreshold

0 commit comments

Comments
 (0)