Repository navigation
Cover stdio proxy protocol-version fallback - #7124
Merged
ChrisJBurns merged 2 commits intoNov 25, 2026
Merged
Conversation
Regression coverage for stacklok#7119: a Semgrep-like server that 400s protocol version 2026-07-28 must still complete initialize through the stdio bridge, via the legacy initialize at 2025-11-25, both directly and through the transparent proxy. Signed-off-by: Bharath Vemula <[email protected]>
ChrisJBurns
approved these changes
Nov 25, 2026
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #7124 +/- ##
=======================================
Coverage 82.07% 82.08%
=======================================
Files 928 928
Lines 94127 94127
=======================================
+ Hits 77258 77260 +2
+ Misses 16864 16862 -2
Partials 5 5 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
1 task
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
#7119 reported that
thv proxy stdiocannot initialize against the Semgrep remote MCP server: the bridge offered protocol version 2026-07-28 upstream, Semgrep 400s it (Unsupported protocol version: 2026-07-28), and initialize failed with no fallback. That was reported against CLI v0.53.0.I reproduced the exact scenario on current main before changing anything, and the behavior is already fixed here: the go-sdk client (via toolhive-core v0.0.59) first probes with
server/discoverat 2026-07-28 and, when the server rejects it, falls back to a legacy initialize at 2025-11-25 — a version Semgrep supports — so the bridge completes initialize. The transparent proxy forwards both hops verbatim. This PR locks that negotiation in with regression tests, so it cannot silently regress:TestBridge_InitializeFallsBackToLegacyVersion— bridge against a Semgrep-like fake backend (400s anything newer than 2025-11-25, Semgrep's exact error body): discover 2026-07-28 -> 400, legacy initialize 2025-11-25 -> 200,notifications/initialized-> 202.TestBridge_InitializeFallsBackViaTransparentProxy— the same backend through the transparent proxy, the actualthv proxy stdio <remote-workload>path: the proxy must not upgrade the legacy initialize back to Modern or reject the discover probe.TestBridge_InitializeFailsWhenServerCapsBelowFallbackVersion— documents the fallback's boundary: the SDK retries only once, at 2025-11-25, so a server capping below that still fails initialize. This also proves the first two tests are sensitive (they fail when the fallback version itself is rejected).Fixes #7119
Type of change
Test plan
task testequivalent —taskis not installed on this machine, so the Taskfile equivalents were run directly)go test ./pkg/transport/ -run 'TestBridge_Initialize' -v -count=1— all 3 new tests passgo test ./pkg/transport/... -race -count=1— full package suite passesgolangci-lint run --allow-parallel-runners ./pkg/transport/— 0 issuesgofmt/go vetcleanDoes this introduce a user-facing change?
No — tests only; no behavior change.
Special notes for reviewers
Client.Connect), not with a change in this repo. The bridge's own requested version (mcp.LATEST_PROTOCOL_VERSION, 2025-11-25) is still ignored by toolhive-core'sInitialize— the SDK decides the version — but the end-to-end behavior now matches what thv proxy stdio: upstream initialize fails against Semgrep remote MCP (Unsupported protocol version 2026-07-28), no fallback #7119 asks for.likely a legacy SSE serverby toolhive-core'smapConnectErroreven when the body saysUnsupported protocol version. Walking further down the version list (or fixing that label) belongs in toolhive-core/go-sdk — the bridge has no knob to request an older version through the current client API.