Skip to content

fix(a2a): read long-running function name from data, not metadata#6296

Open
Osamaali313 wants to merge 1 commit into
google:mainfrom
Osamaali313:fix-a2a-euc-task-state
Open

fix(a2a): read long-running function name from data, not metadata#6296
Osamaali313 wants to merge 1 commit into
google:mainfrom
Osamaali313:fix-a2a-euc-task-state

Conversation

@Osamaali313

Copy link
Copy Markdown

Fixes #6295

Problem

LongRunningFunctions._mark_long_running_function_call sets the A2A task state for a long-running function call — auth_required for an End-User-Credential (EUC) request, input_required otherwise. It read the function name from the wrong dict:

# src/google/adk/a2a/converters/long_running_functions.py:163
if a2a_part.root.metadata.get("name") == REQUEST_EUC_FUNCTION_CALL_NAME:

For a function-call DataPart, the name lives in a2a_part.root.data (the FunctionCall dump — see part_converter.convert_genai_part_to_a2a_part: data=part.function_call.model_dump(...)). metadata only holds the ADK adk_type / adk_is_long_running keys, so metadata.get("name") is always None. The EUC branch is never taken, and a credential request is mislabeled input_required instead of auth_required.

The sibling converter already does this correctly:

# src/google/adk/a2a/converters/event_converter.py:504
and part.root.data.get("name") == REQUEST_EUC_FUNCTION_CALL_NAME

Fix

if a2a_part.root.data.get("name") == REQUEST_EUC_FUNCTION_CALL_NAME:

Tests

Added tests/unittests/a2a/converters/test_long_running_functions.py (there was no dedicated test — the executor test fully mocks LongRunningFunctions), asserting that an EUC request yields auth_required and a regular long-running function yields input_required.

Before the fix the EUC case fails (input_required); after, it passes. The full tests/unittests/a2a/converters/ suite passes (171 → 173 with the new tests).

_mark_long_running_function_call read the function name from the A2A
DataPart's metadata, but for a function-call part the name lives in
data (the FunctionCall dump); metadata only holds the adk_type /
adk_is_long_running keys. metadata.get("name") was therefore always
None, so an End-User-Credential request was mislabeled input_required
instead of auth_required. Read it from data, matching the equivalent
check in event_converter.py.
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.

A2A long-running EUC request mislabeled input_required instead of auth_required (reads name from metadata, not data)

1 participant