Skip to content

fix: preserve selected A2A protocol on refresh#3407

Open
TannyXie wants to merge 1 commit into
ModelEngine-Group:developfrom
TannyXie:hotfix/3244-preserve-a2a-protocol
Open

fix: preserve selected A2A protocol on refresh#3407
TannyXie wants to merge 1 commit into
ModelEngine-Group:developfrom
TannyXie:hotfix/3244-preserve-a2a-protocol

Conversation

@TannyXie

Copy link
Copy Markdown

Summary

  • keep the selected A2A protocol when refreshing discovered agent metadata
  • avoid replacing existing call settings during refresh

Fixes #3244

Tests

  • Not run in this PR preparation step.

Copilot AI review requested due to automatic review settings July 11, 2026 14:13
@TannyXie TannyXie requested review from Dallas98 and WMC001 as code owners July 11, 2026 14:13

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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_card to refresh cached metadata without recalculating / overwriting the selected protocol.
  • Adjusted refresh_external_agent_cache to derive agent_url from the currently selected protocol_type and 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
)
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.

2 participants