Skip to content

Conversation

@ShishirRmc
Copy link

Fixes #551

Changes

  • Fixed JsonRpcTransport.get_card() to return the newly fetched authenticated extended card instead of the stale card

Details

Changed line from return card to return self.agent_card to ensure the method returns the updated card after fetching the authenticated extended version.

This aligns the JsonRpcTransport behavior with RestTransport's correct implementation.

Testing

  • Verified the fix matches RestTransport's pattern
  • Confirmed internal state and return value are now consistent

The get_card() method was returning the stale 'card' variable instead of the newly fetched 'self.agent_card' when retrieving authenticated extended cards. This caused callers to receive outdated agent metadata.
This fix aligns JsonRpcTransport with RestTransport's correct behavior.
@ShishirRmc ShishirRmc requested a review from a team as a code owner November 19, 2025 08:42
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @ShishirRmc, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request resolves a data consistency issue within the JsonRpcTransport by correcting the return value of its get_card method. Previously, the method could return an outdated agent card, but now it reliably provides the most recently fetched and authenticated version, standardizing behavior across different transport mechanisms.

Highlights

  • Bug Fix: Fixed an issue in JsonRpcTransport.get_card() where it was returning a stale agent card instead of the newly fetched, authenticated extended card.
  • Behavior Alignment: Ensured that the JsonRpcTransport's get_card() method now aligns its return behavior with the correct implementation found in RestTransport.
  • Data Consistency: The change guarantees that the method consistently returns the most up-to-date agent_card after it has been refreshed.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request provides a crucial fix for a bug in JsonRpcTransport.get_card(), ensuring that the method returns the updated agent_card after fetching the authenticated extended version, rather than a stale one. The change is correct and aligns the behavior with RestTransport. I have added one minor suggestion to improve the maintainability of the code and prevent similar issues in the future. Overall, this is a solid contribution.

@ShishirRmc ShishirRmc changed the title Fix: Return updated agent_card in JsonRpcTransport.get_card() fix: return updated agent_card in JsonRpcTransport.get_card() Nov 19, 2025
@holtskinner
Copy link
Member

@ShishirRmc Can you adjust the unit tests to check for this new behavior. This is also technically a breaking change, even if you have now corrected the intended behavior.

@lkawka @mikeas1 Not sure if this behavior is intended or not, can you verify?

@sokoliva sokoliva self-assigned this Nov 21, 2025
@sokoliva
Copy link
Contributor

sokoliva commented Nov 21, 2025

@lkawka @mikeas1 Not sure if this behavior is intended or not, can you verify?

@holtskinner I didn't find any evidence that this is intended, but I did find a couple of reasons to believe it is not, suggesting a mistake was made.

  1. There is nothing to suggest that this is the intended behavior in the spec
  2. In both RestTransport and GrpcTransport get_card retrieves newly fetched authenticated extended card.JsonRpcTransport is the only one in which get_card returns the stale card.
  3. get_card methods of all three transports all have the same description which is "Retrieves the agent's card." and method of base class ClientTransport has "Retrieves the AgentCard.". I would assume that their functionality is the same - to retrieve the current agent_card, not the former one.
  4. When _needs_extended_card=True, in get_card methods of RestTransport and GrpcTransport, the values of variables card and self.aget_card are the same at point of return. This means it makes no difference whether card or self.agent_card is returned. JsonRpcTransport is the only transport where those two values are different. In all 3 methods they return card, so there is a chance this is a bug created by copy/paste between transports.

Since all 3 methods were added on the same commit, this feels like a likely mistake to make.

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]: JsonRpcTransport.get_card() returns stale card instead of authenticated extended card

5 participants