Repository navigation
fix(adk): preserve checkpoints for canceled tool streams - #1303
Merged
Merged
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1303 +/- ##
==========================================
+ Coverage 83.77% 83.79% +0.02%
==========================================
Files 162 162
Lines 23940 24123 +183
==========================================
+ Hits 20055 20215 +160
- Misses 2625 2643 +18
- Partials 1260 1265 +5 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
hi-pender
approved these changes
Sep 20, 2026
2 of 3 tasks
3 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
On v0.9.19,
CancelImmediatewithWithRecursivecan terminate anAgentToolchild while itsChatModelAgentis consuming aStreamableToolresult. The resultingErrStreamCanceledescapes as an ordinary stream failure during checkpoint materialization, so the child finishes without resumableToolNodeinterrupt state. The caller then observesErrExecutionEnded, andRunner.Resumecannot continue from the interrupted tool call.Solution
Treat framework-driven tool stream cancellation as checkpoint control flow:
ToolNodeinput and rerun state;This is a v0.9 backport of #1224 (
0fb0380e) with an end-to-end regression coveringAgentTool -> ChatModelAgent -> StreamableToolcancellation and resume.Key Insight
A framework-canceled tool stream is not a terminal tool failure. Its partial output cannot be treated as completed state; the checkpoint must preserve the original
ToolNodeinput, retain successfully completed sibling calls, and rerun only canceled calls on resume.问题
在 v0.9.19 中,当
AgentTool内部的ChatModelAgent正在消费StreamableTool结果时,使用CancelImmediate + WithRecursive可能让ErrStreamCanceled在 checkpoint 物化阶段作为普通流错误返回。child 因此结束,但没有生成可恢复的ToolNodeinterrupt state;调用方收到ErrExecutionEnded,Runner.Resume也无法从被中断的工具调用继续。解决方案
将框架触发的工具流取消作为 checkpoint 控制流处理:
ToolNode输入和 rerun state 的 composite interrupt;这是 #1224(
0fb0380e)面向 v0.9 的 backport,并补充了AgentTool -> ChatModelAgent -> StreamableTool取消与恢复的端到端回归覆盖。关键结论
框架取消的工具流不是终态工具失败。其部分输出不能被视为已完成状态;checkpoint 必须保留原始
ToolNode输入和已完成的 sibling tool 结果,并在恢复时只重跑被取消的调用。