Skip to content

fix(workflow): scope dynamic node cache rehydration to current invocation#1010

Merged
wolo-lab merged 3 commits into
v2from
wolo/fix-dynamic-rehydrate-invocation-scope
Jun 16, 2026
Merged

fix(workflow): scope dynamic node cache rehydration to current invocation#1010
wolo-lab merged 3 commits into
v2from
wolo/fix-dynamic-rehydrate-invocation-scope

Conversation

@wolo-lab

Copy link
Copy Markdown
Contributor

Problem

A dynamic workflow (e.g. examples/workflow/dynamic/basic) returns empty
output on the second and every subsequent turn of the same session. The first
turn works; later turns print nothing.
Root cause: dynamicSubScheduler.rehydrateCache scans the entire session
history and caches child outputs keyed by childPath, without filtering by
invocation. Auto-counter run-ids reset to 1 on every fresh activation, so a
later user turn reuses the same childPath (e.g. wf/child@1) as a prior
turn. The stale output is served from cache, the child never re-runs, and the
parent's terminal event carries an Output but no Content — so the console
(which prints content text) shows nothing.

Solution

Filter rehydration to events from the current invocation. Stale events from
earlier turns are skipped, so a fresh turn re-runs its children; events from the
current invocation still hit, preserving within-invocation resume/dedup (the
HITL replay path).
This mirrors adk-python, which gates rehydration on event.invocation_id
(_reconstruct_node_states / _scan_parent_child_sequence).

…tion

rehydrateCache scanned the entire session history and cached child
outputs keyed by childPath, without filtering by invocation_id. Because
auto-counter run-ids reset to 1 on every fresh activation, a later user
turn reuses the same childPath (e.g. "wf/child@1") as a prior turn, so
the stale output was served from cache and the child never re-ran. This
caused the dynamic workflow example to return empty output on the second
and subsequent turns.

Filter rehydration to events from the current invocation, mirroring
adk-python (_reconstruct_node_states / _scan_parent_child_sequence gate
on event.invocation_id). Within-invocation resume/dedup is preserved.
@wolo-lab wolo-lab requested a review from hanorik June 12, 2026 15:06
@wolo-lab wolo-lab merged commit 98ef904 into v2 Jun 16, 2026
3 checks passed
@wolo-lab wolo-lab deleted the wolo/fix-dynamic-rehydrate-invocation-scope branch June 16, 2026 05:26
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