Skip to content

feat: raise default MCP_GATEWAY_SESSION_TIMEOUT from 2h to 6h#3201

Merged
lpcox merged 2 commits intomainfrom
copilot/update-session-timeout-to-6h
Apr 5, 2026
Merged

feat: raise default MCP_GATEWAY_SESSION_TIMEOUT from 2h to 6h#3201
lpcox merged 2 commits intomainfrom
copilot/update-session-timeout-to-6h

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 5, 2026

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 to GetEnvDuration("MCP_GATEWAY_SESSION_TIMEOUT", …) changed from 2*time.Hour6*time.Hour
  • internal/envutil/envutil_test.go — updated real-world scenario test to reflect the new default
  • docs/ENVIRONMENT_VARIABLES.md / AGENTS.md — updated default values and rationale in documentation

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
    • Triggering command: /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
    • Triggering command: /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
    • Triggering command: /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
    • Triggering command: /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
    • Triggering command: /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:

Copilot AI linked an issue Apr 5, 2026 that may be closed by this pull request
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
Copilot AI requested a review from lpcox April 5, 2026 03:05
Copilot finished work on behalf of lpcox April 5, 2026 03:05
@lpcox lpcox marked this pull request as ready for review April 5, 2026 04:02
Copilot AI review requested due to automatic review settings April 5, 2026 04:02
@lpcox lpcox merged commit b25e549 into main Apr 5, 2026
30 checks passed
@lpcox lpcox deleted the copilot/update-session-timeout-to-6h branch April 5, 2026 04:03
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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
Copy link

Copilot AI Apr 5, 2026

Choose a reason for hiding this comment

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

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

Copilot uses AI. Check for mistakes.
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.

gateway timeout should be 6h

3 participants