Repository navigation
test(runtime): isolate client fixtures on private HTTP transports - #4526
Merged
Merged
Conversation
Parallel httptest.Server cleanup closes the global default pool, which can interrupt delivery of a bodyless POST response. Give all 16 runtime client fixtures private cloned transports and test cleanup, preserving caller options and incomplete-stream assertions. Fixes #4516 Signed-off-by: Arnaud Héritier <aheritier@users.noreply.github.com>
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The test-only changes consistently isolate transports while preserving existing timeout and streaming behavior.
Review effort: Balanced
Findings: None
What changed in this PR
Isolates runtime HTTP test fixtures from the global connection pool, preventing parallel httptest.Server cleanup from breaking in-flight requests.
Changes:
- Adds private cloned transports and cleanup helpers.
- Migrates all 16 runtime client fixtures.
- Adds regression coverage for transport isolation, timeouts, and streaming reuse.
| File | Description |
|---|---|
pkg/runtime/client_test.go |
Adds helpers, regression coverage, and migrates client fixtures. |
pkg/runtime/remote_runtime_test.go |
Uses isolated clients in background-runtime tests. |
pkg/runtime/recovery_event_test.go |
Isolates the recovery-event client fixture. |
pkg/runtime/plan_events_test.go |
Isolates the plan-event client fixture. |
pkg/runtime/evaluator_usage_test.go |
Isolates the evaluator SSE client fixture. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
trungutt
approved these changes
Oct 6, 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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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 #4516
Summary
Give all 16 runtime HTTP-client test fixtures private cloned transports with test cleanup. Add a network-free regression checking distinct/private transports, the default timeout, caller
WithTimeoutprecedence, and streaming-client transport reuse. Five test files only; no production changes, retries, sleeps, or weakened assertions. The incomplete-stream cases still require a finalErrorEventand exactly one POST.The CI error occurs during the POST, before stream validation:
net/http: HTTP/1.x transport connection broken: http: CloseIdleConnections called. Closing anyhttptest.Servercloses the global default pool. Go pools a bodyless response before delivering it, so parallel cleanup can close the connection in that window; the written POST is not replayable. Isolating only the observed subtest would leave equivalent fixtures exposed. This follows the MCP fixture precedent from #3704.Validation on this branch
Go 1.27.0 linux/amd64; Task 3.53.1; golangci-lint 2.13.2; CGO enabled after installing the missing compiler.
go build ./.../go vet ./pkg/runtimetask format/git diff --checktask build(also forced after compiler install)task testtask lint(also forced after compiler install)go test ./pkg/runtime -run '^TestNewTestClientUsesPrivateTransport$' -count=50go test -race -shuffle=on -count=100 ./pkg/runtime -run 'TestNewTestClient|TestClient|TestEvaluatorUsagePersistenceAndSSE|TestSessionRecoveredEventContract|TestRemoteRuntime_Background'go test -race -shuffle=on -count=500 ./pkg/runtime -run '^TestClient_RunAgentIncompleteStreamIsAnError$'go test -race -shuffle=1791190804724097755 -count=3 ./pkg/runtimego test -race -shuffle=on -count=3 ./pkg/runtimeEvidence and limits
ErrorEventand one POST. These diagnostic harnesses are not committed tests and are not natural reproduction of the original target.task testran with CGO disabled because the compiler was absent: treesitter reported that CGO is required. The same run also hit untouchedTestFileCache_dedupSkipsRedundantWrite(mtime assertion) and evaluationmissing_local_image(missinginspect-args). After installing build-essential, the full rerun passed. No unpatched control was run for those two transient failures, so their cause is not established here.attempts >= 2assertion inTestRemoteRuntime_BackgroundSubscriptionWaitsForEventLogAndDeliversElicitationOnce; same-seed 10 repeats then passed. No unpatched control was obtained. This branch's fresh runs did not hit it; it is not fixed or confidently attributed in this PR.