#
What's wrong with this entry?
- Stream-json verbose mode now flushes buffered output at startup. When running with
--output-format stream-jsonand--verbosetogether, any messages queued before the session writer was ready are now delivered immediately on initialization. Previously these early messages could be lost. - Trigger condition:
xAb(the headlessrunHeadlessentry point) evaluatesl.outputFormat === "stream-json" && Boolean(l.verbose)(line ~884408) and, when true, callsFdf(y)whereyis the SDK session writer object (ednfor local runs,Cgrfor--sdk-urlruns) created byPAb(). - Buffer mechanics: Before the forwarder is registered,
system-typed messages emitted via the internaloH()function accumulate in a per-session in-memory map (fWn). Buffering only occurs in non-interactive mode (Cn()returns!Rt.isInteractive) or when the REPL bridge is active (hx()returnsRt.replBridgeActive). The buffer is capped at 1,000 entries (PGh = 1000); when full, the oldest non-task_started/non-task_notificationmessage is evicted first; if all remaining entries are task events, the oldest one is evicted. - Message types buffered: Any
type: "system"event dispatched tooH()before registration — including subtypestask_started,task_updated,task_notification,task_progress,hook_started,hook_progress,hook_response,notification, andpost_turn_summary. - Flush implementation (
Fdf, line ~884227): Creates a flush callbacktthat callslse()to destructively drain the current session's buffer (viaArray.splice(0)), stamps each message with a freshcrypto.randomUUID()and the currentsession_id, then writes them one-by-one to the SDK writer viae.write(r).catch(() => {})(write errors are silently discarded). - Persistent forwarding: After the initial flush,
a3e(t)registerstas the global notify callback (Iqc = t). SubsequentoH()calls invokeIqc?.()immediately after pushing to the buffer, so all future system messages are forwarded without delay for the remainder of the process lifetime. The callback is not cleaned up after startup (unlike the interactive TUI path which calls() => a3e(null)on unmount). - Evidence:
Fdf/registerStartupSdkEventForwarderat line ~884227; call site guard at line ~884408; buffer/notify logic inoH/lse/a3eat lines ~275762–275784; buffer capPGh = 1000at line ~275808.