Repository navigation
[3834 by Claude Opus 5.5] Pi: live view and stored output parsing - #3856
Conversation
I've added live view and stored-output parsing for Pi runs. Each tool call now shows up with its result, assistant text and thinking stream as they arrive, and token usage adds up across responses. The new and nearby test suites pass, and API typecheck and lint pass. I haven't seen it work against a real running Pi task in the UI. Parser (`packages/api/services/redisOutputParserPi.ts`, new) - Routing: `parseLine` sends Pi records to the new parser before the Codex, OpenCode and Antigravity checks. That ordering matters: a Pi assistant `message_end` would otherwise pass for an OpenCode message. Records only count as Pi's if they have Pi's shape (e.g. a `session` needs a numeric `version` and an `id`; `tool_execution_*` needs a `toolCallId`), so other agents' records are left alone. - Streaming text: deltas are buffered per `contentIndex` and shown as the pending message while they stream. `text_end`/`thinking_end` replaces the buffer with the final content, and thinking is marked as reasoning. `message_end` fills in any block that never got an end event; a block that already ended isn't repeated. A finished block keeps the ID it had while streaming, so the live view doesn't jump. - Tools: - Tool calls are emitted from the assistant `message_end` blocks, which carry the arguments, or from `tool_execution_start`, whichever comes first. - Pi reports each result three times (`tool_execution_end`, the `toolResult` message, `turn_end`). Only one result per call is emitted, with its error flag. - If a result arrives for a call that was never announced, a tool_use line is added first so they still pair up. - Also: - User prompts are not shown. - Usage comes from assistant `message_end` only. - An assistant stop with `error` or `aborted` shows Pi's error message. Wiring - Fix outside the issue's list: Pi's `agent_end.messages` contains messages keyed by role, which the whole-document Vibe transcript scan could claim, swallowing the Pi stream. Both `parseRedisOutput` and the live projector (`liveOutputStream.ts`) now skip that scan when the output contains Pi lines. A test covers it and fails without the guard. - Stored output: `liveDetailsStoredOutputFormat.ts` now detects a `'pi'` format, and the live-details routes parse it through the same parser via a new `parsePiOutputToConversationResult`. Without this, the live projector held Pi output back as unidentified preamble. - Task watcher: `taskWatcher.ts` now uses the Redis watcher for `pi` tasks. - Line splitting: output is split on LF only, as Pi's docs require. Tests - `test/redisOutputParser.test.ts`, the fixture regression test: the fixture gives four tool calls, and the three results pair with their calls (the `cat missing.txt` bash call is the one error). It also checks the final assistant text, and usage of 3,785 input and 229 output tokens. - Other new tests there: - delta buffering and the pending message. - the Vibe guard. - other agents' record shapes not being read as Pi. - stored-format detection, including a startup banner and CRLF line endings. - `packages/api/test/liveOutputPi.test.ts`: reading the stream one record at a time gives the same events and IDs as one full read. - Existing suites still green: redisOutputParser (Codex, OpenCode, Vibe 3, Antigravity), liveDetails (Antigravity, Codex DB fallback, OpenCode, completed persisted), liveOutput (stream, identity, retention), agentStreamProjection, the two taskWatcher suites, and the Codex app-server and Antigravity native goal suites. The trimmed fixture has one call with no result (`7Rc4Yw8fp`) and one result whose call isn't in it (`6UNoPXH4u`). The test checks that every result has a call before it, not that every call has a result. No preview images: the Pi live view reads from Redis, and there's no Redis server here to run the UI against a Pi stream. The preview manifest suggests adding one to the agent image. ProPR-Agent: claude/claude-opus-5-5
|
/ultrafix goal=8 max=8 |
|
🔄 Ultrafix loop started (goal: 8/10, max cycles: 8) First action:
|
|
✅ AI Code Review Complete requested by @propr-ultrafix Posted 1 review: |
🔍 AI Code Review — codex:gpt-6-astraOverall EvaluationThe PR adds Pi parsing across live streams, stored output, and task watching with a focused implementation. It needs a correction to tool-result identity after Redis retention before merge. ✅ Shared parsing path — Stored Pi output and live output use the same parser, keeping tool extraction and usage aggregation consistent. ✅ Streaming continuity — Completed text and thinking blocks preserve their pending event keys and timestamps during uninterrupted streaming. ✅ Duplicate suppression — Per-call tracking suppresses Pi’s repeated results while the same parser state survives. The supplied current-head status has no failed checks and five pending checks. This review used static analysis only; no commands were run. Merge blockersEvery finding below was introduced by this PR and must be resolved before merging. F1: 🔴 Preserve result identity after retention
SuggestionsThese are optional follow-ups and are not sent to S1: 🟢 Exercise the watcher-to-UI pathA Redis-backed integration test covering a pending Pi message, its completion, and a tool result would strengthen confidence in the new watcher wiring. The supplied tests cover parser and projector behavior, while the implementation summary explicitly notes that a running Pi task was not observed in the UI. This additional integration coverage is optional. ScoreThe implementation covers the main parsing requirements and includes useful focused tests. The verified retention identity defect prevents merge readiness; the pending checks are not themselves blockers. Score: 6/10 🤖 Review Details
Copy and edit to choose records from this review: 🤖 Review by ProPR |
|
✅ Applied the requested follow-up changes in commit 1ac83c7
Summary of ChangesI fixed F1: a Pi tool result now gets the same live ID whether it comes from The fix (
Other Pi events. I checked the rest of the Pi parser for the same problem and found none:
Regression test (
One difference remains: in the fresh read, the result's timestamp is the Verification:
There's no preview, since nothing on screen changes beyond the duplicate no longer appearing. Review digestRisk-tiered paths
Diff size: 2 files changed, +63/−7 lines 🤖 Implementation Details
💡 ProPR Slash Commands
🤖 Generated by ProPR |
I fixed F1: a Pi tool result now gets the same live ID whether it comes from `tool_execution_end` or from a copy Pi repeats later. That holds for a long-running watcher and for a fresh read after Redis trimmed the earlier record, so the UI no longer shows the same result twice. **The fix** (`packages/api/services/redisOutputParserPi.ts`, `emitToolResult`) - The result's ID used to come from the byte offset of whichever record emitted it. It now comes from the tool-call ID, so all three of Pi's copies (`tool_execution_end`, the `toolResult` message, `turn_end`) give the same ID. - Skipped repeat copies no longer reserve a numbered slot in their record. A slot only matters for events numbered by position, and results no longer are, so watcher and fresh read can't disagree about it. - Nothing changes for other agents: `withIds` and the ID scheme in `liveOutputStream.ts` are untouched. **Other Pi events.** I checked the rest of the Pi parser for the same problem and found none: - Tool calls already take their ID from the call ID. - Text, thinking and error-stop events are each emitted from only one kind of record, so trimming can't change which copy a reader sees first. **Regression test** (`packages/api/test/liveOutputPi.test.ts`) - A call is followed by its `tool_execution_end`, `toolResult` message and `turn_end`. The test compares a record-by-record watcher, a full read, and a fresh read that starts at the `toolResult` message after earlier output was trimmed. - It checks that each read has exactly one result, that the result's ID is the same in all three, and that every event in the trimmed read matches one the watcher emitted. - With the fix removed, the test fails on the ID assertion. One difference remains: in the fresh read, the result's timestamp is the `toolResult` message's own, about a second later than the watcher's, because `tool_execution_end` carries none. The call event that read adds before its result has the tool name but not the arguments. Both are under the same IDs, so they don't cause duplicates, and the test allows for them. **Verification:** - The Pi, live-output and live-details suites plus `test/redisOutputParser.test.ts`: 126 tests, 109 passed, 0 failed, 17 skipped. - API typecheck and lint on the changed files both pass. There's no preview, since nothing on screen changes beyond the duplicate no longer appearing. PR: #3856 Comment by: @propr-ultrafix (ID: 0) Model: Claude Opus 5.5 ProPR-Agent: claude/claude-opus-5-5
|
✅ AI Code Review Complete requested by @propr-ultrafix Posted 1 review: |
🔍 AI Code Review — codex:gpt-6-astraOverall EvaluationThe PR adds Pi parsing across live streaming, stored output, and task watching. It needs a localized correctness fix before merge: assistant event identities are not stable across Redis retention. ✅ Tool-result deduplication — Repeated results are suppressed by call ID, and result keys remain stable when retention leaves a later copy. ✅ Shared parsing path — Stored Pi output uses the same parser as live output, including usage accumulation and reasoning classification. ✅ Focused coverage — Tests cover fixture parsing, incremental reads, and retained tool results. Current checks report 15 passed, with no failures or pending checks. Merge blockersEvery finding below was introduced by this PR and must be resolved before merging. F2: 🔴 Preserve assistant identities across retention
SuggestionsThese are optional follow-ups and are not sent to S2: 🟢 Exercise stopped-message diagnosticsThe new stopped-message branch has no direct coverage in the supplied tests. A small test for ScoreThe implementation is focused and current checks pass, but retained assistant output can acquire new identities and duplicate visible narration. The tool-result retention coverage provides a useful pattern for closing this gap. Score: 6/10 🤖 Review Details
Copy and edit to choose records from this review: 🤖 Review by ProPR |
|
✅ Applied the requested follow-up changes in commit 3495365
Summary of ChangesI fixed F2. Pi assistant text and thinking now keep the same live ID whether a reader watched the stream without interruption or started fresh after Redis retention trimmed earlier records. The UI should no longer show the same narration twice. The fix (
Tests
Verification
There's no preview, since nothing on screen changes beyond the duplicate no longer appearing. Review digestRisk-tiered paths
Diff size: 3 files changed, +92/−13 lines 🤖 Implementation Details
💡 ProPR Slash Commands
🤖 Generated by ProPR |
I fixed F2. Pi assistant text and thinking now keep the same live ID whether a reader watched the stream without interruption or started fresh after Redis retention trimmed earlier records. The UI should no longer show the same narration twice. **The fix** (`packages/api/services/redisOutputParserPi.ts`) - **New key:** each text or thinking block is keyed by its message's timestamp and its `contentIndex`, instead of the byte offset of whichever record emitted it. I checked Pi's source (pi-ai / pi-agent-core 0.73.1): the provider stamps an assistant message once when it starts streaming, and `message_end` carries that same message object. So `message_start` and `message_end` always give the same key, and so does the block's own `text_end` or `thinking_end` in between. - **Pending message:** while a block streams it uses that same key, so the finished block still keeps the ID it had while streaming. - **Reader that missed `message_start`:** it can't know the key, so it no longer emits a block at `text_end`/`thinking_end`, or when the next block starts. It keeps showing the block as the pending message and emits it at `message_end`, under the same key and timestamp the watcher used. - **Slots:** blocks with a key no longer reserve a numbered slot in the `message_end` record. This keeps the later "Pi stopped (error)" event's ID the same across readers. - **Fallback:** if an assistant message has no timestamp, the old record-offset behaviour applies unchanged. **Tests** - **New test in `packages/api/test/liveOutputPi.test.ts`:** a message with a thinking block, a text block and an error stop is read four ways, besides the record-by-record watcher. A full read, and fresh reads starting at a thinking delta, at `thinking_end`, at `text_end` and at `message_end`. Each read must match the watcher's events exactly, IDs and timestamps included. The test also checks that each completed block keeps its streaming ID. It fails on the previous parser. - **Changed existing test** in `test/redisOutputParser.test.ts`: it gave `message_start` and `message_end` different timestamps, which Pi never does. I made them match, and updated the expected pending key to the new block key. **Verification** - The live-output and live-details suites: 105 tests, 88 passed, 0 failed, 17 skipped. - `test/redisOutputParser.test.ts`: 22 passed. - API typecheck and lint both pass. There's no preview, since nothing on screen changes beyond the duplicate no longer appearing. PR: #3856 Comment by: @propr-ultrafix (ID: 0) Model: Claude Opus 5.5 ProPR-Agent: claude/claude-opus-5-5
|
✅ AI Code Review Complete requested by @propr-ultrafix Posted 1 review: |
|
🔀 Resolved merge conflicts from Conflicting Files
Resolution SummaryI resolved the one conflict, in What the conflict was about: both branches made the same change to the check that decides which agent types get the Redis watcher instead of tailing a log file on the host. Each added // Pi sessions live in each run's disposable agent dir: the host dir has nothing to tail.The PR side had the same line without the comment, so Git flagged the comment as a conflict. How I resolved it: I kept the shared Why: there was no real disagreement about the code, because both sides route Pi tasks to the Redis watcher. The comment explains why that's necessary, and keeping it brings in the target branch's update without changing what the PR does. Verification: running the TypeScript compiler ( 🤖 Resolution Details
System-triggered merge conflict resolution |
Automatically resolved merge conflicts after merging target branch into PR branch. Resolved conflicts in: - packages/api/services/taskWatcher.ts PR: #3856 Model: Claude Opus 5.5
|
CI failed: Validate Changes Please investigate and fix this CI failure.
Failure evidence
|
Checks FailedValidation failed during setup, tests, CLI packaging, linting, or build checks. View Logs |
|
✅ Applied the requested follow-up changes in commit b44b8d5 Processed 2 comments:
Summary of ChangesI fixed the Validate Changes failure: the Core source build and the API build both pass again. Cause: When the epic branch was merged into this PR, Fix: I kept the epic's version and deleted this PR's duplicate, plus its What changes for this PR: Saved Pi output is no longer read by the same parser as the live view. Reading the stream one record at a time still gives the same events as one full read, but that test only covers the live-view parser. Checks run:
This is a backend build fix with nothing visible to a user, so there are no preview images. Review digestRisk-tiered paths
Diff size: 1 file changed, +0/−14 lines 🤖 Implementation Details
Undo Changes • View Task Execution 💡 ProPR Slash Commands
🤖 Generated by ProPR |
I fixed the Validate Changes failure: the Core source build and the API build both pass again. **Cause:** When the epic branch was merged into this PR, `packages/api/routes/liveDetailsOutputParsers.ts` ended up with two exported functions named `parsePiOutputToConversationResult`. The epic's version uses core's `parsePiConversationLog`; this PR's version used the Redis live-view parser. TypeScript rejects the duplicate, so both builds failed. **Fix:** I kept the epic's version and deleted this PR's duplicate, plus its `parseRedisOutput` import, which nothing else in the file used. The epic's version names MCP tools `<server>/<tool>` and lists the calls a `codemode` script makes as their own tool events, and its tests in `packages/api/test/liveDetailsPiParser.test.ts` check for exactly that. The live-details route still sends `'pi'` stored output to this function. **What changes for this PR:** Saved Pi output is no longer read by the same parser as the live view. Reading the stream one record at a time still gives the same events as one full read, but that test only covers the live-view parser. **Checks run:** - The repo build and the `packages/api` typecheck pass after rebuilding shared and core. - These test suites pass: `liveDetailsPiParser`, `liveOutputPi`, `test/redisOutputParser` and the `liveDetails*` suites. - ESLint passes on the edited file with zero warnings. This is a backend build fix with nothing visible to a user, so there are no preview images. PR: #3856 Comment by: @propr-dev[bot] (ID: 7227181093) Comment by: @github-actions[bot] (ID: 7227181488) Model: Claude Opus 5.5 ProPR-Agent: claude/claude-opus-5-5
🔍 AI Code Review — codex:gpt-6-astraOverall EvaluationThe PR adds Pi streaming projection, tool-result deduplication, usage accumulation, and format detection. It needs a localized correction before merge: a watcher joining after retention can publish the same assistant block under two different IDs. ✅ Tool-result deduplication — All three Pi result representations converge on a call-keyed result, with a synthesized tool-use event when necessary. ✅ Retention regression coverage — Tests compare completed events across uninterrupted, full, and retained reads, including reasoning blocks and errors. The supplied current-head status reports no failed checks and three pending. This review used static analysis only; no commands were run. Merge blockersEvery finding below was introduced by this PR and must be resolved before merging. F3: 🔴 Retained streaming blocks change identity
SuggestionsThese are optional follow-ups and are not sent to S3: 🟢 Compare live and stored parser semanticsThe new parser duplicates some tool, content, and usage handling already present in the core Pi parser used by stored-output routes. Shared fixtures comparing both paths would help prevent drift, particularly for nested calls and readable MCP tool names. This is optional maintenance work; separate streaming state is justified, and the supplied excerpts do not establish another concrete regression. ScoreThe implementation has useful coverage and no reported current check failures, but the retained-stream identity defect can leave duplicate narration in the live UI. The correction should be localized. Score: 6/10 🤖 Review Details
Copy and edit to choose records from this review: 🤖 Review by ProPR |
|
✅ Applied the requested follow-up changes in commit 3216091
Summary of ChangesI fixed F3: a Pi text or thinking block no longer shows up twice in the live view when a watcher starts reading after retention has trimmed that message's The fix ( Same defect elsewhere: the only place the Pi parser shows a pending block is Regression test ( Trade-off: when a watcher joins a message part-way through, that message's text stays hidden until it finishes, instead of streaming in from the first retained delta. Messages the watcher sees from their start stream exactly as before. Verification:
I didn't capture a preview: the change is visible in the live view, but there's no Redis server here to run the UI against a trimmed Pi stream. The manifest suggests adding Review digestRisk-tiered paths
Diff size: 2 files changed, +50/−8 lines Visual previewSuggested agent tools
🤖 Implementation Details
💡 ProPR Slash Commands
🤖 Generated by ProPR |
|
F1, F2 and F3 are three cases of one design gap: live event IDs depend on where a reader starts in the Redis stream. Each fix closed one case and the next review found another. Please fix the whole class in one change: ID rule: derive every live event ID only from data carried by the record itself. Never use parse order, counters or "first seen" state.
One test covering all cases: take the real stream fixture (
Also combine an incremental read (lines This replaces the one-off F1/F2/F3 regressions, which can stay, and should stop further identity findings of this kind. |
I fixed F3: a Pi text or thinking block no longer shows up twice in the live view when a watcher starts reading after retention has trimmed that message's `message_start`. **The fix** (`packages/api/services/redisOutputParserPi.ts`, `processMessageUpdate`): while the parser doesn't know which message a block belongs to, it keeps buffering the deltas but no longer shows them as the pending message. Before, the block was shown under the offset of the delta record, and `message_end` then emitted it under `pi:block:<timestamp>:<index>`. `appendUniqueEvents` treated that as a new event, so the UI showed both. Now the first time the block appears is at `message_end`, under its block key, the same as a full read. When the message identity is known, the block still streams under its block key and keeps that ID when it completes. **Same defect elsewhere:** the only place the Pi parser shows a pending block is `processMessageUpdate`. The fix also covers a `message_start` that has no timestamp, which hit the same duplicate before. With pending blocks now always keyed, the branch that dropped an unkeyed earlier block on a block switch couldn't run any more, so I removed it. I also reworded one doc comment on `emitBlock` to match. **Regression test** (`packages/api/test/liveOutputPi.test.ts`): a watcher's first read starts at a delta (or at `thinking_end`, or mid-text-delta) and stops before `message_end`. The test checks that nothing is published and nothing is pending. It then feeds `message_end` as a separate read and checks that the completed blocks come out under the same IDs a full read gives, with no ID repeated. Against the HEAD parser it fails at "the read from record 3 publishes no unidentified block"; with the fix it passes. **Trade-off:** when a watcher joins a message part-way through, that message's text stays hidden until it finishes, instead of streaming in from the first retained delta. Messages the watcher sees from their start stream exactly as before. **Verification:** - `liveOutputPi` passes, 4 of 4. - `test/redisOutputParser.test.ts` passes, 22 of 22. - `liveDetailsPiParser`, `liveOutputIdentity`, `liveOutputRetention`, `liveOutputStream` and `agentStreamProjection` all pass. - API `tsc --noEmit` and eslint with `--max-warnings 0` on the changed files are clean. - `liveOutputTimestamps` ran 0 tests because it needs a real Redis server. I didn't capture a preview: the change is visible in the live view, but there's no Redis server here to run the UI against a trimmed Pi stream. The manifest suggests adding `redis-server` to the agent image. PR: #3856 Comment by: @propr-ultrafix (ID: 0) Model: Claude Opus 5.5 ProPR-Agent: claude/claude-opus-5-5
|
✅ AI Code Review Complete requested by @propr-ultrafix Posted 1 review: |
|
✅ Applied the requested follow-up changes in commit 2e29174 Summary of ChangesEvery Pi live event ID now comes only from data in the record itself, and one test checks every start line of each stream. The new and existing Pi tests pass, along with the nearby live-output and live-details suites, API lint ( The fix (
The test (
For every start line Three caveats:
Not run: 17 tests in the neighbouring suites were skipped because they need a running Redis server, which this container doesn't have; they only cover other agents' streams. I made no preview images, because this change has no visible effect in the UI. Review digestRisk-tiered paths
Diff size: 3 files changed, +239/−48 lines 🤖 Implementation Details
Undo Changes • View Task Execution 💡 ProPR Slash Commands
🤖 Generated by ProPR |
Every Pi live event ID now comes only from data in the record itself, and one test checks every start line of each stream. The new and existing Pi tests pass, along with the nearby live-output and live-details suites, API lint (`--max-warnings 0`) and API typecheck. **The fix** (`packages/api/services/redisOutputParserPi.ts`) - **Tool calls and results:** both are keyed by `toolCallId`. The parser no longer uses per-record slot numbers, so how many earlier copies a read saw can't shift an ID. - **Text and thinking blocks:** keyed by message identity plus `contentIndex`. The identity is `message.timestamp`, falling back to `responseId` only when there's no timestamp. I put the timestamp first because the captured fixtures reuse `responseId: "c1"` for every message, so `responseId` alone would collide. - **Deltas before the identity is known:** they stay buffered and unpublished until `message_end`, which publishes each block once under its final ID. When the identity is known, `text_end`/`thinking_end` publish the block under the ID it streamed under, and `message_end` doesn't add a second copy. - **Two more start-dependent paths, now removed:** - If a new block or a new message started before the previous block ended, the parser used to publish that block's partial text. Its content then depended on how many deltas a read had seen. Now the block stays buffered until `message_end` supplies the final text, and a message that never ends is not published. - The "Pi stopped (error)" note is now keyed by its message identity instead of its position in the record. **The test** (`packages/api/test/liveOutputPi.test.ts`) runs on three streams: - the captured `pi-1.6.1-json-tool-task.jsonl`. - a new fixture, `test/fixtures/pi/pi-1.6.1-json-streamed-blocks.jsonl`, with several thinking and text deltas, a tool call, and an error stop. I built it by hand from the shapes in the 1.6.1 captures; it is not a real capture. - an irregular stream: a block starting before the previous one ended, a message that never ends, and one without a timestamp. For every start line `i`, it checks your three conditions. It also feeds lines `0..k` to a line-by-line watcher, merges the result with a read from every `j ≤ k`, and checks that nothing appears under two IDs. The F1/F2/F3 regressions are still there. Three caveats: - **"A tool result's ID equals its call's ID":** I read this as both IDs derived from the same `toolCallId` (`…:tool_use:external:<id>` and `…:pi:tool_result:<id>:0`). Making them literally the same string would break your "no ID appears twice" rule, since a call and its result are separate events. The test checks that both extract to the result's `toolUseId`. - **The old parser passes on both real fixtures.** After F1–F3 it was already consistent on those streams; only the irregular stream makes it fail, at line 2. The new parser passes all three. - **Unstamped messages:** in the irregular stream, a message with no timestamp shows the time of the last stamped record, which depends on where the read started. Its ID and text are stable, so the test skips the time check for that stream only. Pi stamps every message, so this doesn't come up with real output. Not run: 17 tests in the neighbouring suites were skipped because they need a running Redis server, which this container doesn't have; they only cover other agents' streams. I made no preview images, because this change has no visible effect in the UI. PR: #3856 Comment by: @integry (ID: 7227626300) Model: Claude Opus 5.5 ProPR-Agent: claude/claude-opus-5-5
🔍 AI Code Review — codex:gpt-6-astraOverall EvaluationThe PR adds Pi streaming projection with buffered text and reasoning, paired tool events, and accumulated usage. It is merge-ready within the reviewed scope, conditional on the remaining test shard passing. ✅ Stable event identities — Tool events use call IDs, while assistant blocks use message identity and content index. The added tests cover incremental reads and retention boundaries. ✅ Duplicate result suppression — Results repeated through execution events, tool-result messages, and turn-end records share a deduplication set. ✅ Transcript routing protection — Both batch parsing and live projection bypass the Vibe transcript scan when Pi records are detected. This review used static tracing of the supplied code; no commands or tests were run. The authoritative current checks report no failures, with one test shard pending. Merge blockersNo merge blockers. SuggestionsThese are optional follow-ups and are not sent to S4: 🟢 Align live tool-name presentationThe new parser’s S5: 🟢 Share small protocol helpers
ScoreThe implementation covers the principal streaming and retention invariants with substantial targeted tests. Static review found no verified merge blocker, and current checks have no failures. Score: 8/10 🤖 Review Details
Copy and edit to choose records from this review: 🤖 Review by ProPR |
AI Implementation Summary
Closes #3834
Branch:
3834/claude-opus-5-5-pi-live-view-and-stored-o-20261127-1852-8kcCommits: ✅ Changes committed (6589d47)
AI Processing Completed
Execution Details:
Summary:
I've added live view and stored-output parsing for Pi runs. Each tool call now shows up with its result, assistant text and thinking stream as they arrive, and token usage adds up across responses. The new and nearby test suites pass, and API typecheck and lint pass. I haven't seen it work against a real running Pi task in the UI.
Parser (
packages/api/services/redisOutputParserPi.ts, new)parseLinesends Pi records to the new parser before the Codex, OpenCode and Antigravity checks. That ordering matters: a Pi assistantmessage_endwould otherwise pass for an OpenCode message. Records only count as Pi's if they have Pi's shape (e.g. asessionneeds a numericversionand anid;tool_execution_*needs atoolCallId), so other agents' records are left alone.contentIndexand shown as the pending message while they stream.text_end/thinking_endreplaces the buffer with the final content, and thinking is marked as reasoning.message_endfills in any block that never got an end event; a block that already ended isn't repeated. A finished block keeps the ID it had while streaming, so the live view doesn't jump.message_endblocks, which carry the arguments, or fromtool_execution_start, whichever comes first.tool_execution_end, thetoolResultmessage,turn_end). Only one result per call is emitted, with its error flag.message_endonly.errororabortedshows Pi's error message.Wiring
agent_end.messagescontains messages keyed by role, which the whole-document Vibe transcript scan could claim, swallowing the Pi stream. BothparseRedisOutputand the live projector (liveOutputStream.ts) now skip that scan when the output contains Pi lines. A test covers it and fails without the guard.liveDetailsStoredOutputFormat.tsnow detects a'pi'format, and the live-details routes parse it through the same parser via a newparsePiOutputToConversationResult. Without this, the live projector held Pi output back as unidentified preamble.taskWatcher.tsnow uses the Redis watcher forpitasks.Tests
test/redisOutputParser.test.ts, the fixture regression test: the fixture gives four tool calls, and the three results pair with their calls (thecat missing.txtbash call is the one error). It also checks the final assistant text, and usage of 3,785 input and 229 output tokens.packages/api/test/liveOutputPi.test.ts: reading the stream one record at a time gives the same events and IDs as one full read.The trimmed fixture has one call with no result (
7Rc4Yw8fp) and one result whose call isn't in it (6UNoPXH4u). The test checks that every result has a call before it, not that every call has a result.No preview images: the Pi live view reads from Redis, and there's no Redis server here to run the UI against a Pi stream. The preview manifest suggests adding one to the agent image.
Review digest
Risk-tiered paths
packages/api/routes/liveDetailsOutputParsers.ts(+14/−0)packages/api/routes/liveDetailsRoutes.ts(+2/−1)packages/api/routes/liveDetailsStoredOutputFormat.ts(+4/−1)packages/api/services/liveOutputStream.ts(+4/−1)packages/api/services/redisOutputParser.ts(+10/−2)packages/api/services/redisOutputParserPi.ts(added, +328/−0)packages/api/services/taskWatcher.ts(+1/−1)packages/api/test/liveOutputPi.test.ts(added, +38/−0)test/redisOutputParser.test.ts(+147/−0)Diff size: 9 files changed, +548/−6 lines
View task for the run's logs and conversation.
This PR was created automatically by ProPR after processing issue #3834.
💡 Need changes?
Comment on this PR to request refinements — the AI agent monitors comments and will update the implementation based on your feedback. Keep iterating until you're satisfied!
Visual preview
Suggested agent tools