Repository navigation
ADK: a failed turn's finished calls keep their results - #324
Merged
Merged
Conversation
Pins, on ADK and Deep Agents, that a turn whose model call fails after a step's two calls returned ends with its one ERROR and the next turn's root request carries both calls' real results, and that a delegation still working when its sibling's permission check fails the turn ends interrupted, which is what its coordinator then reads. gate_fails_after makes one tool's permission check raise once a condition holds: a way to fail a turn inside a tool step on both backends.
A call left open at the start of a turn is answered through OpenCalls.answer as the root's: a call the record holds as finished keeps its result, and the state it changed goes into the answer's event actions, as a seal's does; a call the record does not hold is answered as before (its job's state, else interrupted). A call on a delegation branch of a conversation stored before sub-agents ran on child sessions is still answered as interrupted. Nothing keeps a record for left_open yet: the next commit keeps a failed turn's. The unused returned() goes: nothing has called it since sub-agents run on child sessions.
ADK stores a step's parallel results together, after the last returns, so a turn that failed in between (a sibling's permission check that raised, a store that refused the results) left a call that had returned without a stored result. The turn cleared its OpenCalls record, so the next turn answered that call as interrupted, and a delegation's run said completed while its coordinator read the interruption and lost the tasks the run saved. The failure path now calls OpenCalls.failed, as Deep Agents does, and left_open answers the call with its result and the state it changed. _answer_left_open then forgets the record once its answers are stored, so it answers no later call of the same id: a stop in the next turn no longer seals a reused call id with the failed turn's result. The contract suite covers it on both backends; ADK tests cover a store that refuses the step's results and a reused call id after a failed model call.
The CHANGELOG's Fixed entry, CLAUDE.md's ADK manager and left_open structure lines and Interrupted calls paragraph, and the README's interrupted-calls passage say that a failed turn keeps the record of its calls that returned on both backends, and that ADK forgets it once the next turn's answers are stored.
# Conflicts: # CHANGELOG.md
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.
After an ADK turn that fails, a call of the root's that had returned in that turn is now answered at the next turn with its real result, as on Deep Agents. Before, it was answered "interrupted" even though it ran.
ADK stores a step's parallel results together, after the last call returns. A failure between one call's return and that store (a plugin callback raising, such as the permission engine; the store refusing the step's results) left that result only in the conversation's
OpenCallsrecord. The failure path then cleared the record. With ataskdelegation as the call, the run's record saidcompletedwhile the parent read "interrupted", and the tasks the run saved were lost._run_and_streamkeeps a failed turn's record (OpenCalls.failed) instead of clearing it.interrupted_calls_plugin.left_openanswers the root's own calls from that record: the result as the cap cut it, with its state and artifact deltas, which include ataskcall's shared keys.interrupted_calls_plugin.returned, unused since sub-agents run through the framework'stask, is removed.Tests: contract pins on both backends cover:
New tests were written first and seen failing. The full offline suite passes in the worktree except
TestChildImportOrigin, which fails the same way on develop under the worktree wrapper.