Persistent agent stdout appears block-buffered, so session JSONL events can lag behind actual execution. Repro from omni-coder:
1) agentd send omni-coder --mode persistent "Run exactly one command with run_bash: echo health-check-ok..."
2) Checkpoint (~/.local/state/agentd-agents/checkpoints/omni-coder/session-latest.json) updates immediately and shows tool output.
3) agentd logs omni-coder --mode persistent --last N may show older events for minutes, and current turn may only appear as a trailing agent_start line.
Evidence suggests event writes are not flushed line-by-line from agent (JSONL writer uses BL.putStr + newline without hFlush), so data remains in process buffer when running under systemd/pipe/tee.
Impact:
agentd logs/watch/top appear stale even when turns completed.Proposed fix:
Omni/Agent.hs (emitTraceEvent + emitRunResult), or make stdout line-buffered explicitly for JSON mode.
Fixed in commit 70daf843.
Changes:
splitCompleteJsonlLinesnow keeps a trailing line when it is valid JSON even if file lacks final newline.agentd logs --last ...from hiding freshest valid event at EOF.hFlush) after each JSON trace event and JSON result line.Verification:
Runtime smoke on omni-coder:
echo after-flush-fixviaagentd send ...agentd logs omni-coder --mode persistent --last 10now immediately showed infer/tool/result events and completion.