fix(agent): tolerate explicit null outputs in streamed conversation events - #572
Merged
Conversation
…vents
`WorkflowFinishedPayload.outputs`, `NodeToolUseFinishedPayload.outputs`,
and `SubagentFinishedPayload.outputs` were `#[serde(default)]`, which only
applies to a missing key — not an explicit `null`. A `workflow_finished`
(or node/subagent finished) event carrying `"outputs": null`, which the
server can send on resumed/continued conversations, failed to deserialize
and aborted the whole event stream:
invalid type: null, expected struct WorkflowOutputs
Deserialize these fields through `null_as_default` so `null` maps to the
type's default, matching how the sibling `null` lists are already handled.
hogan-yuan
added a commit
that referenced
this pull request
Aug 14, 2026
…#573) Follow-up to the `null` `outputs` fix (#572), same class of bug. Several list-typed fields on the streamed AI Agent conversation event payloads were `#[serde(default)]`, which only fills a **missing** key — it does not accept an explicit `null`. An event carrying e.g. `"tip_chips": null` failed to deserialize and aborted the whole event stream: ``` invalid type: null, expected a sequence ``` Fixed by deserializing these through `serde_utils::null_as_default` so `null` maps to an empty list: - `tip_chips` — on the node / subagent / agent-tool `*_started` payloads - `WorkflowFinishedPayload.process_data` - `SubagentStartedPayload.tools` Added a unit test covering `null` for each.
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.
Problem
A streamed AI Agent conversation aborts mid-run with:
when the server sends an explicit
"outputs": nullon aworkflow_finishedevent (observed on resumed/continued conversations).Root cause:
WorkflowFinishedPayload.outputs(and the siblingNodeToolUseFinishedPayload.outputs,SubagentFinishedPayload.outputs) were annotated#[serde(default)].serde'sdefaultonly fills a missing key — it does not accept an explicitnull, sonullfails to deserialize into the struct and the whole event stream errors out.Fix
Deserialize these three fields through the existing
serde_utils::null_as_default, mappingnullto the type'sDefault. This mirrors how siblingnulllists (e.g.Interrupt.questions/interactions) are already handled.Added a unit test covering both
"outputs": nulland a missingoutputskey.