fix: preserve selected A2A protocol on refresh#3407
Open
TannyXie wants to merge 1 commit into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR aims to prevent A2A external agents from “switching” protocols after a refresh by preserving the previously selected protocol_type, and to avoid overwriting existing call-related settings during metadata refresh.
Changes:
- Simplified
refresh_agent_cardto refresh cached metadata without recalculating / overwriting the selected protocol. - Adjusted
refresh_external_agent_cacheto deriveagent_urlfrom the currently selectedprotocol_typeand supported interfaces.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| backend/services/a2a_client_service.py | Updates refresh flow to preserve the existing selected protocol while refreshing cached Agent Card metadata. |
| backend/database/a2a_agent_db.py | Updates cache refresh logic to keep agent_url aligned with the selected protocol’s interface URL. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+535
to
+547
| logger.info( | ||
| f"Refreshing agent {external_agent_id} card while preserving selected protocol: " | ||
| f"{agent.get('protocol_type')}" | ||
| ) | ||
| result = a2a_agent_db.refresh_external_agent_cache( | ||
| external_agent_id=external_agent_id, | ||
| tenant_id=tenant_id, | ||
| user_id=user_id, | ||
| new_raw_card=card, | ||
| new_name=new_name, | ||
| new_description=new_description, | ||
| new_supported_interfaces=new_supported_interfaces | ||
| ) |
Comment on lines
+648
to
+653
| interface = _find_interface_by_protocol_type( | ||
| agent.supported_interfaces, | ||
| agent.protocol_type | ||
| ) | ||
| if interface: | ||
| agent.agent_url = interface.get("url", agent.agent_url) |
Comment on lines
+539
to
+547
| result = a2a_agent_db.refresh_external_agent_cache( | ||
| external_agent_id=external_agent_id, | ||
| tenant_id=tenant_id, | ||
| user_id=user_id, | ||
| new_raw_card=card, | ||
| new_name=new_name, | ||
| new_description=new_description, | ||
| new_supported_interfaces=new_supported_interfaces | ||
| ) |
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
Fixes #3244
Tests