async fn run_pty_output_flusher(
rx: Receiver<PtyReadChunk>,
broker: Option<Arc<Broker>>,
block_id: String,
filestore: Option<Arc<FileStore>>,
is_agent: bool,
)Expand description
Drain rx, coalescing into batches whatever is already queued at the
moment each batch is assembled — never waiting on output that has not
arrived, and bounded by PTY_COALESCE_MAX_BYTES — then flushing each
batch through flush_pty_batch. Runs until rx closes
(the PTY read loop’s sender dropped, i.e. the PTY hit EOF or an error),
flushing any final partial batch before returning.
A standalone fn rather than inlined into its tokio::spawn call site so
it can be driven directly in a test with a synthetic channel and no real
PTY — see pty_output_flusher_tests below.