fix: disable keep-alives on mock aibridged to prevent stale-conn EOF - #28016
Merged
Conversation
johnstcn
marked this pull request as ready for review
August 11, 2026 14:25
Contributor
There was a problem hiding this comment.
Pull request overview
This PR addresses a Windows-only TestProxy_HotReloadRouting EOF flake in enterprise/aibridgeproxyd by preventing stale pooled connection reuse between the proxy and the mock aibridged backend during tests.
Changes:
- Disable HTTP keep-alives on the mock aibridged
httptest.Serverto force a new proxy→aibridged connection per request. - Add an explanatory comment linking the behavior to the tracked internal issue (AIGOV-430 / internal#1564).
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
dannykopping
approved these changes
Aug 11, 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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Fixes the Windows-only
TestProxy_HotReloadRoutingEOF flake (AIGOV-430 / internal#1564).Root cause
The proxy forwards MITM'd requests to aibridged over a keep-alive-pooled
http.Transport. net/http will not retry a POST on a reused-but-closed pooled connection (a POST isn't replayable), so a stale reuse of a conn the mock aibridged has closed surfaces as a bareEOFon the Windows runner. goproxy turns that upstream round-trip error into a closed MITM connection, so the test client seesPost "https://alpha.invalid/v1/messages": EOF.This is a stale pooled-connection reuse failure, not a routing or hot-reload bug:
Reload()is a synchronous atomic router swap and never touches the upstream transport.Fix
bridged.Config.SetKeepAlivesEnabled(false)on the mock aibridged backend forces a fresh proxy→aibridged connection per request, eliminating the stale-reuse failure by construction. No production changes.Verification
go test -raceof the reload family passes repeatedly (-count=10, earlier-count=20and full package-race).Closes https://linear.app/codercom/issue/AIGOV-430
Generated by a Coder agent.