Skip to content

Normalize proxyMode to always reflect effective HTTP protocol#4468

Open
ChrisJBurns wants to merge 2 commits intomainfrom
normalize-proxy-mode-3296
Open

Normalize proxyMode to always reflect effective HTTP protocol#4468
ChrisJBurns wants to merge 2 commits intomainfrom
normalize-proxy-mode-3296

Conversation

@ChrisJBurns
Copy link
Copy Markdown
Collaborator

Summary

  • proxyMode was only meaningful for stdio transports but could be set on any transport type, returning empty or misleading values to API consumers, vMCP, Optimizer, and the UI. Every client had to implement conditional logic via GetEffectiveProxyMode() to determine the actual protocol in use.
  • Normalize proxyMode at write boundaries (config builder and config load) so it always reflects the effective HTTP protocol. Also fixes the conflicting default in StdioTransport (defaulted to SSE while everything else defaulted to streamable-http).

Fixes #3296

Type of change

  • Bug fix

Test plan

  • Unit tests (task test)
  • Linting (task lint-fix)

Changes

File Change
pkg/transport/types/transport.go Add EffectiveProxyMode() — canonical typed function that computes the actual HTTP protocol
pkg/transport/stdio.go Fix conflicting default from SSE to streamable-http
pkg/runner/config.go Add NormalizeProxyMode() method; call in ReadJSON for migration of existing configs
pkg/runner/config_builder.go Call NormalizeProxyMode() at end of builder so all new configs are normalized
pkg/workloads/types/types.go GetEffectiveProxyMode() now delegates to the canonical typed function
pkg/export/k8s.go Remove unnecessary empty-check guard (proxyMode is always populated for stdio now)
pkg/transport/types/transport_test.go 10 test cases for EffectiveProxyMode
pkg/runner/config_test.go 7 test cases for NormalizeProxyMode

Does this introduce a user-facing change?

proxyMode in API responses and thv status output will now always be populated with the effective HTTP protocol, even for non-stdio transports. Previously it could be empty or misleading for sse/streamable-http transports.

Special notes for reviewers

  • The existing 6 callers of GetEffectiveProxyMode() are now idempotent (normalizing an already-normalized value is a no-op). A follow-up PR can clean these up, but they are harmless to keep.
  • The SSE default change in StdioTransport has no runtime impact — the factory always calls SetProxyMode() immediately after construction, overriding the default. The fix is for correctness and to prevent future bugs.
  • Pre-existing persisted configs are migrated on load via the ReadJSON normalization, requiring no explicit data migration.

Generated with Claude Code

proxyMode was only meaningful for stdio transports but could be set on
any transport, returning empty or misleading values to clients. This
caused confusion and required every client to implement conditional
logic via GetEffectiveProxyMode() to determine the actual protocol.

Add EffectiveProxyMode() to pkg/transport/types as the canonical typed
implementation, and NormalizeProxyMode() on RunConfig to apply it at
creation and load time. This ensures proxyMode is always the effective
value in persisted configs and API responses.

Also fixes the conflicting default in StdioTransport (SSE vs
streamable-http everywhere else).

Fixes #3296

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@github-actions github-actions bot added the size/S Small PR: 100-299 lines changed label Mar 31, 2026
@github-actions github-actions bot added size/S Small PR: 100-299 lines changed and removed size/S Small PR: 100-299 lines changed labels Mar 31, 2026
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 31, 2026

Codecov Report

❌ Patch coverage is 92.30769% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 69.65%. Comparing base (e69251a) to head (e665c96).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
pkg/transport/stdio.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4468   +/-   ##
=======================================
  Coverage   69.64%   69.65%           
=======================================
  Files         491      491           
  Lines       50304    50310    +6     
=======================================
+ Hits        35036    35043    +7     
  Misses      12580    12580           
+ Partials     2688     2687    -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/S Small PR: 100-299 lines changed

1 participant