Skip to content

fix: disable keep-alives on mock aibridged to prevent stale-conn EOF - #28016

Merged
johnstcn merged 1 commit into
mainfrom
cian/aigov-430-stale-conn-eof
Aug 11, 2026
Merged

fix: disable keep-alives on mock aibridged to prevent stale-conn EOF#28016
johnstcn merged 1 commit into
mainfrom
cian/aigov-430-stale-conn-eof

Conversation

@johnstcn

Copy link
Copy Markdown
Member

Fixes the Windows-only TestProxy_HotReloadRouting EOF 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 bare EOF on the Windows runner. goproxy turns that upstream round-trip error into a closed MITM connection, so the test client sees Post "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 -race of the reload family passes repeatedly (-count=10, earlier -count=20 and full package -race).
  • Cannot reproduce the Windows closed-socket semantics on a Linux runner, so this removes the failure class rather than proving it; Windows CI is the confirmation.

Closes https://linear.app/codercom/issue/AIGOV-430


Generated by a Coder agent.

@linear-code

linear-code Bot commented Aug 11, 2026

Copy link
Copy Markdown

AIGOV-430

@johnstcn johnstcn self-assigned this Aug 11, 2026
@johnstcn johnstcn changed the title fix(aibridgeproxyd): disable keep-alives on mock aibridged to prevent stale-conn EOF fix: disable keep-alives on mock aibridged to prevent stale-conn EOF Aug 11, 2026
@johnstcn
johnstcn marked this pull request as ready for review August 11, 2026 14:25
Copilot AI lite review requested due to automatic review settings August 11, 2026 14:25

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.Server to 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.

@johnstcn
johnstcn merged commit 5febde0 into main Aug 11, 2026
79 of 83 checks passed
@johnstcn
johnstcn deleted the cian/aigov-430-stale-conn-eof branch August 11, 2026 14:48
@github-actions github-actions Bot locked and limited conversation to collaborators Aug 11, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants