Skip to content

Clarify whether a node may emit stream chunks for another node’s output selector #428

Backlog

Description

@QuantumGhost

AI disclosure — I discussed this behavior with Codex (gpt-6.2-astra), which helped verify the example and draft this issue. I am responsible for raising this question.

Should a node be able to finish another node's output stream?

I would expect a node that yields a StreamChunkEvent to own the output named by its selector. For example, a Tool can stream both [tool_id, "text"] and [tool_id, "summary"]. Should a different node also be allowed to append to either stream or close it with is_final=True?

What prompted the question

#413 reports that an Answer stops streaming when an LLM fails after emitting a partial response and the engine commits a default value. #421 proposes a fix and adds a test that makes a separate behavior explicit:

  1. The node llm emits an empty chunk for ["llm", "text"]. Its retries fail and the engine commits "fallback" as llm.text.
  2. A downstream custom node with ID continue yields StreamChunkEvent(selector=["llm", "text"], chunk="!", is_final=True). The event identifies continue as the producer and llm.text as the output being closed.
  3. Running that case on the PR head produced A[!/old]END|NEXT on the stream and A[fallback/old]END|NEXT in the saved Answer. The LLM emitted no visible text. The visible ! came entirely from a different node.

Custom node in #421 · Test assertion

What the implementation allowed before the PR

At the PR base (66311bd5), node dispatch set the event's node_id from the emitting node and copied event.selector as supplied. The root response filter matched referenced selectors without checking the emitting node ID. This path already accepted cross-node chunks. The built-in LLM and Tool emit chunks under their own node IDs, including the Tool's dynamically named outputs. Node dispatch · Filter matching · LLM output · Tool variable output

Proposed contract

For a node-emitted chunk addressing a node output, I would require selector[0] == emitting_node.id, including final chunks. A downstream node that wants to contribute to an Answer can stream its own output and the Answer can reference that selector explicitly. This question concerns chunks yielded by nodes. The filter also synthesizes presentation events while rendering an Answer, and nodes can separately request variable updates.

Is there a host integration that intentionally appends to or closes another node's stream today? A concrete use case would help decide whether to preserve that behavior or enforce ownership at the node event boundary. This matters for #421 because if another node may still produce a final chunk, the filter needs a reliable way to know when it can advance past a failed producer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions