fix-pi-clean-live-log

Fix blank Pi cleaned live log views

Metadata

Statusabandoned
Assignedagent-1108
Agent identity8b579312a7ee512b4a8484518eff16ecdb36de1c9cf52fdb5e7f566586fa5d18
Modelpi:openai-codex:gpt-5.6-sol
Created2026-08-05T07:23:45.454052547+00:00
Started2026-08-05T07:24:00.715875437+00:00
Tokens4038846 in / 15056 out
Failure reasonImplementation landed as equivalent commit b2839707 and shipped in PR #61; restored pre-merge graph state cannot receive a legacy completion bypass, so retain history as explicitly superseded rather than respawn source work.

Description

Pi live cleaned Log views go blank during long tool executions even though Raw works. Native pi --mode json emits cumulative tool_execution_update records. The structured parser deliberately drops every update, while the bounded EOF loader retains only the newest 200 records. Once a command emits >200 updates, its tool_execution_start and prior finalized events fall outside the window and every retained record is filtered, producing an empty clean view. Live canonical stream.jsonl is also absent because pi-stream-bridge writes it only after exit. Current evidence: agent-1107 raw_stream grew past 54MB in ~22m with 378 update records while Events/HighLevel/Pretty had no meaningful live projection.

Implement a bounded, stateful Pi live projection: coalesce cumulative updates by toolCallId and expose the latest running tool/progress in Events, HighLevel, and Pretty without JSON or update spam. Preserve byte-exact Raw mode. Ensure start/update/end replacement is deterministic across initial reverse-tail, incremental append, source rotation, attempt switching, and auto-tail. Avoid duplicating the native raw stream into output.log for Pi if stderr/failure evidence remains intact, so cumulative updates do not consume disk twice.

Validation

  • Fixture with >200 consecutive Pi tool_execution_update records and the start outside the 1MiB/200-record tail still renders the current tool plus latest bounded progress in Events, HighLevel, and Pretty.
  • Repeated cumulative updates coalesce to one live event; tool_execution_end replaces it with one final result.
  • Incremental appends, reverse-tail, rotation, attempt switching, and scroll-up do not duplicate, blank, or reset unrelated events.
  • Raw mode remains byte-for-byte faithful.
  • Pi stdout is retained exactly once while stderr remains diagnosable and failure classification/accounting still work.
  • Add regression tests and run targeted TUI tests, cargo fmt --check, and cargo clippy.

Depends on

Required by

Messages 2 messages

  1. #1user2026-08-05T07:25:10.834400613+00:00read
    SCOPE CORRECTION FROM USER: do not invent a separate Events/HighLevel-style Pi projection as the primary fix. The desired cleaned Log rendering is the same transcript presentation used by the Pi chat view: assistant prose/thinking/tool call/result formatting, live streaming updates, and the same coalescing behavior. Reuse/extract the existing Pi chat transcript renderer/model rather than maintaining a second parser/formatter. Raw remains an explicit diagnostic mode. Add a parity regression proving the same Pi fixture renders equivalently in chat and task Log (allow only pane chrome differences). Still avoid raw stdout duplication if separable, but rendering parity is the requirement.
  2. #2user2026-08-05T08:17:33.561850258+00:00read
    USER REQUIREMENT (must address before completion): the cleaned task Log must render like the embedded Pi chat view—assistant markdown, thinking, tool calls/results, and live in-place updates—not merely an Events/HighLevel progress projection. Reuse/extract the chat presentation contract where feasible; Raw stays diagnostic. Add chat-vs-log visual parity regression (pane chrome may differ). Your current 8fe77789 is not accepted until this requirement is verified.

Log