Commit 28f4c74
authored
Honor gateway tool execution budgets for HTTP backends by removing hardcoded 120s transport cap (#3911)
HTTP MCP backend `tools/call` requests were effectively capped at ~120s
due to a hardcoded `http.Client.Timeout`, even when gateway/tool budgets
were configured higher. This made `toolTimeout` non-authoritative for
long-running HTTP backend calls and surfaced misleading transport
timeout failures.
- **Timeout model correction (HTTP backend transport)**
- Removed the hardcoded `http.Client.Timeout` from `NewHTTPConnection`.
- Kept `connect_timeout` behavior for connection/setup phases
(`DialContext`, `ResponseHeaderTimeout`).
- End-to-end request duration is now governed by request context
deadlines (including gateway `toolTimeout` budgets), not a fixed
transport ceiling.
- **Behavioral test update**
- Updated HTTP connection timeout test to assert that client-level
overall timeout is unset (`0`) instead of `120s`, matching
context-driven execution timeout semantics.
- **Docs clarification**
- Clarified that `connect_timeout` is per-attempt transport
setup/fallback timeout.
- Clarified that `toolTimeout` governs tool execution budget for backend
requests, including HTTP backends.
```go
httpClient := &http.Client{
Transport: &http.Transport{
DialContext: (&net.Dialer{
Timeout: connectTimeout,
}).DialContext,
ResponseHeaderTimeout: connectTimeout,
},
}
```
> [!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-build915870139/b514/launcher.test
/tmp/go-build915870139/b514/launcher.test
-test.testlogfile=/tmp/go-build915870139/b514/testlog.txt
-test.paniconexit0 -test.timeout=10m0s .cfg�� ache/go/1.25.8/x-errorsas
64/src/text/temp-ifaceassert x_amd64/vet -p vendor/golang.or-o
-lang=go1.25 x_amd64/vet om/s�� .cfg -I x_amd64/vet --gdwarf-5
7082204/b245/ -o x_amd64/vet` (dns block)
> - Triggering command: `/tmp/go-build1119629889/b514/launcher.test
/tmp/go-build1119629889/b514/launcher.test
-test.testlogfile=/tmp/go-build1119629889/b514/testlog.txt
-test.paniconexit0 -test.timeout=10m0s EN3
io.containerd.ru/run/containerd/io.containerd.runtime.v2.task/moby/f51a7715e232ec8a9315d8b288126git
x_amd64/vet /usr/bin/bash by/ae163377ad462bash` (dns block)
> - `invalid-host-that-does-not-exist-12345.com`
> - Triggering command: `/tmp/go-build915870139/b496/config.test
/tmp/go-build915870139/b496/config.test
-test.testlogfile=/tmp/go-build915870139/b496/testlog.txt
-test.paniconexit0 -test.timeout=10m0s
/tmp/go-build915870139/b396/vet.cfg @v1.1.3/cpu/cpu.go
om/tetratelabs/wazero@v1.11.0/internal/platform/google.golang.org/grpc/internal/serviceconfig
x_amd64/vet -pthread ternal/engine/wa-atomic =0 x_amd64/vet Db3z��
7082204/b252/_pk-errorsas 7082204/b151/ x_amd64/vet abis
telabs/wazero/in-atomic p=/opt/hostedtoo-bool x_amd64/vet` (dns block)
> - `nonexistent.local`
> - Triggering command: `/tmp/go-build915870139/b514/launcher.test
/tmp/go-build915870139/b514/launcher.test
-test.testlogfile=/tmp/go-build915870139/b514/testlog.txt
-test.paniconexit0 -test.timeout=10m0s .cfg�� ache/go/1.25.8/x-errorsas
64/src/text/temp-ifaceassert x_amd64/vet -p vendor/golang.or-o
-lang=go1.25 x_amd64/vet om/s�� .cfg -I x_amd64/vet --gdwarf-5
7082204/b245/ -o x_amd64/vet` (dns block)
> - Triggering command: `/tmp/go-build1119629889/b514/launcher.test
/tmp/go-build1119629889/b514/launcher.test
-test.testlogfile=/tmp/go-build1119629889/b514/testlog.txt
-test.paniconexit0 -test.timeout=10m0s EN3
io.containerd.ru/run/containerd/io.containerd.runtime.v2.task/moby/f51a7715e232ec8a9315d8b288126git
x_amd64/vet /usr/bin/bash by/ae163377ad462bash` (dns block)
> - `slow.example.com`
> - Triggering command: `/tmp/go-build915870139/b514/launcher.test
/tmp/go-build915870139/b514/launcher.test
-test.testlogfile=/tmp/go-build915870139/b514/testlog.txt
-test.paniconexit0 -test.timeout=10m0s .cfg�� ache/go/1.25.8/x-errorsas
64/src/text/temp-ifaceassert x_amd64/vet -p vendor/golang.or-o
-lang=go1.25 x_amd64/vet om/s�� .cfg -I x_amd64/vet --gdwarf-5
7082204/b245/ -o x_amd64/vet` (dns block)
> - Triggering command: `/tmp/go-build1119629889/b514/launcher.test
/tmp/go-build1119629889/b514/launcher.test
-test.testlogfile=/tmp/go-build1119629889/b514/testlog.txt
-test.paniconexit0 -test.timeout=10m0s EN3
io.containerd.ru/run/containerd/io.containerd.runtime.v2.task/moby/f51a7715e232ec8a9315d8b288126git
x_amd64/vet /usr/bin/bash by/ae163377ad462bash` (dns block)
> - `this-host-does-not-exist-12345.com`
> - Triggering command: `/tmp/go-build915870139/b523/mcp.test
/tmp/go-build915870139/b523/mcp.test
-test.testlogfile=/tmp/go-build915870139/b523/testlog.txt
-test.paniconexit0 -test.timeout=10m0s 64/s�� .cfg -I x_amd64/vet
--gdwarf-5 .io/otel -o x_amd64/vet .cfg�� /oidc/errors.go
/oidc/provider.go x_amd64/vet . g/grpc/internal/-qE --64 x_amd64/vet`
(dns block)
> - Triggering command: `/tmp/go-build1119629889/b523/mcp.test
/tmp/go-build1119629889/b523/mcp.test
-test.testlogfile=/tmp/go-build1119629889/b523/testlog.txt
-test.paniconexit0 -test.timeout=10m0s --ve�� =0 y /usr/bin/docker
ntime.v2.task/mogit` (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>6 files changed
Lines changed: 96 additions & 17 deletions
File tree
- docs
- internal
- mcp
- server
- test/integration
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
172 | 172 | | |
173 | 173 | | |
174 | 174 | | |
175 | | - | |
| 175 | + | |
176 | 176 | | |
177 | 177 | | |
178 | 178 | | |
| |||
372 | 372 | | |
373 | 373 | | |
374 | 374 | | |
375 | | - | |
| 375 | + | |
376 | 376 | | |
377 | 377 | | |
378 | 378 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
204 | 204 | | |
205 | 205 | | |
206 | 206 | | |
207 | | - | |
208 | | - | |
209 | | - | |
210 | | - | |
211 | | - | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
212 | 211 | | |
213 | | - | |
214 | 212 | | |
215 | 213 | | |
216 | 214 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
483 | 483 | | |
484 | 484 | | |
485 | 485 | | |
486 | | - | |
487 | | - | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
488 | 489 | | |
489 | 490 | | |
490 | | - | |
| 491 | + | |
491 | 492 | | |
492 | | - | |
493 | 493 | | |
494 | 494 | | |
495 | 495 | | |
| |||
516 | 516 | | |
517 | 517 | | |
518 | 518 | | |
519 | | - | |
520 | | - | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
521 | 522 | | |
522 | 523 | | |
523 | 524 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
| |||
484 | 485 | | |
485 | 486 | | |
486 | 487 | | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
466 | 466 | | |
467 | 467 | | |
468 | 468 | | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
469 | 479 | | |
470 | 480 | | |
471 | 481 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
79 | 79 | | |
80 | 80 | | |
81 | 81 | | |
82 | | - | |
| 82 | + | |
83 | 83 | | |
84 | 84 | | |
85 | | - | |
| 85 | + | |
86 | 86 | | |
87 | 87 | | |
88 | 88 | | |
| |||
95 | 95 | | |
96 | 96 | | |
97 | 97 | | |
98 | | - | |
| 98 | + | |
99 | 99 | | |
100 | 100 | | |
101 | 101 | | |
| |||
0 commit comments