Repository navigation
Description
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:
- The node
llmemits an empty chunk for["llm", "text"]. Its retries fail and the engine commits"fallback"asllm.text. - A downstream custom node with ID
continueyieldsStreamChunkEvent(selector=["llm", "text"], chunk="!", is_final=True). The event identifiescontinueas the producer andllm.textas the output being closed. - Running that case on the PR head produced
A[!/old]END|NEXTon the stream andA[fallback/old]END|NEXTin 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.
Activity