fix(ci): resolve go test 10-minute timeout failures in internal/mcp#251
Merged
Conversation
Both steps relied on go test's silent 10-minute default, which internal/mcp was starting to exceed on ubuntu-latest, failing CI runs with no actionable error beyond a goroutine dump.
50 test-local helpers across the package each called parser.NewRegistry() followed by languages.RegisterAll(), recompiling all ~30 tree-sitter grammar queries from scratch every time. Under -race that cost is amplified enough that the package's local runtime drops from ~305s to ~45-75s once every helper shares one lazily-built registry instead. No test in the package mutates the registry after RegisterAll or runs in parallel, so sharing one instance is safe.
TestSuppressFinding_SuppressesAcrossReviews wires a real on-disk sidecar via InitSuppressions(t.TempDir(), dir) but never closed it, leaking a *sql.DB and its connectionOpener goroutine for the life of the test binary.
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.
Summary
testandbenchmarkjobs never passed-timeouttogo test, so they relied on Go's silent 10-minute-per-package default.internal/mcphad grown past it, failing PR fix(mcp): stop the stdio proxy gating tools/call in defer mode #247 and several recentmainruns withpanic: test timed out after 10m0s.parser.NewRegistry()+languages.RegisterAll()fresh, recompiling all ~30 tree-sitter grammar queries every time. Under-racethat cost is amplified enough to dominate the package's runtime. Replaced with one shared, lazily-built registry (internal/mcp/testregistry_test.go).TestSuppressFinding_SuppressesAcrossReviewsopened an on-disk SQLite sidecar and never closed it.Verified locally (same machine, before/after):
go test -race ./internal/mcp/...Test plan
go build ./...go vet ./...go test -race -timeout=20m -count=1 ./internal/mcp/...— passes in ~52s, coverage unchanged (71.8%)