Skip to content

ADK: a failed turn's finished calls keep their results - #324

Merged
shoom1 merged 5 commits into
developfrom
fix/adk-failed-turn-calls
Nov 18, 2026
Merged

shoom1 merged 5 commits into
developfrom
fix/adk-failed-turn-calls

Conversation

@shoom1

@shoom1 shoom1 commented Nov 18, 2026

Copy link
Copy Markdown
Owner

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 OpenCalls record. The failure path then cleared the record. With a task delegation as the call, the run's record said completed while the parent read "interrupted", and the tasks the run saved were lost.

  • _run_and_stream keeps a failed turn's record (OpenCalls.failed) instead of clearing it.
  • interrupted_calls_plugin.left_open answers the root's own calls from that record: the result as the cap cut it, with its state and artifact deltas, which include a task call's shared keys.
  • The record is forgotten once the next turn's answers are stored, so no later call is answered from it.
  • interrupted_calls_plugin.returned, unused since sub-agents run through the framework's task, is removed.

Tests: contract pins on both backends cover:

  • a model call failing after a step's calls returned;
  • a delegation still working when its sibling fails the turn;
  • a failure inside the tool step after a sibling returned;
  • the store refusing the step's results;
  • a guard that a kept record answers no later call.

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.

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.
@shoom1
shoom1 merged commit b3ff905 into develop Nov 18, 2026
6 checks passed
@shoom1
shoom1 deleted the fix/adk-failed-turn-calls branch November 18, 2026 01:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant