feat(workflow): NodeInfo.OutputFor for delegation-chain output attribution#969
Draft
wolo-lab wants to merge 2 commits into
Draft
feat(workflow): NodeInfo.OutputFor for delegation-chain output attribution#969wolo-lab wants to merge 2 commits into
wolo-lab wants to merge 2 commits into
Conversation
749072a to
b0d4a1b
Compare
b0d4a1b to
ba7d347
Compare
ba7d347 to
6024efc
Compare
6024efc to
f620edd
Compare
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).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add
NodeInfo.OutputFor: the node paths an event's Output counts for — theemitting node plus any
WithUseAsOutputdelegating ancestors.A delegating child emits a single event stamped
OutputFor=[child, parent, ...]that flowsup 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,collectNodeOutputsattributes that one event's outputto every static node named in
OutputFor, and every output event records itsown path as a minimum (mirroring adk-python
_enrich_event).OutputForrides through both session backends unchanged — in-memory copies theNodeInfopointer and the database round-trips it as whole-struct JSON.