fix: resolve test deadlock and integration timeout#7330
Merged
Conversation
- TestGetOrLaunch_RaceConditionDoubleCheck: Replace localhost:9999 (no listener) with httptest server that responds quickly. The old test deadlocked because NewHTTPConnection tries 3 transports (30s timeout each) while holding the write lock, blocking all 100 goroutines. - TestFullDIFCConfigFromJSON: Replace stdio container (requires Docker) and hardcoded localhost:9999 with a local HTTP test server returning 500. This avoids Docker dependency and TCP connect timeouts that caused the 15s startup wait to expire. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates flaky/slow tests to avoid long connection timeouts and external Docker dependencies, improving make agent-finished reliability and runtime.
Changes:
- Replace a deadlock-prone “connect to localhost:9999” concurrency test setup with a local
httptestbackend. - Update the DIFC integration test to use a local HTTP server for fast backend failures instead of Docker/unused ports.
Show a summary per file
| File | Description |
|---|---|
test/integration/difc_config_test.go |
Starts a local failing HTTP server and points both backends at it to eliminate Docker/TCP timeout hangs. |
internal/launcher/getorlaunch_stdio_test.go |
Uses an httptest server URL for the race-condition/double-check locking stress test to avoid long connect stalls. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 2/2 changed files
- Comments generated: 1
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This was referenced Jun 10, 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.
Problem
Two tests were failing in
make agent-finished:TestGetOrLaunch_RaceConditionDoubleCheck(600s timeout/deadlock) — The test connected 100 goroutines tolocalhost:9999(no listener).NewHTTPConnectiontries 3 transports sequentially (streamable HTTP → SSE → plain JSON-RPC), each with a 30s connect timeout. Since this happens inside the write lock insyncutil.GetOrCreate, all other goroutines blocked indefinitely.TestFullDIFCConfigFromJSON(15s startup timeout) — The test configured a stdio server (test/server1:latestDocker container) and an HTTP server atlocalhost:9999. Without Docker running, the stdio backend hangs. The HTTP backend also times out on TCP connect to a non-existent listener.Fix
httptest.NewServerthat responds to JSON-RPC initialize requests immediately. Test now completes in <1s.