Skip to content

A2A communication drops state context by invoking 4-argument runner.runAsync #1240

Description

Description

During Agent-to-Agent (A2A) communication, AgentExecutor.java triggers execution by calling runner.runAsync. However, it uses the 4-argument signature. Looking at Runner.java, this specific overload explicitly hardcodes /* stateDelta= */ null, completely dropping any custom state or metadata passed during the interaction.

To support agents that pass metadata or state deltas to guide downstream processing, AgentExecutor should extract this context and pass it into the 5-argument version of runAsync.

Code Reference

  1. The Call Site (AgentExecutor.java)
    AgentExecutor invokes the 4-argument method inside the execute pipeline:
return runner.runAsync(
    getUserId(ctx),
    session.id(),
    content,
    agentExecutorConfig.runConfig()); // <-- ISSUE: Invokes 4-arg variant
  1. The Root Cause Overload (Runner.java)
    In Runner.java, the 4-argument variant forces the state delta to be null:
public Flowable<Event> runAsync(
    String userId, String sessionId, Content newMessage, RunConfig runConfig) {
  return runAsync(userId, sessionId, newMessage, runConfig, /* stateDelta= */ null); // <-- ISSUE: Hardcoded null
}

Expected Behavior

AgentExecutor should extract the incoming state/metadata from the RequestContext ctx (or the incoming Message) and invoke the 5-argument version of runAsync so that the stateDelta is properly propagated into the session history.

Runner.java

AgentExecutor.java

Activity

  1. self-assigned this
    on Jun 3, 2026
  2. added theissue type on Jun 3, 2026
  3. hemasekhar-p commented on Jun 3, 2026

    @hemasekhar-p
    Contributor

    Hi @anastasiiapeleshok-festcloud, Thank you for reporting this issue. I have tried to reproduce this issue using the latest version but was unable to observe the reported behavior. Could you please try with the Latest version 1.4.0 and if you are observing the same, Could you please share the repro steps and a minimal reproducible example along with the error logs? having this information will help us to investigate further and provide a solution.

  4. added
    waiting on reporterWaiting for reaction by reporter. Failing that, maintainers will eventually closed it as stale.
    on Jun 3, 2026
  5. anastasiiapeleshok-festcloud commented on Jun 11, 2026

    @anastasiiapeleshok-festcloud
    Author

    Hi @anastasiiapeleshok-festcloud, Thank you for reporting this issue. I have tried to reproduce this issue using the latest version but was unable to observe the reported behavior. Could you please try with the Latest version 1.4.0 and if you are observing the same, Could you please share the repro steps and a minimal reproducible example along with the error logs? having this information will help us to investigate further and provide a solution.

    Hi @hemasekhar-p,

    Thank you for looking into this! I realize my initial description might not have been clear enough.

    To clarify, this issue doesn't produce any error logs or exceptions, which is likely why you couldn't observe it via standard reproduction attempts. Instead, it is a silent logical bug where data is being dropped at the code level.

    I've attached two screenshots from the codebase (which is still present in the latest version) that highlight the exact execution path:

    AgentExecutor.java (Screenshot 1): Starting at line 216, the execute method calls runner.runAsync(...). It only passes 4 arguments (userId, sessionId, content, runConfig).

    Runner.java (Screenshot 2): Starting at line 365, the 4-argument runAsync overload acts as a wrapper. It calls the 5-argument method but explicitly hardcodes /* stateDelta= */ null as the final parameter.

    Image Image

    Because AgentExecutor relies on this 4-argument wrapper, any stateDelta or metadata passed during Agent-to-Agent communication is instantly dropped and overwritten by that hardcoded null. It never reaches the underlying session processing.

    To fix this, AgentExecutor needs to be updated to extract the state/metadata from the RequestContext, and directly invoke the 5-argument version of runAsync so the context is preserved.

    Let me know if this helps clarify the problem.

  6. hemasekhar-p commented on Jun 16, 2026

    @hemasekhar-p
    Contributor

    Hi @anastasiiapeleshok-festcloud, Thank you for the detailed information. I have created this PR to resolve this problem. hope this PR will resolve your issue?

  7. added
    waiting on reporterWaiting for reaction by reporter. Failing that, maintainers will eventually closed it as stale.
    and removed
    waiting on reporterWaiting for reaction by reporter. Failing that, maintainers will eventually closed it as stale.
    on Jun 16, 2026
  8. MiloszSobczyk commented on Jul 13, 2026

    @MiloszSobczyk
    Member

    Hello, @anastasiiapeleshok-festcloud. We decided to go with the approach that aligns the functionality with ADK Python.

    Instead of writing a2a:task_id / a2a:context_id into session state, AgentExecutor now routes the incoming request metadata (ctx.getParams().metadata()) into RunConfig.customMetadata under the a2a_metadata key and leaves the state delta null. This mirrors ADK Python a2a/converters/request_converter.py:

    • A2A_METADATA_KEY = 'a2a_metadata' (L31),
    • custom_metadata[A2A_METADATA_KEY] = request_metadata (L104),
    • run_config=RunConfig(custom_metadata=custom_metadata) (L120;
    • state_delta defaults to None (L42) and is never forwarded (a2a_agent_executor.py L211).
  9. MiloszSobczyk commented on Jul 13, 2026

    @MiloszSobczyk
    Member

    The issue has been resolved in commit 410ff81 and will be included in the next release.

  10. removed
    waiting on reporterWaiting for reaction by reporter. Failing that, maintainers will eventually closed it as stale.
    on Jul 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions