Skip to content

Workflow parent retry loses a deferred route when the node also writes deltas #7930

Closed

Description

@1828703450qqcom-ux

Description

A workflow node that sets ctx.route and pending state/artifact deltas without yielding another event loses its route from the final persisted event. The returned Context still holds the route, so the initial execution selects the correct branch. A parent retry reconstructing the nested workflow from events cannot recover the route, and the selected branch silently ends instead of retrying its failed node.

class Router(BaseNode):
  async def _run_impl(self, *, ctx, node_input):
    ctx.output = 'routed'
    ctx.route = 'go_b'
    ctx.state['visited'] = True
    return
    yield  # async generator with deferred context output

The final event has output routed and state delta {'visited': True}, but event.actions.route is None. Artifact-only deltas and combined state/artifact deltas show the same problem. A route without deltas survives.

Root cause

NodeRunner._flush_output_and_deltas constructs Event(route=...), then replaces the entire event.actions object with an EventActions containing only the deltas. The newly assigned actions discard the route. Reusing _flush_deltas, which merges into the existing actions, preserves it.

End-to-end impact

A real Runner executes an outer driver node with a two-attempt retry policy, invoking a nested workflow router -> {'go_b': flaky_b, 'go_c': node_c}. flaky_b fails on its first call and succeeds on its second. On main, the router runs once but flaky_b runs only once: recovery emits a warning that no edge matches route None and returns without the selected result. With the route preserved, the router still runs once, flaky_b runs twice, node_c never runs, and the expected output is produced.

Verification

Reproduced on main 95d8610 with real Runner and InMemorySessionService, no model/cloud service. Three delta combinations fail in a per-node regression (no-delta control passes), and the conditional parent-retry integration regression fails too.

AI assistance: Codex investigated and reproduced the problem.

Activity

  1. self-assigned this
    on Nov 2, 2026
  2. added theissue type on Nov 2, 2026
  3. added
    core[Component] This issue is related to the core interface and implementation
    on Nov 2, 2026
  4. added a commit that references this issue on Nov 2, 2026
    af6f671
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

core[Component] This issue is related to the core interface and implementation

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions