Skip to content

fix(workflow): preserve tool history when an agent node resumes - #8301

Open
ZaidLT wants to merge 2 commits into
google:mainfrom
ZaidLT:fix/workflow-resume-tool-history-7719
Open

ZaidLT wants to merge 2 commits into
google:mainfrom
ZaidLT:fix/workflow-resume-tool-history-7719

Conversation

@ZaidLT

@ZaidLT ZaidLT commented Nov 22, 2026 •

Copy link
Copy Markdown

Link to issue

Refs #7719. Related to #7738.

When a single-turn agent resumes inside a Workflow, its tool call and response can be present in the session but missing from the next model request. The wrapper appends the transient node input after the saved tool events, so the model sees only the original input.

This patch inserts that input before the first event for the same invocation, full node path, branch and isolation scope. The existing resume_inputs guard still handles confirmation separately.

Thanks to @widechaos for diagnosing the ordering issue and suggesting a separate PR. Both patches touch the insertion point. The Workflow/resume owners can choose the landing order. The earlier checkpoint-provenance question remains open separately.

Testing plan

  • Eight Runner regressions use SQLite to exercise cancellation and abrupt worker exit with parallel branches, a completed sibling, repeated invocations and loop iterations. All eight failed on the tests-only commit. On the published fix, all eight passed locally on each of Python 3.11, 3.12, 3.13 and 3.14.
  • On Python 3.12, the Workflow suite went from 1,487 to 1,495 passes with the same two expected failures. Changed-file pre-commit checks passed.
  • A separate end-to-end comparison used the same agent directly and as a Workflow node. On cancellation, the model received the stored abort response with zero additional tool executions. After a child-process exit, the pending call replayed once using the original ID and arguments.
  • Full unit-test matrix (3.11–3.14) on my fork: the 8 new tests pass on every version, with no new failures. The one failing test also fails on main in Google's CI; see the results comment below.

To reproduce the eight new cases from a development checkout:

python -m pytest -q tests/unittests/workflow/test_workflow_tool_resume.py

Exercise cancellation and abrupt worker exit through the public Runner and a SQLite session. Verify the resumed model sees the original call and response across parallel branches, repeated invocations and loop iterations.

Refs google#7719
Restore the transient single-turn input before the earlier events for the same invocation, node path, branch and isolation scope. The model then receives the saved tool call and response when the Runner resumes.

Credit to widechaos for identifying the input-ordering problem in google#7719.
@ZaidLT
ZaidLT marked this pull request as ready for review November 22, 2026 16:40
@ZaidLT

ZaidLT commented Nov 22, 2026

Copy link
Copy Markdown
Author

I ran the full unit-test suite on my fork at 81681a2. On Python 3.11, 3.12, 3.13 and 3.14, all eight new regression tests passed. On each version, the only failure was test_render_start_command_wrapper_handles_legacy_signature_without_agent_loader, which also fails on all four versions in Google’s CI on main. All A2A and MCP jobs passed.

Fork matrix · Python 3.11 result · Upstream comparison

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.

2 participants