← Back to Pull requests

fix(a2av0): honor configured transport endpoints #602

Merged
Harshil-1603 merged 3 files (95 lines) on Dec 01, 2026 09:56 UTC
View on GitHub
Harshil-1603 Harshil-1603 commented on Nov 16, 2026 16:16 UTC
Author

The v0.3 REST and JSON-RPC transport factories unconditionally replace cfg.URL with the selected agent-card interface URL. A caller configuring a reachable gateway endpoint therefore still sends requests to the advertised internal endpoint; the REST configuration already documents the configured URL as an override.

Use the card URL only when the configured URL is empty, and document the same fallback for JSON-RPC. End-to-end tests cover both protocols with an explicit override and with card-based discovery, including reusing a factory for different cards and checking which HTTP server receives each request.

Validation:

  • Both override cases fail against the original implementation; both card-URL controls pass.

  • Full go test -race -mod=readonly -count=1 -shuffle=on ./... passed.

  • go mod tidy -diff, go vet -mod=readonly ./..., and golangci-lint v2.11.4 passed (0 issues).

  • Root and separate cluster-mode example builds passed with -buildvcs=false. The ordinary root build hit the local environment's VCS-status error (exit 128).

  • git diff --check passed.
  • Diff: 95 lines (+93 / -2) across 3 files Reviewer: yarolegovich Review duration: 21219m
    All Vouch review confidence checks passed
    Residual risk 0.17 = Change Risk (0.56) × (1 − Review Confidence (0.70)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.56 · 95 lines diff across 3 files
    0.56
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.53 · 3 substantive comment(s)
    0.53
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    69%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.273
    Sensitive Paths sensitive_paths
    0.056
    Real PR Conversation Timeline
    5 items
    yarolegovich yarolegovich commented on code on Nov 17, 2026 10:53 UTC
    Code Review
    a2acompat/a2av0/version_compat_test.go:1
    @@ -75,6 +77,90 @@ func TestClientServer_CardVersionWithPatch(t *testing.T) {
     	}
     }
     
    +func TestClientServer_TransportURL(t *testing.T) {
    +	t.Parallel()
    +
    +	protocols := []struct {
    +		name       string
    +		protocol   a2a.TransportProtocol
    +		newHandler func(a2asrv.RequestHandler) http.Handler
    +		option     func(string) a2aclient.FactoryOption
    +	}{
    +		{
    +			name:     "jsonrpc",
    +			protocol: a2a.TransportProtocolJSONRPC,
    +			newHandler: func(h a2asrv.RequestHandler) http.Handler {
    +				mux := http.NewServeMux()
    +				mux.Handle("POST /{$}", NewJSONRPCHandler(h))
    +				return mux
    +			},
    +			option: func(url string) a2aclient.FactoryOption {
    +				return WithJSONRPCTransport(JSONRPCTransportConfig{URL: url})
    +			},
    +		},
    +		{
    +			name:       "rest",
    +			protocol:   a2a.TransportProtocolHTTPJSON,
    +			newHandler: func(h a2asrv.RequestHandler) http.Handler { return NewRESTHandler(h) },
    +			option: func(url string) a2aclient.FactoryOption {
    +				return WithRESTTransport(RESTTransportConfig{URL: url})
    +			},
    +		},
    +	}
    +	for _, protocol := range protocols {
    +		for _, override := range []bool{false, true} {
    +			name := "card URL"
    +			if override {
    +				name = "configured URL"
    +			}
    +			t.Run(protocol.name+"/"+name, func(t *testing.T) {

    nit: let's make it a flat table-driven test with configuredURL, cardURLs and wantRequests fields instead of branching on override in 4 places

    yarolegovich yarolegovich commented on code on Nov 17, 2026 10:53 UTC
    Code Review
    a2acompat/a2av0/version_compat_test.go:1
    @@ -75,6 +77,90 @@ func TestClientServer_CardVersionWithPatch(t *testing.T) {
     	}
     }
     
    +func TestClientServer_TransportURL(t *testing.T) {
    +	t.Parallel()
    +
    +	protocols := []struct {
    +		name       string
    +		protocol   a2a.TransportProtocol
    +		newHandler func(a2asrv.RequestHandler) http.Handler
    +		option     func(string) a2aclient.FactoryOption
    +	}{
    +		{
    +			name:     "jsonrpc",
    +			protocol: a2a.TransportProtocolJSONRPC,
    +			newHandler: func(h a2asrv.RequestHandler) http.Handler {
    +				mux := http.NewServeMux()
    +				mux.Handle("POST /{$}", NewJSONRPCHandler(h))

    nit: is the mux needed? the request count check already catches the card URL being used

    yarolegovich yarolegovich commented on code on Nov 17, 2026 10:53 UTC
    Code Review
    a2acompat/a2av0/version_compat_test.go:1
    @@ -75,6 +77,90 @@ func TestClientServer_CardVersionWithPatch(t *testing.T) {
     	}
     }
     
    +func TestClientServer_TransportURL(t *testing.T) {
    +	t.Parallel()
    +
    +	protocols := []struct {
    +		name       string
    +		protocol   a2a.TransportProtocol
    +		newHandler func(a2asrv.RequestHandler) http.Handler
    +		option     func(string) a2aclient.FactoryOption
    +	}{
    +		{
    +			name:     "jsonrpc",
    +			protocol: a2a.TransportProtocolJSONRPC,
    +			newHandler: func(h a2asrv.RequestHandler) http.Handler {
    +				mux := http.NewServeMux()
    +				mux.Handle("POST /{$}", NewJSONRPCHandler(h))
    +				return mux
    +			},
    +			option: func(url string) a2aclient.FactoryOption {
    +				return WithJSONRPCTransport(JSONRPCTransportConfig{URL: url})
    +			},
    +		},
    +		{
    +			name:       "rest",
    +			protocol:   a2a.TransportProtocolHTTPJSON,
    +			newHandler: func(h a2asrv.RequestHandler) http.Handler { return NewRESTHandler(h) },
    +			option: func(url string) a2aclient.FactoryOption {
    +				return WithRESTTransport(RESTTransportConfig{URL: url})
    +			},
    +		},
    +	}
    +	for _, protocol := range protocols {
    +		for _, override := range []bool{false, true} {
    +			name := "card URL"
    +			if override {
    +				name = "configured URL"
    +			}
    +			t.Run(protocol.name+"/"+name, func(t *testing.T) {
    +				t.Parallel()
    +				var requests, otherRequests atomic.Int32
    +				newServer := func(count *atomic.Int32) *httptest.Server {
    +					handler := protocol.newHandler(a2asrv.NewHandler(&replyingExecutor{}))
    +					return httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
    +						count.Add(1)
    +						handler.ServeHTTP(w, r)
    +					}))
    +				}
    +				server := newServer(&requests)
    +				t.Cleanup(server.Close)
    +				other := newServer(&otherRequests)
    +				t.Cleanup(other.Close)
    +
    +				configuredURL := ""
    +				if override {
    +					configuredURL = server.URL
    +				}
    +				option := protocol.option(configuredURL)

    let's pass Client: server.Client() to the transport config. the default client uses http.DefaultTransport and every httptest.Server.Close resets its idle connections, so parallel subtests can flake

    yarolegovich yarolegovich approved these changes on Nov 17, 2026 10:53 UTC
    Approved Reviewer

    Approved these changes.

    Reviewers
    Assignees
    Harshil-1603 Harshil-1603
    Labels
    risk: low confidence: 69.6% reviewed sensitive_module
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 56.4% (MEDIUM) · Higher = larger blast radius
    56.4%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 69.6% · Lower = rushed or shallow review
    69.6%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 17.2% · Safe to merge
    17.2%