Repository navigation
fix(connect): resolve duplicate mcpproxy entries deterministically - #1769
Merged
Dumbris merged 1 commit intoOct 26, 2026
Conversation
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Dumbris
approved these changes
Oct 26, 2026
Dumbris
left a comment
Member
There was a problem hiding this comment.
Verified: the PR test fails on main for the reason described and passes on this branch merged with main; race tests for the touched packages and CI lint (bare and server tags) are clean. Also built and tested together with the rest of this batch, independently reviewed, and cross-reviewed with a second model.
Member
|
Merged. Thank you, @rudycelekli! Duplicate mcpproxy entries in a client config now resolve deterministically. |
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.
Bug
findEntryJSONBytesandfindEntryTOMLBytes(internal/connect/connect.go) return the first entry inrange serversMapwhose URL points at this instance. Go randomizes map iteration, so when a client config holds two such entries the answer changes from call to call.That's a common shape: a legacy
?apikey=entry under a custom key left next to the currentmcpproxyentry.findEquivalentJSONServerNamewas already made deterministic for exactly this reason (Spec 091 FR-005). The status lookup was not.Trigger
A Cursor
mcp.jsonwith these entries:{"mcpServers": { "mcpproxy": {"url": "http://127.0.0.1:8080/mcp"}, "old-proxy": {"url": "http://127.0.0.1:8080/mcp?apikey=OLD"} }}With this config,
GetStatusreportsserver_nameasmcpproxyorold-proxydepending on the call.ClientSecret, which the credential reconciler uses, reads the credential from whichever entry won. So it sometimes seesOLDand sometimes the current key.Fix
Both finders now scan in a fixed order through a small
entryScanOrderhelper: the defaultmcpproxykey first, then the remaining names sorted. The name-only fallback and the PointsHere preference are unchanged.Verification
go test -count=1 -run TestFindEntry_TwoEntriesPointingHere ./internal/connect/passes. The test covers both the JSON (cursor) and TOML (codex) paths and runs 50 lookups each.connect.goreverted (git stash push internal/connect/connect.go), the same test fails:cursor lookup 0: got entry "old-proxy" (pointsHere=true), want "mcpproxy".go test -count=1 ./internal/connect/passes.go vet ./internal/connect/is clean.gofmt -l internal/connect/is clean.Commands were run with
GOFLAGS=-mod=readonly CGO_ENABLED=0.