Runner drops callbackContextData written in onUserMessageCallback when it resumes an invocation
メンテナーはふだん 1 日以内に返信
評価
調査の方向性
Runner の実装で runResumedAgent、resumeCore、runAgentWithUpdatedSession を読みます。initialContext がどのように構築され、コールバックに渡されるかを追い、その後、再開時の経路と新しい呼び出し時の経路を比較します。再開機能を有効にし、onUserMessageCallback にデータを保存するプラグインを使って再現します。再開されたエージェントのコールバックがそのデータを参照でき、既存の再開動作が回帰テストでカバーされていれば完了です。
索引モデルが issue の本文から書いたものです。
説明
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
- A
RunnerwithResumabilityConfig.builder().resumable(true), anLlmAgentwith a long-running tool, and a
plugin whoseonUserMessageCallbackputs a value intoinvocationContext.callbackContextData()and whose
beforeAgentCallbackreads it back. - Send a message. The model calls the tool and the invocation pauses.
- 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.
- 主要言語
- Java
- スター
- 1.8k
- フォーク
- 440
- 平均マージ
- 3日 16時間
- マージ済み PR(30日)
- 92
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
google/adk-java のほかの issue
-
InMemorySessionService.appendEvent recreates a deleted session対応中かも @hirematha が 4 日前に担当しました。 オープンneeds review
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
google/adk-java#1697 · コメント 2 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
AgentExecutor ignores the A2A contextId when creating a session, so multi-turn conversations start over every turn対応中かも @hirematha が 2 日前に担当しました。 オープンneeds review
google/adk-java#1718 · コメント 2 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
McpToolset hangs silently for ~5 minutes per retry (3 retries) when stdio command is an npm shim ("npx") on Windows対応中かも @hemasekhar-p が 8 日前に担当しました。 オープンneeds review
google/adk-java#1686 · コメント 4 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
runLive passes partial events to appendEvent and never aggregates text chunks, unlike ADK Python対応中かも @hemasekhar-p が 18 日前に担当しました。 オープンneeds review
難易度 4/5 3〜5日 初心者へのやさしさ 45/100
google/adk-java#1648 · コメント 3 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
FirestoreSessionService compares event timestamps as text, reordering or skipping same-second events対応中かも @hemasekhar-p が 18 日前に担当しました。 オープンneeds review
難易度 3/5 1〜2日 初心者へのやさしさ 50/100
google/adk-java#1646 · コメント 3 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
google/adk-java の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
-
bug/错误
難易度 2/5 1〜3時間 初心者へのやさしさ 64/100
FCL-Team/FoldCraftLauncher#1982 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
[BUG] micronaut-serde-oracle-jdbc-json brings a second OJDBC driver onto the runtime classpath対応中かも @ZARAYACH が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
micronaut-projects/micronaut-serialization#1494 · コメント 4 件 ·
メンテナーはふだん 2 日以内に返信
-
難易度 1/5 1〜3時間 初心者へのやさしさ 75/100
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 73/100
メンテナーはふだん 2 日以内に返信