feat: raise default MCP_GATEWAY_SESSION_TIMEOUT from 2h to 6h#3201
Merged
feat: raise default MCP_GATEWAY_SESSION_TIMEOUT from 2h to 6h#3201
Conversation
Agent-Logs-Url: https://github.com/github/gh-aw-mcpg/sessions/96d52d29-42d3-4e67-8fee-e216a40bfe62 Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Update session timeout to 6 hours
feat: raise default MCP_GATEWAY_SESSION_TIMEOUT from 2h to 6h
Apr 5, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Updates the default unified-mode MCP session timeout to better align with typical CI runtimes (notably GitHub Actions), reducing the chance of sessions expiring mid-workflow.
Changes:
- Increased the default
MCP_GATEWAY_SESSION_TIMEOUT(unified/mcp) from 2h to 6h. - Updated envutil “real-world scenario” test to reflect the new default.
- Updated docs to reflect the new default and rationale.
Show a summary per file
| File | Description |
|---|---|
| internal/server/transport.go | Raises unified-mode StreamableHTTP SessionTimeout default to 6h via GetEnvDuration. |
| internal/envutil/envutil_test.go | Updates real-world duration default expectations from 2h to 6h. |
| docs/ENVIRONMENT_VARIABLES.md | Updates documented default for MCP_GATEWAY_SESSION_TIMEOUT to 6h. |
| AGENTS.md | Updates the environment variable list to show the 6h default. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 4/4 changed files
- Comments generated: 1
| result = GetEnvDuration("MCP_GATEWAY_SESSION_TIMEOUT", 6*time.Hour) | ||
| assert.Equal(t, 30*time.Minute, result) | ||
|
|
||
| // Override with longer timeout |
There was a problem hiding this comment.
The comment // Override with longer timeout is no longer accurate now that the default in this test is 6h but the override value is 4h (shorter). Consider either updating the override to a value > 6h (e.g., 8h) or adjusting the comment to reflect that it's just a custom override.
Suggested change
| // Override with longer timeout | |
| // Override with custom timeout |
This was referenced Apr 5, 2026
This was referenced Apr 5, 2026
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.
The default unified-mode session timeout was 2h; 6h matches the GitHub Actions default job timeout, preventing premature session expiry in standard CI workflows.
Changes
internal/server/transport.go— default argument toGetEnvDuration("MCP_GATEWAY_SESSION_TIMEOUT", …)changed from2*time.Hour→6*time.Hourinternal/envutil/envutil_test.go— updated real-world scenario test to reflect the new defaultdocs/ENVIRONMENT_VARIABLES.md/AGENTS.md— updated default values and rationale in documentationWarning
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-build1794183046/b514/launcher.test /tmp/go-build1794183046/b514/launcher.test -test.testlogfile=/tmp/go-build1794183046/b514/testlog.txt -test.paniconexit0 -test.timeout=10m0s /tmp/go-build1794183046/b434/vet.cfg /mcp/connection.go /mcp/errors.go x_amd64/vet /tmp/go-build188/opt/hostedtoolcache/go/1.25.8/x64/pkg/tool/linux_amd64/vet -imultiarch x86_64-linux-gnu-bool x_amd64/vet -W g_.a /tmp/go-build188-ifaceassert x_amd64/vet . ernal/middleware-atomic --64 x_amd64/vet(dns block)invalid-host-that-does-not-exist-12345.com/tmp/go-build1794183046/b496/config.test /tmp/go-build1794183046/b496/config.test -test.testlogfile=/tmp/go-build1794183046/b496/testlog.txt -test.paniconexit0 -test.timeout=10m0s /tmp/go-build1794183046/b394/vet.cfg 5.0/internal/doc-c=4 5.0/internal/oau-nolocalimports x_amd64/vet /tmp/go-build188/opt/hostedtoolcache/go/1.25.8/x64/pkg/tool/linux_amd64/vet nal/strs x86_64-linux-gnu-bool x_amd64/vet abis�� g_.a -I x_amd64/vet(dns block)nonexistent.local/tmp/go-build1794183046/b514/launcher.test /tmp/go-build1794183046/b514/launcher.test -test.testlogfile=/tmp/go-build1794183046/b514/testlog.txt -test.paniconexit0 -test.timeout=10m0s /tmp/go-build1794183046/b434/vet.cfg /mcp/connection.go /mcp/errors.go x_amd64/vet /tmp/go-build188/opt/hostedtoolcache/go/1.25.8/x64/pkg/tool/linux_amd64/vet -imultiarch x86_64-linux-gnu-bool x_amd64/vet -W g_.a /tmp/go-build188-ifaceassert x_amd64/vet . ernal/middleware-atomic --64 x_amd64/vet(dns block)slow.example.com/tmp/go-build1794183046/b514/launcher.test /tmp/go-build1794183046/b514/launcher.test -test.testlogfile=/tmp/go-build1794183046/b514/testlog.txt -test.paniconexit0 -test.timeout=10m0s /tmp/go-build1794183046/b434/vet.cfg /mcp/connection.go /mcp/errors.go x_amd64/vet /tmp/go-build188/opt/hostedtoolcache/go/1.25.8/x64/pkg/tool/linux_amd64/vet -imultiarch x86_64-linux-gnu-bool x_amd64/vet -W g_.a /tmp/go-build188-ifaceassert x_amd64/vet . ernal/middleware-atomic --64 x_amd64/vet(dns block)this-host-does-not-exist-12345.com/tmp/go-build1794183046/b523/mcp.test /tmp/go-build1794183046/b523/mcp.test -test.testlogfile=/tmp/go-build1794183046/b523/testlog.txt -test.paniconexit0 -test.timeout=10m0s 9187�� .cfg pmgFoLvmr x_amd64/vet . --gdwarf2 --64 x_amd64/vet .cfg�� 9187355/b400/_pkg_.a 64/src/net/http/httptest/httptest.go x_amd64/vet -p t/transform -lang=go1.25 x_amd64/vet(dns block)If you need me to access, download, or install something from one of these locations, you can either: