Skip to content

fix: set preferred transport on agent cards#1689

Merged
EItanya merged 4 commits intokagent-dev:mainfrom
gnanirahulnutakki:codengr/oss-kagent-1684
Apr 20, 2026
Merged

fix: set preferred transport on agent cards#1689
EItanya merged 4 commits intokagent-dev:mainfrom
gnanirahulnutakki:codengr/oss-kagent-1684

Conversation

@gnanirahulnutakki
Copy link
Copy Markdown
Contributor

Summary

Testing

  • /opt/homebrew/bin/go test ./core/internal/controller/translator/agent -run TestGetA2AAgentCard

Fixes #1684

Signed-off-by: Gnani Rahul <gnutakki@radiantlogic.com>
Copilot AI review requested due to automatic review settings April 17, 2026 20:16
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Sets PreferredTransport on controller-generated A2A agent cards to maintain a populated transport field and adds regression coverage to prevent future regressions (per #1684).

Changes:

  • Populate PreferredTransport with "JSONRPC" in GetA2AAgentCard.
  • Add a regression assertion in TestGetA2AAgentCard to verify PreferredTransport is set.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
go/core/internal/controller/translator/agent/utils.go Sets PreferredTransport during agent card construction.
go/core/internal/controller/translator/agent/utils_test.go Adds regression assertion verifying PreferredTransport remains populated.
Comments suppressed due to low confidence (1)

go/core/internal/controller/translator/agent/utils.go:1

  • PreferredTransport is being set via a newly introduced magic string ("JSONRPC"). To reduce drift/typos and make future updates easier, consider defining a package-level constant (or reusing an existing shared constant/enum if one exists in the codebase) and referencing that instead of repeating a raw string literal.
package agent

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +113 to +115
if assert.NotNil(t, card.PreferredTransport) {
assert.Equal(t, "JSONRPC", *card.PreferredTransport)
}
Copy link

Copilot AI Apr 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This pattern works, but it’s more idiomatic and provides clearer failure behavior to use require.NotNil(t, card.PreferredTransport) and then assert the value on the next line (no conditional needed). That keeps the test intent straightforward and avoids silently skipping the value assertion after a nil failure.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call. I tightened this in the follow-up push: the test now uses require.NotNil(t, card.PreferredTransport) and then asserts the JSON-RPC value on the next line.

Signed-off-by: Gnani Rahul <gnutakki@radiantlogic.com>
@gnanirahulnutakki
Copy link
Copy Markdown
Contributor Author

I pushed a follow-up commit after checking the failing CI job more closely. The go-unit-tests failure was real: adding preferredTransport changed the generated ADK translator output, so the golden fixtures needed to be updated alongside the controller/unit test change.

What changed in the follow-up:

  • switched the controller helper to use the shared JSON-RPC transport constant at the string boundary expected by server.AgentCard
  • tightened the regression test to require.NotNil(...) before asserting the value
  • regenerated the translator golden outputs so the new preferredTransport field and resulting config-hash changes are captured intentionally

Local verification on the rebased branch:

  • go test ./core/internal/controller/translator/agent -count=1
  • go test -race ./core/internal/controller/translator/agent -count=1

@EItanya EItanya merged commit 37b32d6 into kagent-dev:main Apr 20, 2026
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Agent card missing preferredTransport breaks a2a-go client

3 participants