Skip to content

feat(workflow): NodeInfo.OutputFor for delegation-chain output attribution#969

Draft
wolo-lab wants to merge 2 commits into
wolo/message-as-outputfrom
wolo/output-for
Draft

feat(workflow): NodeInfo.OutputFor for delegation-chain output attribution#969
wolo-lab wants to merge 2 commits into
wolo/message-as-outputfrom
wolo/output-for

Conversation

@wolo-lab
Copy link
Copy Markdown

@wolo-lab wolo-lab commented Jun 5, 2026

Add NodeInfo.OutputFor: the node paths an event's Output counts for — the
emitting node plus any WithUseAsOutput delegating ancestors.

A delegating child emits a single event stamped OutputFor=[child, parent, ...] that flows
up the whole chain, so the parent no longer re-emits a duplicate terminal
output event (full suppression, matching adk-python's _output_delegated+
output_for). On resume, collectNodeOutputs attributes that one event's output
to every static node named in OutputFor, and every output event records its
own path as a minimum (mirroring adk-python _enrich_event).

OutputFor rides through both session backends unchanged — in-memory copies the NodeInfo
pointer and the database round-trips it as whole-struct JSON.

@wolo-lab wolo-lab changed the title feat(workflow): NodeInfo.OutputFor for delegation-chain output attrib… feat(workflow): NodeInfo.OutputFor for delegation-chain output attribution Jun 7, 2026
@wolo-lab wolo-lab marked this pull request as ready for review June 7, 2026 17:37
@wolo-lab wolo-lab requested a review from dpasiukevich June 7, 2026 17:37
@wolo-lab wolo-lab force-pushed the wolo/message-as-output branch from 749072a to b0d4a1b Compare June 8, 2026 08:05
@wolo-lab wolo-lab force-pushed the wolo/message-as-output branch from b0d4a1b to ba7d347 Compare June 8, 2026 08:16
@wolo-lab wolo-lab force-pushed the wolo/message-as-output branch from ba7d347 to 6024efc Compare June 8, 2026 08:17
@wolo-lab wolo-lab force-pushed the wolo/message-as-output branch from 6024efc to f620edd Compare June 8, 2026 11:30
@wolo-lab wolo-lab marked this pull request as draft June 8, 2026 11:39
wolo-lab added 2 commits June 8, 2026 11:59
Adopt adk-python's delegation model, replacing the v2 re-emit approach
(revises #920). When a WithUseAsOutput child delegates the parent's
output, the child's own event now carries the output up and the parent
emits no terminal event (full suppression, mirroring
_output_delegated). Previously the child's event was dropped and the
parent re-emitted the delegated value, which could not support
output_for attribution and lost the value when the orchestrator body
returned nil.

Also stamp NodeInfo.Path on a child event that set NodeInfo without a
Path (e.g. MessageAsOutput), since such events are now emitted up.

Tests updated to assert the child event carries the delegated output.
Add OutputFor to session.NodeInfo and stamp it on a delegated child's
output event with the whole delegation chain ([childPath, parentPath,
...ancestors]), mirroring adk-python's node_info.output_for /
_enrich_event. outputForAncestors is threaded through RunNode
(WithUseAsOutput) so a multi-level chain (grandchild -> parent -> top)
records every ancestor on the single output event.

On resume collectNodeOutputs attributes the output to the static owner
of each OutputFor path, so a delegating ancestor recovers its output
without re-emitting (output_for parity).

Also fixes nested dynamic-node path composition: a child context already
carries the full "<parent>/<name>@<runID>" path, so composePath uses it
as-is instead of appending the name again (surfaced by multi-level
delegation).
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