Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Runner drops callbackContextData written in onUserMessageCallback when it resumes an invocation

Aperta Adatta ai principianti
#1,695 1 commento 0 reazioni 1 assegnatario Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@hirematha ci sta già lavorando.

Dal 26/10/2026.

  • #1696 di @svetanis — aperta

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
78/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
java
Ambito
backend

Direzione di ricerca

Leggi runResumedAgent, resumeCore e runAgentWithUpdatedSession nell’implementazione di Runner. Segui come viene costruito initialContext e passato ai callback, quindi confronta il percorso di ripresa con quello di una nuova invocazione. Riproduci il problema con la ripresa abilitata e un plugin che memorizza dati in onUserMessageCallback; il lavoro è completato quando i callback dell’agente ripreso vedono quei dati e un test di regressione copre il comportamento di ripresa esistente.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

needs review

Please make sure you read the contribution guide and file the issues in the right place.
Contribution guide.

🔴 Required Information

Describe the Bug

InvocationContext.callbackContextData() is "a map for storing temporary context data that can be shared
between different parts of the invocation", and InvocationContext.Builder passes the same instance to every
copy "so that Plugins can access the same data … across all types of callbacks."

A new invocation keeps that promise. runNewInvocation runs onUserMessageCallback on initialContext, and
runAgentWithUpdatedSession builds the agent's context with initialContext.toBuilder(), so the map is shared.

A resumed invocation does not. resumeCore runs onUserMessageCallback on its own initialContext, but
runResumedAgent is not given that context and builds the agent's from a second builder:

// runResumedAgent
InvocationContext rootContext =
    newInvocationContextBuilder(session, rootAgent)
        .invocationId(resolvedInvocationId)
        .runConfig(runConfig)
        .userContent(userContentFor(session, resolvedInvocationId, userContent))
        .build();

newInvocationContextBuilder starts a new, empty callbackContextData, so whatever a plugin stored in
onUserMessageCallback is missing from beforeRunCallback and from every callback that runs with the agent.
The same builder also resets endInvocation: a plugin that ends the invocation in onUserMessageCallback stops
a new invocation, but a resumed one still calls the model. On every resume, onRunErrorCallback also runs on
initialContext, so it does not see what beforeRunCallback stored, even when no new message is sent.

Trigger: resumability enabled and an invocation paused (for example on a long-running tool) that is then
resumed, with or without a new message. New invocations are unaffected.

Steps to Reproduce
  1. A Runner with ResumabilityConfig.builder().resumable(true), an LlmAgent with a long-running tool, and a
    plugin whose onUserMessageCallback puts a value into invocationContext.callbackContextData() and whose
    beforeAgentCallback reads it back.
  2. Send a message. The model calls the tool and the invocation pauses.
  3. Send the tool's function response, which resumes the invocation.
Expected Behavior

On the resumed turn, beforeAgentCallback reads the value that turn's onUserMessageCallback stored, as it
does on the first turn.

Observed Behavior

The first turn reads its value, and the resumed turn reads null (the plugin stores message-1, then
message-2). beforeAgentCallback reads, per turn:

[agent:message-1, agent:null]

The same happens when the resume is routed to a sub-agent instead of the root.

Environment Details
  • ADK Library Version: main @ 84bae34a (pom 1.13.0)
  • OS: not OS-specific
  • TS Version: N/A (Java)
Model Information

N/A


🟡 Optional Information

Regression

No. Present since resuming an invocation was added (v1.11.0).

Willingness to contribute

Yes, a PR follows. runResumedAgent takes initialContext and builds the agent's context with
initialContext.toBuilder(), as runAgentWithUpdatedSession does:

InvocationContext rootContext =
    initialContext.toBuilder()
        .agent(rootAgent)
        .userContent(...)
        .build();
How often has this issue occurred?

Always (100%), on a resumed invocation.

Lingua principale
Java
Stelle
1.8k
Fork
440
Merge medio
3g 16h
PR unite (30g)
92

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di google/adk-java

Tutte le issue di google/adk-java

Issue simili

Altre issue su Java

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.