Files
magpie/internal
yetone a3b48e0f74 gateway tests: TestTranslatedStreamKeepsClientAlive gives a loaded scheduler room (#2169, #2711, #2737)
The test's client hung up after 150ms of hearing nothing counted, while
the gateway's keepalive gap is 10ms. Under load (300-600 on the dev box,
CI's macOS race shard at bf931f82c) the scheduler alone held a 150ms
gap, so each of the three subtests went red in turn and was filed apart:
chat_to_anthropic (#2169), responses_to_chat (#2711), chat_to_responses
(#2737). The red logs show the gateway did send keepalives (5-6 of the
provider's 7-10) and the gap was a stall, not a missing one.

The client now waits 500ms and the provider stays quiet for 1.5s
(quietFor, idleFor). Without magpie's keepalives the client still hears
nothing for three of its timeouts, so the test still proves what it is
about.

Run in a worktree at e44b9aef3, sandbox HOME and TMPDIR:
- go test -tags nogui -race -count=10 -cpu 1,2 -run
  TestTranslatedStreamKeepsClientAlive ./internal/gateway, load ~560-620:
  before, 2 of 60 subtests red (responses_to_chat, 0.36s); after, 60 of
  60 green.
- Broken by hand: continuation.go's alive() not calling enc.keepalive():
  all three subtests red ("downstream_keepalives=0 idle_timeout=true");
  restored, green.
- go test -tags nogui -count=1 -timeout 45m ./internal/gateway: ok
  (1557s). gofmt -l clean; go vet -tags nogui ./internal/gateway on
  darwin, GOOS=linux and GOOS=windows clean.
- Not run: the full ./... suite. Only internal/gateway compiles this
  file, and nothing outside it changed.
2026-10-18 02:13:40 +08:00
..
…
…