Skip to content

fix(native-chat): render the terminal-backed chat through the structured chat's turn status - #22090

Merged
brennanb2025 merged 15 commits into
mainfrom
brennanb2025/native-chat-show-agent-state
Sep 29, 2026
Merged

brennanb2025 merged 15 commits into
mainfrom
brennanb2025/native-chat-show-agent-state

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 25 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​1174 $\color{#cf222e}{\Huge{\mathbf{−}}}$​227 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​947
Prod 40 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​419 $\color{#cf222e}{\Huge{\mathbf{−}}}$​171 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​248

What was wrong

A native chat pane backed by an agent's terminal could not tell you what its agent was doing. This lane is permanent: grok and omp only ever use it, and Claude and Codex fall back to it whenever the structured chat is refused (remote host, reused terminal, floating workspace, launch-command override, WSL).

  • While the agent worked you got three bouncing dots and no elapsed time; for omp even the dots vanished during every tool call. The structured chat shows "Working for 1m 12s" under your prompt and a "Working…" spinner line at the end of the transcript.
  • When the agent stopped on a permission prompt that only its terminal showed, the chat showed nothing at all, so a stuck agent looked exactly like an idle one.
  • When the agent stopped on a question, the question's row read "Asked: …" as if it had been answered, while the agent was still waiting for you.
  • Finished turns never showed "Worked for N" and never folded their steps, unlike the structured chat.

Why: the pane opted out of the structured chat's turn-status UI with showTurnStatus={false}. That one flag swapped in the dots, dropped the working clock, and switched tool rows to older chrome. The pane also never read the hook's waiting/blocked state, so while the agent waited it treated the turn as over. And nothing recorded when a terminal agent's turn began, so there was nothing to count from.

Scope: the terminal-backed native chat pane on desktop (and paired desktop clients). The structured chat looks and behaves exactly as before. Mobile is unchanged. Sidebar, worktree ps and notifications read the same status row and are unchanged.

What you see now

Before, on origin/main: a grok chat whose agent is blocked on a permission prompt shown only in its terminal. The pane shows nothing to say it is waiting.

  • Working: the same "Working for 1m 12s" bar under your prompt and the same "Working…" spinner line as a structured chat, counted from when the agent's turn began. The clock survives switching the pane to its terminal and back, and a window reload.
  • Waiting on a question the pane shows as a card: the card appears, the bar keeps counting, and the spinner line goes away, the structured chat's own rule.
  • Waiting on a prompt only the terminal shows: an "Awaiting user input" row appears at the end of the transcript, so you know the agent is waiting on you.
  • A pending question row reads "Awaiting user input: " until it is answered, then "Asked: …".
  • A finished turn shows "Worked for 45s" with a caret that folds its steps, as in the structured chat, including after a reload.
  • Tool runs use the structured chrome: "Running 2 commands" while live, a category icon, and a check mark when done.

Live QA on a remote Mac, this PR's build: left, a terminal-backed grok chat (driven by a scripted grok stand-in that posts grok's real hook events and writes a grok-format transcript with no row timestamps, as real grok does); right, a real structured Claude chat, at the same moment.

Mid-turn: both lanes show "Working for 14s", "Running 1 command" and the "Working…" spinner line, and both composers show Stop.

Blocked on a question: both lanes draw the same question card, hide the spinner line and keep the bar counting at "Working for 50s". The grok row order here comes from the stand-in, which wrote a later tool row while the question was pending; real grok cannot.

Blocked on a permission: Claude draws its approval card; grok's prompt is only in its terminal, so the transcript ends with "Awaiting user input". Both bars read "Working for 1m 38s".

Finished, after a window reload: both lanes show "Worked for …" with the fold caret, and the steps stay folded.

omp, mid tool call: the newest transcript row is the timestamped tool call, and the pane still shows "Working for 29s", "Running 1 command" and the spinner (before this PR omp looked idle here).

How

One UI, two lanes. Both lanes pass the same props to NativeChatMessageList, which draws the same components for both: useNativeChatTurnStatus, NativeChatWorkingStatus (the "Working for / Worked for" bar and fold caret), NativeChatTurnActivityLine (the spinner line), NativeChatAwaitingInputRow, the turn fold, and the tool-run chrome. They lose only their lane switch. The terminal lane's facts come from one pure function, resolveNativeChatTerminalTurn, so the Send/Stop "generating" fact and the "turn running" fact cannot drift apart.

The host records when a turn began. The hook server (the execution host's agent-status store) now stamps turnStartedAt on the status row when the main agent's own turn opens: the prompt event each provider already classifies as a new turn (Claude and Codex UserPromptSubmit, grok user_prompt_submit, omp before_agent_start). Child-agent events, replays and identity-only rows never stamp it; a session start clears it; producers cannot declare it. It is carried across tools, waits and answers, persisted with the row, and delivered on the snapshot and live push to the renderer and paired clients. The pane's clock reads it. The latest turn's "Worked for" comes from the host too: the main agent's done time minus the turn start.

What each lane feeds in.

  • isWorking: the structured chat passes its running turn. The terminal lane passes "the agent is generating, or stopped mid-turn waiting on you", because a structured turn also keeps running behind its prompt card. Local Stop still ends it.
  • workingStartedAt: the structured chat passes its journal's turn start; the terminal lane passes the host's turnStartedAt.
  • settledTurns: the structured chat passes its journal's durations; the terminal lane passes durations derived from the transcript's own timestamps for older turns and the host's verdict for the latest one. If the host's row has gone quiet mid-turn (the store drops rows silent for 30 minutes), the latest turn gets no duration rather than a false "Worked for 30m".
  • awaitingInput (replaces showLiveTurnActivity): 'shown' when a prompt card on screen asks, 'unshown' when the agent waits on a prompt the pane cannot draw, null otherwise. The structured chat passes 'shown' while its card is up, exactly what showLiveTurnActivity={prompt === null} did.

Supporting changes.

  • The hook's waiting/blocked state is reconciled against the transcript's end-of-turn marker, the same rule the pane already applies to working, so an interrupt at a prompt (which fires no hook) does not leave "Awaiting user input" up.
  • An existing fallback settled a working pane whenever the newest transcript row was an assistant row written after the working state began; it stands in for a Stop hook the host can miss. omp writes a timestamped assistant row for every tool call and reports its own turn end reliably (retried until the host takes it), so the fallback is now off for omp. That is what made omp look idle during every tool call.
  • Deriving the interactive card moved into useNativeChatInteractivePromptCard, so the view can tell a wait the card answers from one it cannot; it reads the status row's tool name only while a prompt is pending, so tool calls do not re-render the pane.
  • The shared awaiting row reads "Awaiting user input" (no dangling colon) when it has no question to name, in both lanes (new key components.native-chat.ask.awaitingUnnamed, hand-added to fr, ja, ko and zh; es has no ask section).

Why this is better than the alternatives.

  • An earlier revision built a second waiting row beside the structured chat's and kept this lane on its own tool chrome through two flags. Now any change to the turn UI lands in both lanes because there is only one.
  • Review found that reconstructing a turn's start in the pane (from the state's own start time, then from a capped history of state changes matched by prompt text) broke in four separate ways: the clock restarted after answering in the terminal, a background task made a 5-second turn read "Working for 45m", the same prompt re-sent merged two turns, and a reload reset the clock. The host already knows exactly when a turn opens, so recording it there removes that whole class instead of adding a fifth rule. It is also the rule the status store's design follows: the execution host owns agent status, and readers keep only presentation.
  • Turn durations for older turns are derived from the transcript the agent already writes, not stored a second time.

Wire compatibility. turnStartedAt is one new optional field on existing shapes; nothing is moved or removed and no stream opcode changes. A host that predates it sends nothing, and the pane falls back to the current state's start (the clock then restarts after each wait, as the first version of this PR did). An older client ignores it. SSH relays need no change because the stamp is made in the desktop hook server.

What the terminal-backed chat still lacks

Identical in both lanes: the bar and its clock format, the spinner line, the prompt-pending rule, the awaiting row, the fold, and the tool-run chrome. Not identical, because this lane has no structured journal; in each case the shared UI degrades as it does for a structured turn missing the same fact:

  • No "Thinking" and no activity description in the spinner line; it always says "Working…".
  • grok's transcript rows carry no timestamps, so grok's older turns show no "Worked for" and do not fold; its latest finished turn does, from the host.
  • A paired client of a headless orca serve host does not receive the turn stamp yet, so there the clock falls back to the current state's start.
  • Over SSH the finished latest turn's duration subtracts a relay-host time from a desktop time, so it is off by the machines' clock skew; the live clock is not.
  • When the agent process exits, its status row is cleared, so the latest turn's "Worked for" bar goes with it; earlier turns keep theirs where the transcript has timestamps.
  • An omp run whose completion post is lost (an omp extension from before 09-19, or the host unreachable for more than about 2 seconds) keeps reading "Working" until omp's next event, its process exits, the shell returns to the foreground, or the row goes stale.
  • Whether a real grok permission prompt reaches the pane as a wait is unverified: grok's routine "tool permission requested" notification is deliberately ignored because grok sends it before every tool, and a real capture was not possible for this PR. grok questions (cards) and omp permission prompts are verified in code and by posting real-shaped events to the hook server.
  • Journal-only rows, not touched here: per-turn file-change rollups and resolved-prompt receipts ("Answered on ").

Deleted

Counts are git grep -c over src mobile tests config at origin/main and at this head.

  • showTurnStatus: 32 references on main, 0 here.
  • showLiveTurnActivity: 11 on main, 0 here (replaced by awaitingInput).
  • The structuredActivityUi prop on NativeChatMessageRow and NativeChatToolRun: always true once both lanes drew the structured chrome, so it and its off-branches are gone. Mobile's own prop of the same name is untouched.
  • native-chat-typing-indicator.ts, its test, and NativeChatTypingIndicatorRow.tsx (the three dots).
  • The test "keeps bridge chats on the legacy activity chrome" asserted the three dots and the old tool chrome, which this PR removes on purpose.

Evidence

  • Live Electron QA on a remote Mac (isolated profile and home, agent hooks on, never the real agent homes), three rounds. Final round on 702a784 (code-identical to this head, which only adds a test fix): mid-turn working, question card, terminal-only permission wait, switching the pane to its terminal and back mid-turn (the clock kept counting from the turn start), finished turn after a remount and after a reload, and an omp-shaped mid-tool check: all pass, matching the structured Claude chat beside it. Before-arm on origin/main: nothing shown while blocked on a terminal-only prompt, no "Worked for".
  • The grok and omp lanes in QA were driven by scripted stand-ins posting each agent's real hook events to the app's own hook server (real grok was out of quota). Transcript shapes were matched to real agents' session files (real grok rows carry no timestamps; real omp rows all do). An earlier round that timestamped grok rows produced a false "idle mid-turn"; that is the difference that led to the omp fix.
  • Host stamp: server-turn-started-at.test.ts posts real hook bodies over HTTP and through the SSH relay path: stamped on a new main-agent turn, carried across tools, waits and answers, not stamped by child events or replays, cleared by a session start, dropped when a finished agent reopens without a prompt event, not declarable by producers, and carried through the live push, persistence and hydration.
  • Renderer: remount and reload with no state history read "Working for 1m 30s"; background work holding the row open does not stretch a new turn; the same prompt re-sent is a new turn; an old host falls back to the state start; a stale waiting row shows no "Worked for" and no fold; a host-ended latest turn keeps its duration after a remount; a harness notice mid-turn does not fold a running turn; omp stays working while its newest row is a tool call.
  • Ablations: each rule was removed once with the tree restored after; every one turns a named test red (16 for the host stamp and plumbing, plus the waiting, card, awaiting-row, omp and notice rules).
  • tc:node and tc:web: clean. CI: all eight test shards, typecheck and verify pass on this head. oxlint, oxfmt, the changed-code quality gate, React Doctor and the localization checks pass. pnpm-lock.yaml is not in the diff.

Not in this PR

  • Composer gating. Send/Stop still follows "the agent is generating", so while the agent waits the composer shows Send; a question card still replaces the composer and an approval card sits above it. A message typed into the chat during a terminal-only prompt goes to the terminal as before.
  • The status store drops a row that has been silent for 30 minutes, and rows restored after an app restart are unconfirmed, so a wait that long reads as idle again (as on main, everywhere). Waits should not age out while the process lives; that is a store change for a follow-up.
  • Pressing Esc at a permission prompt fires no hook and the host does not infer an interrupt for it, so the sidebar and mobile can keep showing "waiting" while this pane (which reads the transcript) shows the turn ended. Host interrupt inference for permission waits is the follow-up that fixes every reader.
  • The "this pane's agent has exited" verdict, and the message-delivery half of STA-6980.
  • Mobile, which renders its own list and is unchanged.

Addresses the agent-state half of STA-6980 and STA-6222's elapsed-time and no-false-running criteria on this lane.

@coderabbitai

coderabbitai Bot commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

The change replaces typing-indicator behavior and turn-status visibility flags with explicit awaiting-input state. Live-session state now identifies hook waits that remain open in the transcript, and terminal-turn helpers derive active state, start times, and settled-turn durations. The message list renders activity or awaiting-input tail rows. Prompt-card derivation moves to a hook, while the resolved and structured chat views pass derived state to child components. Host turn-start timestamps now flow through status persistence, IPC, renderer state, and turn-timing calculations. Tests cover the updated behavior, and translations add an unnamed awaiting-input label.

Priority: ➖ Normal

Merge Risk: 🔵 Low · up to bc250

Some terminal-backed chats can briefly show or fold the wrong turn duration, and the timing tests can fail intermittently. These are bounded issues, but the timing fixes should be considered before merging.

Security Architecture Review

Security architecture risk: 🟡 Moderate · up to bc250

The updated chat can associate one turn’s timing with another turn, giving misleading progress or completion cues. The review did not establish a new access-control bypass.

Retained concerns

  • Medium · architecture · inferred: A completed status is assigned to the latest transcript prompt by pane rather than turn identity. If a new prompt arrives before its status update, the previous turn’s duration can mark that prompt as settled.
  • Low · architecture · inferred: A host-cleared turn timestamp is omitted from IPC, but the renderer can retain its previous timestamp on a same-state update. The clear and an update from a writer without a turn clock are not distinguished.
Security review details

Security Blast Radius

  • inferred — The demonstrated mismatch affects turn-status presentation for a pane and its transcript. The inspected path did not establish a new credential, permission-grant, or cross-pane authority sink.

Trust Boundaries and Controls

  • observed — Existing hook admission and status-write checks run before the host-derived timestamp is attached. Replay, child, and provider-session-only events do not qualify as turn openings in the timestamp resolver.

Resilience and Maintainability Implications

  • observed — The renderer rejects status updates older by received time, but the completed-duration association does not compare status turn identity with the selected transcript prompt.

Hardening Proposals

  • proposed — Bind completed host timing to a specific turn or prompt before applying it to transcript state, and represent an explicit host timestamp clear separately from an update that supplies no turn clock.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 39.29% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 56 functions across 57 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly identifies the main change: terminal-backed native chat now uses the structured chat turn-status UI.
Description check ✅ Passed The description is comprehensive. It explains the problem, user-visible changes, implementation, rationale, testing evidence, visual proof, limitations, compatibility, and linked issue references. It …
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ℹ️ No critical issues — minor suggestions inline.

Reviewed changes

  • Agent-state resolver — new native-chat-agent-state-row.ts keeps isWorking (the reconciled hook + transcript turn truth) as the only working authority and maps blocked/waiting to 'waiting-for-user', done/null to nothing.
  • Lane split in the message list — showTurnStatus is replaced by the three facts it conflated: agentState (lane-independent), providerTurnTiming, and structuredActivityUi. The tail renders the existing NativeChatTurnActivityLine for working, a new NativeChatAgentWaitingRow for waiting-for-user.
  • Resolved-view wiring — useNativeChatHookStatus now supplies hookState, and workingStartedAt (host stateStartedAt) reaches the turn-status hook on the terminal-backed lane, so the working row shows the host clock instead of discarding it.
  • Typing indicator deleted — shouldShowNativeChatTypingIndicator, NativeChatTypingIndicatorRow, and their tests are removed; the working row subsumes them. Scroll-hook prop showTypingIndicator → showAgentStateRow.
  • i18n — one new key, components.native-chat.status.waitingForUser.

The behavioral test drives the real store → view → list tail wire and fails at main, so the core claim is genuinely pinned.

ℹ️ Nitpicks

  • NativeChatResolvedView.tsx:113 — "Freshness-gated" reads as if it covers the epoch too, but useNativeChatHookStatus returns stateStartedAt raw; only hookState passes through resolveNativeChatHookState's freshness gate.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

…red chat's turn status

A terminal-backed chat (grok and omp always; Claude and Codex whenever the
structured lane is refused) could not say what its agent was doing. A
working agent drew three bouncing dots with no elapsed time, and an agent
stopped on a prompt that only its terminal showed drew nothing, so it looked
idle. A pending AskUserQuestion row read "Asked:" while the agent was still
waiting, because the pane treated the wait as the end of the turn.

The pane already held the facts: the host-stamped working epoch and the
hook's waiting/blocked state. It now feeds them to the same message list
props and components the structured lane uses, instead of opting out with
showTurnStatus={false}:

- The turn runs on while the agent waits on the reader, as a structured turn
  does behind its prompt card, so the "Working for" bar keeps counting and
  the live line yields to the wait.
- A wait the pane can draw as a card (approval or question) is shown by the
  card; a wait only the terminal shows is reported by the tail row the
  structured lane already uses for a pending question
  (NativeChatAwaitingInputRow).
- The hook wait is reconciled against the transcript's terminal marker, like
  hook 'working' is, because an interrupt at the prompt fires no hook.

showTurnStatus meant nothing once both lanes passed it, so it is gone, along
with showLiveTurnActivity (replaced by the awaitingInput fact), the
structuredActivityUi flag it fed to tool rows, and the transcript-guessing
typing indicator (native-chat-typing-indicator.ts,
NativeChatTypingIndicatorRow.tsx), which had no other consumer.

The interactive card's derivation moved into
useNativeChatInteractivePromptCard so the view can tell a wait the card
answers from one it cannot.
@brennanb2025
brennanb2025 force-pushed the brennanb2025/native-chat-show-agent-state branch from 971a413 to 630bf29 Compare September 29, 2026 00:14
@brennanb2025 brennanb2025 changed the title fix(native-chat): show the agent state a terminal-backed chat already holds fix(native-chat): render the terminal-backed chat through the structured chat's turn status Sep 29, 2026
@greptile-apps

greptile-apps Bot commented Sep 29, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 0/5

[Medium risk] Refactors chat turn status and interactive prompt rendering.

The PR is not ready to merge: Codex history bridging can omit conversations, and four earlier turn-status defects remain unresolved.

Findings

  1. P1 Paused tool appears running ▶
  2. P1 Turn duration ends too early ▶
  3. P1 Duration attaches to wrong prompt ▶
  4. P1 OMP completion can appear stuck ▶

Summary

The PR gives terminal-backed desktop chats structured turn-status presentation and host-stamped turn timing. Changes since the previous review also add structured-turn row attribution across desktop and mobile, shared child-work presentation, and Codex account-history indexing.

  • Existing Codex homes without backfill metadata can now be excluded from account-history bridging.
Diagram
%%{init: {'theme': 'neutral'}}%%
flowchart LR
  Sources[Other Codex homes] --> Gate{Target DB backfill status}
  Gate -->|complete or missing| Bridge[Link session history]
  Bridge --> Heal[Heal Codex index]
  Gate -->|not-tracked| Skip[Skip bridge and heal]
  Skip --> Missing[Conversations absent from resume]
Loading

Reviews (9) · Last reviewed commit: "Merge origin/main into brennanb2025/nati..."

session={sessionWithPending}
isVisible={isVisible}
isWorking={isWorking}
isWorking={turnActive}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Paused tool appears running During an approval wait, turnActive stays true so the turn clock can continue. Passing it as isWorking also marks the trailing approval tool run as live. Its label pulses and says “Running …” even though the agent is paused for approval, giving the reader a false account of what the tool is doing. Keep the clock active without treating the paused tool as executing.

Knowledge Base Used: Agent workspaces and sessions

… question is named

A wait the pane cannot draw as a card, and a question whose text could not be
parsed, both drew "Awaiting user input:" with nothing after the colon. The row
now reads "Awaiting user input" when it has no question to name, in both chat
lanes. The pending-question view test now counts awaiting rows by attribute so
a second, unnamed row cannot slip past it.
… pending

Deriving the prompt card moved from the card into the pane's view, and with it
a store read of the status row's tool name, which changes on every tool call.
Every tool call therefore re-rendered the whole terminal-backed pane and its
transcript list, where before only the card re-rendered. The tool name only
matters beside a prompt, so read it only then.
…s a remount

Answering a prompt only the terminal shows means switching the pane to its
terminal, which unmounts the chat. On return the "Working for" clock restarted
from the agent's current state (seconds after the answer), and every turn the
pane had folded behind "Worked for N" came back unfolded with no bar.

- The running turn now counts from the start of the hook's unbroken run of
  mid-turn states under the current prompt (read from the status row's state
  history), not the current state's own start.
- Finished turns take their duration from the transcript's own timestamps
  (prompt to the agent's last row or its interruption), so history turns fold
  like a structured chat's. The latest turn still relies on what the pane saw.
Comment on lines +94 to +100
if (turn?.startedAt != null && turn.endedAt != null) {
settled.set(turn.id, {
startedAt: turn.startedAt,
workedSeconds: Math.max(0, Math.floor((turn.endedAt - turn.startedAt) / 1000))
})
}
turn = { id: message.id, startedAt: message.timestamp, endedAt: null }

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Turn duration ends too early When a terminal-backed turn has a timestamped tool call or early assistant message but no later timestamped agent row, the next user message makes this code treat that earlier row as the end of the turn. A long approval wait can therefore appear as “Worked for 0s,” and the turn can be folded despite remaining active during the wait. The next user message marks a turn boundary, not the preceding turn’s finish time.

Knowledge Base Used: Agent workspaces and sessions

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes

Changes since the prior pullfrog review (fc53a73 → 841dca1, two commits; the full 43-file diff was also read):

  • Unnamed wait reads as a whole phrase — NativeChatAwaitingInputRow now selects ask.awaitingUnnamed ("Awaiting user input", no colon) when subject === null, so the transcript tail row and a payload-less ask tool call no longer end on a dangling colon. New NATIVE_CHAT_ASK_ROW_COPY entry plus en.json, en-runtime-required.json, and the fr/ja/ko/zh catalogs.
  • Prompt-card hook no longer re-renders on every tool call — useNativeChatInteractivePromptCard reads the status entry's toolName only while interactivePrompt is present, so a tool-call-only status change no longer re-renders the whole pane. New use-native-chat-interactive-prompt-card.test.ts pins both the no-re-render case and that the prompt still parses.

The prior review's one open thread (a possible duplicate pane-level waiting row) is addressed by the rebuilt design: the tail awaiting row is suppressed whenever a prompt card or the transcript's own ask row already speaks for the wait, and NativeChatResolvedView.turn-status.test.tsx asserts exactly one awaiting row. Both localization gates pass, and the changed test files pass.

Pullfrog  | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes

Changes since the previous pullfrog review (841dca1 → 03c6367, one commit):

  • Turn clock and folds survive a remount on the terminal lane — new useNativeChatTerminalTurnTiming feeds NativeChatMessageList a workingStartedAt drawn from the hook's unbroken mid-turn run under the current prompt (nativeChatHookTurnStartedAt) rather than the current state's own start, plus transcript-derived settledTurns (nativeChatTranscriptSettledTurns). A pane that remounts after answering a terminal-only prompt now keeps counting from the turn start, and finished historical turns still show and fold their durations.

Both helpers are pure and pinned by exact-assertion unit tests, and the view tests cover the remount-after-wait clock and the historical fold. tc:web is clean and the changed test files pass.

Pullfrog  | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

…d skip harness notices

Two ways the terminal-backed chat showed a wrong turn status:

- A background task or subagent keeps the status row 'working' after the
  main agent finishes, so the row's own start time carries into the next
  turn. A prompt sent while a background dev server ran showed "Working for"
  counted from the earlier turn. The clock now reads the main agent's own
  state and start time where the row carries them.
- Harness notices (task notifications, reminders) are user-role rows in the
  transcript that the chat does not draw. The finished-turn derivation
  treated them as new prompts, so a running turn was reported settled and
  folded its steps while it still ran, and a finished turn's "Worked for"
  stopped at the notice. They no longer start or end a turn.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 60b410fa-d1f4-4f74-9413-8820c5718130

📥 Commits

Reviewing files that changed from the base of the PR and between 03c6367 and 4fcf36e.

📒 Files selected for processing (3)
  • src/renderer/src/components/native-chat/NativeChatResolvedView.turn-status.test.tsx
  • src/renderer/src/components/native-chat/native-chat-terminal-turn.test.ts
  • src/renderer/src/components/native-chat/native-chat-terminal-turn.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 1 remain after this review.

retained.session = transcript('working', false)
setStatus({ state: 'working' })
const live = useAppStore.getState().agentStatusByPaneKey[paneKey]!
const now = Date.now()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Freeze the clock for exact elapsed-time assertions.

If rendering takes one second after now is sampled, the expected Working for 5s can become Working for 6s. The test then fails while the UI is correct. Freeze Date.now() before setting the status and restore the clock after the test. Apply the same fix to the Working for 30s assertion. The test setup does not currently freeze the clock. (raw.githubusercontent.com)

Based on learnings: Tests that depend on Date.now() should use a fake clock for deterministic assertions.

Source: Learnings

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes

Changes since the previous pullfrog review (03c6367 → 4fcf36e, one commit):

  • Turn clock now dates from the main agent, not the row — nativeChatHookTurnStartedAt takes the entry's mainAgent clock while the main agent is not done and walks stateHistory by each leg's mainAgent start. A background task that held the row working across the last turn's end no longer stretches the new turn's clock back to that task's start; once the main agent is done, the row's own run is read as the turn's tail.
  • Harness notices no longer split a turn — nativeChatTranscriptSettledTurns skips isNoiseMessage user rows, so a task notification or reminder injected mid-turn neither ends the current turn nor starts a new one. This matches the main process's own rule in transcript-turn-lifecycle.ts.
  • Tests — three exact-assertion unit cases for the main-agent/row clock and one for a mid-turn notice, plus a view-level case asserting the main-agent clock wins over a 45-minute-old row epoch. All pin the new behavior (the old code produces Working for 45m 0s and a folded turn in those cases).

Verified locally at this head: the two changed test files pass (28 tests) and pnpm tc:web is clean.

ℹ️ Nitpicks

  • The PR description is stale against this head. It states "No locale keys are added or removed", but 1da494cf added components.native-chat.ask.awaitingUnnamed to en.json, en-runtime-required.json, and the fr/ja/ko/zh catalogs; and it says turns loaded from history "show no bar and stay unfolded", while 03c6367's nativeChatTranscriptSettledTurns folds them (pinned by the "folds finished turns from history behind their transcript duration" view test). A one-line body correction keeps the description aligned with what ships.

Pullfrog  | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

The hook server now records turnStartedAt on a status row when the main
agent's own turn-opening event arrives (the per-provider new-turn
classifier the observation boundary already uses; not a replay, a child
event or an identity-only row). Other events carry it; a session
boundary clears it, and a settled main agent running again with no
opening event drops it rather than count from the finished turn.

It rides the snapshot and the live push as an optional field, persists
with the row, lands on the renderer entry (kept within one state for
writers with no turn clock), and is part of the paired-client
projection key and equality. Old hosts send nothing; readers fall back
to stateStartedAt.
… stamp

The running clock reads the host's turnStartedAt, so a remount, a reload
(which starts with no state history) and child work holding the row open
no longer move it, and the same prompt sent again is a new turn. The
stateHistory walk and its prompt-equality rule are gone; an old host
falls back to the current state's start.

The latest turn is settled from host facts: once the main agent is done
(outside a session boundary) its duration is the done stamp minus the
turn start, so it folds after a remount. When the host went quiet
mid-turn (the store's staleness dropped the row) the pane passes null,
so a still-waiting turn no longer reads "Worked for 30m" and folds.
Older turns keep their transcript durations.
Comment on lines +33 to +41
const settledTurns = useMemo(() => {
if (turnActive || latestWorkedSeconds === undefined || latestTurnId === null) {
return transcriptSettled
}
return new Map(transcriptSettled).set(
latestTurnId,
latestWorkedSeconds === null || turnStartedAt === null
? null
: { startedAt: turnStartedAt, workedSeconds: latestWorkedSeconds }

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Duration attaches to wrong prompt When a new message appears optimistically before its hook status arrives, the hook still describes the preceding completed turn. This code assigns that turn’s duration to the newest prompt without checking whether they belong together. The new message can show “Worked for” and fold its steps before the agent has begun or finished it.

Knowledge Base Used: Agent workspaces and sessions

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: b734459a-9aae-448c-84f4-5df0104ce37c

📥 Commits

Reviewing files that changed from the base of the PR and between 4fcf36e and bc250cd.

📒 Files selected for processing (23)
  • src/main/agent-hooks/server-turn-started-at.test.ts
  • src/main/agent-hooks/server/server-persistence-validation.ts
  • src/main/agent-hooks/server/server-status-application.ts
  • src/main/agent-hooks/server/server-status-identity.ts
  • src/main/agent-hooks/server/server-types.ts
  • src/main/startup/main-window-agent-status.ts
  • src/main/startup/main-window-structured-status-filter.test.ts
  • src/renderer/src/components/native-chat/NativeChatResolvedView.turn-status.test.tsx
  • src/renderer/src/components/native-chat/native-chat-terminal-turn.test.ts
  • src/renderer/src/components/native-chat/native-chat-terminal-turn.ts
  • src/renderer/src/components/native-chat/use-native-chat-terminal-turn-timing.ts
  • src/renderer/src/hooks/ipc-events-agent-status-store-test-fixtures.ts
  • src/renderer/src/hooks/ipc-events/agent-status-event-applicator.ts
  • src/renderer/src/hooks/useIpcEvents-agent-status-snapshot-replay.test.ts
  • src/renderer/src/runtime/sync-runtime-graph-agent-status-projection.test.ts
  • src/renderer/src/runtime/sync-runtime-graph/agent-status-projection.ts
  • src/renderer/src/runtime/web-session-tabs-sync/state-equality-core.test.ts
  • src/renderer/src/runtime/web-session-tabs-sync/state-equality-core.ts
  • src/renderer/src/store/slices/agent-status-contract.ts
  • src/renderer/src/store/slices/agent-status-live-entry-builder.ts
  • src/renderer/src/store/slices/agent-status-turn-started-at.test.ts
  • src/shared/agent-status-ipc-payload.ts
  • src/shared/agent-status-types.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 3 remain after this review.

Comment on lines +22 to +40
const agentStatusEpoch = useAppStore((s) => s.agentStatusEpoch)
void agentStatusEpoch
const turnStartedAt = useAppStore((s) =>
nativeChatHookTurnStartedAt(s.agentStatusByPaneKey[paneKey])
)
const latestWorkedSeconds = useAppStore((s) => {
const entry = s.agentStatusByPaneKey[paneKey]
return nativeChatHookLatestTurnWorkedSeconds(entry, resolveNativeChatHookState(entry) === null)
})
const transcriptSettled = useMemo(() => nativeChatTranscriptSettledTurns(messages), [messages])
const latestTurnId = useMemo(() => nativeChatLatestTurnId(messages), [messages])
const settledTurns = useMemo(() => {
if (turnActive || latestWorkedSeconds === undefined || latestTurnId === null) {
return transcriptSettled
}
return new Map(transcriptSettled).set(
latestTurnId,
latestWorkedSeconds === null || turnStartedAt === null
? null

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🔎 Supported by static analysis

🏁 Script executed:

sed -n '1,85p' src/renderer/src/components/native-chat/use-native-chat-terminal-turn-timing.ts
sed -n '73,133p' src/renderer/src/components/native-chat/native-chat-terminal-turn.ts
sed -n '310,335p' src/renderer/src/components/native-chat/NativeChatResolvedView.tsx

Repository: stablyai/orca

Length of output: 6090


🏁 Script executed:

set -e
printf '%s\n' '--- candidate symbols and usages ---'
rg -n --glob '*.ts' --glob '*.tsx' 'resolveNativeChatTerminalTurn|nativeChatHookLatestTurnWorkedSeconds|sessionBoundary|turnStartedAt|agentStatusByPaneKey|nativeChatLatestTurnId|useNativeChatTerminalTurnTiming' src/renderer/src/components/native-chat src/renderer/src/store src/shared
printf '%s\n' '--- terminal turn file outline and relevant source ---'
ast-grep outline src/renderer/src/components/native-chat/native-chat-terminal-turn.ts
sed -n '1,180p' src/renderer/src/components/native-chat/native-chat-terminal-turn.ts
printf '%s\n' '--- hook status source ---'
sed -n '1,240p' src/renderer/src/components/native-chat/use-native-chat-hook-status.ts

Repository: stablyai/orca

Length of output: 41888


🏁 Script executed:

set -e
printf '%s\n' '--- changed files and diff summary ---'
git diff --stat bd5dca4406ff6b755474474625af8177b5821c36 bc250cd5a74ade7ee4b222a8b05f8230f09dff2d
git diff --unified=35 bd5dca4406ff6b755474474625af8177b5821c36 bc250cd5a74ade7ee4b222a8b05f8230f09dff2d -- src/renderer/src/components/native-chat/use-native-chat-terminal-turn-timing.ts src/renderer/src/components/native-chat/native-chat-terminal-turn.ts
printf '%s\n' '--- status bridge ---'
sed -n '55,155p' src/renderer/src/components/native-chat/StructuredAgentSessionStatusBridge.tsx
printf '%s\n' '--- status live reducer ---'
sed -n '1,145p' src/renderer/src/store/slices/agent-status-live-reducer.ts
printf '%s\n' '--- interactive send ---'
sed -n '80,180p' src/renderer/src/components/native-chat/use-native-chat-interactive-send.ts
printf '%s\n' '--- relevant turn timing tests ---'
sed -n '1,280p' src/renderer/src/components/native-chat/native-chat-terminal-turn.test.ts
rg -n --glob '*turn*timing*' --glob '*.test.*' --glob '*.tsx' 'settledTurns|workedSeconds|turnStartedAt|latestTurnId|timing' src/renderer/src/components/native-chat

Repository: stablyai/orca

Length of output: 42791


🏁 Script executed:

set -e
printf '%s\n' '--- latestPrompt and transcript ingestion ---'
rg -n --glob '*.ts' --glob '*.tsx' 'latestPrompt|messages:|setMessages|append.*message|add.*message|NativeChatMessage|transcript' src/renderer/src/components/native-chat/use-native-chat-live-session.ts src/renderer/src/components/native-chat/native-chat-live-session-contract.ts src/renderer/src/components/native-chat/NativeChatResolvedView.tsx src/renderer/src/components/native-chat/NativeChatStructuredSession.tsx src/renderer/src/components/native-chat src/shared | head -240
printf '%s\n' '--- live session implementation ---'
sed -n '1,260p' src/renderer/src/components/native-chat/use-native-chat-live-session.ts
printf '%s\n' '--- resolved view status/turn inputs ---'
sed -n '80,140p' src/renderer/src/components/native-chat/NativeChatResolvedView.tsx
sed -n '280,345p' src/renderer/src/components/native-chat/NativeChatResolvedView.tsx
printf '%s\n' '--- structured status projection continuation ---'
sed -n '85,175p' src/renderer/src/components/native-chat/StructuredAgentSessionStatusBridge.tsx

Repository: stablyai/orca

Length of output: 41917


🏁 Script executed:

set -e
printf '%s\n' '--- status prompt fields and producers ---'
rg -n --glob '*.ts' --glob '*.tsx' '\bprompt\b|latestPrompt|turnStartedAt' src/shared/agent-status-types.ts src/shared/agent-status-ipc-payload.ts src/main src/renderer/src/store/slices src/renderer/src/components/native-chat | head -260
printf '%s\n' '--- transcript message shape and text helpers ---'
rg -n --glob '*.ts' --glob '*.tsx' 'export type NativeChatMessage|interface NativeChatMessage|message\.blocks|blocks.*text|text.*blocks|settledTurns\.get|settledTurns\?' src/shared/native-chat-types.ts src/renderer/src/components/native-chat/NativeChatMessageList.tsx src/renderer/src/components/native-chat/NativeChatTranscriptRow.tsx src/renderer/src/components/native-chat/native-chat-transcript-slots.ts src/renderer/src/components/native-chat/NativeChatMessageRow.tsx
printf '%s\n' '--- message list timing path ---'
sed -n '50,125p' src/renderer/src/components/native-chat/NativeChatMessageList.tsx
sed -n '160,230p' src/renderer/src/components/native-chat/NativeChatMessageList.tsx
sed -n '1,115p' src/renderer/src/components/native-chat/NativeChatTranscriptRow.tsx
printf '%s\n' '--- live session status derivation ---'
sed -n '320,375p' src/renderer/src/components/native-chat/use-native-chat-live-session.ts

Repository: stablyai/orca

Length of output: 41531


🏁 Script executed:

set -e
printf '%s\n' '--- exact status and message types ---'
sed -n '65,105p' src/shared/agent-status-types.ts
sed -n '185,225p' src/shared/native-chat-types.ts
printf '%s\n' '--- message content helpers ---'
rg -n --glob '*.ts' --glob '*.tsx' 'function deriveNativeChatRowContent|export .*deriveNativeChatRowContent|deriveNativeChatRowContent' src/shared src/renderer/src/components/native-chat
printf '%s\n' '--- turn status hook and slot status assignment ---'
rg -n --glob '*.ts' --glob '*.tsx' 'function useNativeChatTurnStatus|useNativeChatTurnStatus|settledTurns\.get|workedSeconds' src/renderer/src/components/native-chat/use-native-chat-turn-status.ts src/renderer/src/components/native-chat/native-chat-transcript-slots.ts src/renderer/src/components/native-chat
sed -n '1,180p' src/renderer/src/components/native-chat/use-native-chat-turn-status.ts
sed -n '135,180p' src/renderer/src/components/native-chat/native-chat-transcript-slots.ts

Repository: stablyai/orca

Length of output: 14141


Guard host timing against a newer transcript prompt.

When the transcript receives a new user prompt before the pane status advances, latestWorkedSeconds can still contain the previous completed turn. The hook then assigns that duration and turnStartedAt to latestTurnId. The new prompt can therefore show the previous turn's duration and become foldable as settled.

Add a status-to-prompt or equivalent turn-ID guard before applying host timing. Do not solve this by changing the omitted turnStartedAt branch; this case has a valid old host stamp.

Comment on lines +118 to +120
const turnStartedAt =
timing?.turnStartedAt ??
(existing && existing.state === payload.state ? existing.turnStartedAt : undefined)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🔎 Supported by static analysis

🏁 Script executed:

sed -n '75,135p' src/renderer/src/store/slices/agent-status-live-entry-builder.ts
sed -n '185,222p' src/renderer/src/store/slices/agent-status-live-entry-builder.ts
sed -n '70,110p' src/renderer/src/store/slices/agent-status-contract.ts
sed -n '200,238p' src/renderer/src/hooks/ipc-events/agent-status-event-applicator.ts

Repository: stablyai/orca

Length of output: 7044


🏁 Script executed:

set -e
sed -n '1,220p' src/renderer/src/hooks/ipc-events/normalize-agent-status-event.ts
sed -n '1,280p' src/renderer/src/hooks/ipc-events/agent-status-event-applicator.ts
sed -n '1,180p' src/renderer/src/store/slices/agent-status-live-entry-builder.ts
rg -n -C 8 'mainAgent|sessionBoundary' src/renderer/src src/main/agent-hooks/server src/main/startup/main-window-agent-status.ts

Repository: stablyai/orca

Length of output: 45663


🏁 Script executed:

set -e
printf '%s\n' '--- shared payload and main-agent types ---'
rg -n -C 12 'type AgentMainAgentStatus|interface AgentMainAgentStatus|mainAgent|sessionBoundary|type ParsedAgentStatusPayload|interface ParsedAgentStatusPayload' src/shared/agent-status-types.ts src/shared
printf '%s\n' '--- main-agent resolver ---'
sed -n '1,240p' src/renderer/src/store/slices/agent-status-live-entry-main-agent.ts
printf '%s\n' '--- builder tests and boundary tests ---'
rg -n -C 10 'sessionBoundary|mainAgent|turnStartedAt|OSC|repaint|done.*working|working.*done' src/renderer/src/store/slices/*agent-status*test* src/main/agent-hooks/*test* 2>/dev/null

Repository: stablyai/orca

Length of output: 45651


<final_review_comment>
Clear the inherited clock from existing payload metadata.

mainAgent and sessionBoundary already reach buildAgentStatusLiveEntry. When the existing main agent is done and the incoming mainAgent is non-done, or when sessionBoundary is true, clear turnStartedAt before applying the same-state fallback. An OSC repaint has no mainAgent fact and can retain the existing clock.

🐛 Suggested fix
+  const hostClearedTurn =
+    payload.sessionBoundary === true ||
+    (payload.mainAgent !== undefined &&
+      existing?.mainAgent?.state === 'done' &&
+      payload.mainAgent.state !== 'done')
   // Why: a writer with no turn clock (an OSC repaint) keeps the host's stamp only within one state;
   // a state change it cannot date must not inherit another turn's start.
   const turnStartedAt =
     timing?.turnStartedAt ??
-    (existing && existing.state === payload.state ? existing.turnStartedAt : undefined)
+    (hostClearedTurn
+      ? undefined
+      : existing && existing.state === payload.state
+        ? existing.turnStartedAt
+        : undefined)

</final_review_comment>

…ool call

The terminal-backed chat settles a hook 'working' turn when the transcript's
last row is an assistant row written after the turn began, a recovery for a
Stop hook the host can miss. omp writes a timestamp on every row and has no
transcript turn markers, so every tool call mid-turn tripped it: the pane
dropped its "Working for" bar and showed Send instead of Stop while the
command ran.

omp's own runtime delivers its turn end (agent_end, retried until the host
takes it and held back while the run continues), so its hook 'working' is
never a dropped Stop. The prose recovery now skips it.
The test stamped the row's done time and the turn start from two separate
Date.now() reads, so whenever a millisecond passed between them the expected
"Worked for 1m 30s" came out as 1m 29s. It failed that way once under load.
Comment on lines 149 to 154
if (
transcriptLifecycle?.state !== 'working' &&
!hookDeliversTurnEnd(agent) &&
trailingAssistantPostDates(statusTailMessage, stateStartedAt)
) {
return undefined

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 OMP completion can appear stuck If OMP's completion hook fails delivery, this change stops the latest assistant transcript row from settling a stale working status. OMP transcripts have no turn-end marker, and hook delivery stops retrying after three attempts. A finished turn can therefore keep showing “Working” and Stop until the status expires. Please preserve a fallback that can distinguish a finished answer from a tool call made mid-run.

Knowledge Base Used: Agent integrations and hooks

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes

Changes since the prior pullfrog review (4fcf36e → bc250cd, three commits; the full 64-file diff was also read):

  • Host-stamped turn start — the hook server now stamps turnStartedAt from the main agent's own turn-opening event (isNewTurnEvent), clears it on a session boundary and on a done→non-done edge with no opening event, and propagates it otherwise. Only the server can write it, so a producer cannot declare it (the parsed payload whitelist drops the field). It is persisted, pushed on agentStatus:set, and carried through the IPC payload, renderer store, client-sync equality, and mobile projection.
  • Terminal lane times from the host stamp — nativeChatHookTurnStartedAt prefers entry.turnStartedAt, falling back to the main agent's then the row's stateStartedAt on an older host. New nativeChatHookLatestTurnWorkedSeconds / nativeChatLatestTurnId let useNativeChatTerminalTurnTiming fold the host's finished-turn duration into settledTurns, and hide a locally measured end when the host went quiet mid-turn.
  • Tests — a new host suite (7 cases: tools/wait/answer, child and relayed-replay exclusion, session boundary, OSC-race clear, producer-supplied stamp, live push + restart hydration) plus store/equality/projection/live-push cases and updated view/unit cases with exact assertions.

Verified at this head: the changed test suites pass (48 view/store/equality/live-session + 28 host/terminal-turn) and pnpm tc:web is clean. The prior review's one open thread (duplicate waiting row) is already resolved.

Pullfrog  | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes

Changes since the prior pullfrog review (bc250cd → 702a784, two commits; read the range-diff):

  • omp keeps working through mid-run tool calls — mergeNativeChatLiveSession now passes the pane's agent into liveStatusOverride, and hookDeliversTurnEnd(agent) (omp only) skips the assistant-prose recovery that would otherwise settle the turn when the transcript's trailing assistant row — an omp tool call written mid-run — postdates the current state. omp's own agent_end is the settle signal; the extension retries it and holds it back while the run continues, and grok keeps prose recovery. The new unit case fails without the guard.
  • Test-only — the host-ended remount view test now reads Date.now() once so both stamps share a single clock, removing a timing race between the two reads.

Verified at this head: native-chat-live-status.test.ts (23) and the turn-status view test (16) pass, and pnpm tc:web is clean.

Pullfrog  | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

…tion reference

The hot-path suite compares the agent-status projection against its own copy of
the serializer; that copy lacked the new turnStartedAt key.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes

Changes since the prior pullfrog review (702a784 → a884f86, one commit; the delta is a single test-only line, read against the full 65-file diff from prior runs):

  • Hot-path projection fixture carries the turn stamp — referenceAgentStatusProjection in sync-runtime-graph-projection-hot-path.test.ts now mirrors the production serializer's turnStartedAt key, so the byte-for-byte and ordering equivalence cases stay green after 502c42c added the field. The reference lacked the key while production always emits it, so those cases were red; the sibling sync-runtime-graph-agent-status-projection.test.ts already carried it. Verified red without the line (turnStartedAt: null on the production side only) and green with it.

Pullfrog  | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@brennanb2025

Copy link
Copy Markdown
Contributor Author

Review status: ready for a merge decision (not merged)

The problem this fixes: a native chat backed by an agent's terminal (grok and omp always; Claude and Codex when the structured chat is refused) showed three bouncing dots while working, nothing when the agent was blocked on a prompt only its terminal showed, and never "Worked for N". For omp even the dots vanished during every tool call.

What you see now: the terminal-backed chat looks and acts like the structured chat in all three moments, checked side by side against a real structured Claude chat on a remote Mac at 702a784 (the head since then only adds a test fix):

Mid-turn: both lanes show "Working for 14s", "Running 1 command" and the "Working…" spinner, with Stop in both composers.

Blocked on a permission: Claude's approval card beside grok's terminal-only wait, which now reads "Awaiting user input"; both bars count.

Finished, after a window reload: both lanes keep "Worked for …" with the fold caret.

What changed during review (head a884f86):

  • Five review loops. Loops 1 to 4 each found and fixed real defects; loop 5 was clean.
  • Loop 1: the waiting row read "Awaiting user input:" with nothing after the colon (both lanes); every tool call re-rendered the whole pane.
  • Loops 2 and 3: the clock restarted after answering a prompt in the terminal, a background task made a 5-second turn read "Working for 45m", a harness notice folded a running turn, and switching to the terminal lost every "Worked for".
  • Because loops 2 and 3 kept finding defects in the same place (the pane reconstructing when a turn began), a separate architecture review was run. It found the host already knows exactly when a turn opens and was discarding it, and that the pane-side reconstruction also produced a false "Worked for 30m" on a turn silent for 30 minutes. The fix replaced the reconstruction: the hook server now stamps turnStartedAt on the status row (one optional wire field; old hosts fall back), and the pane reads it. That removed the whole class instead of adding a fifth rule.
  • Loop 4 plus live QA: omp looked idle whenever its newest transcript row was a tool call, because a fallback that settles a turn on a trailing assistant row fired on omp's timestamped rows. omp reports its own turn end reliably, so the fallback is now off for omp.
  • CI caught one test whose private copy of the projection serializer lacked the new field; fixed.

Checks: tc:node and tc:web clean; CI all green at a884f86 (eight test shards, typecheck, verify); readiness checklist passes on code at the start and the end; live QA three rounds, final round all pass, real agent homes untouched.

Decisions for you (not changed here):

  • The terminal-only waiting row does not say where to answer, and the composer still shows Send; a message typed into the chat during that wait goes to the terminal prompt as keystrokes. Options: name the terminal in the row and add a "switch to terminal" action, or block Send while waiting. Follow-up or this PR?
  • Whether a real grok permission prompt reaches the pane as a wait is unverified: grok's routine "tool permission requested" notification is ignored because grok sends it before every tool, and real grok was out of quota. grok questions and omp permission prompts are verified.

Follow-ups found, not caused by this PR:

  • The status store drops a row silent for 30 minutes (and restored rows are unconfirmed after a restart), so a long wait reads as idle again everywhere.
  • Pressing Esc at a permission prompt fires no hook and the host infers no interrupt, so the sidebar and mobile can keep showing "waiting".
  • A paired client of a headless orca serve host does not receive the turn stamp yet (about 8 lines in the shared mobile row builder).
  • An answered question whose text could not be read still ends in "Asked:" with nothing after it.

Not merged and auto-merge not enabled.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes

Changes since the prior pullfrog review (a884f86 → 123bbdf, the merge of origin/main @ b7e3bbf):

  • Merge reconciliation of main's #23573 — NativeChatMessageList now derives the running turn's key as selectNativeChatActiveTurnKey(messages, activeTurnOpenedBy) (the host's opener, else the latest user message) and passes it to useNativeChatTurnStatus and buildNativeChatTranscriptSlots; the private latestUserIndex key is gone. NativeChatStructuredSession forwards controller.activeTurnOpenedBy. The terminal lane passes none, so its key remains the latest user prompt — behavior unchanged for this PR's lane.
  • Merge reconciliation of main's #23765 — NativeChatStructuredSession adopts useStructuredAgentSessionHostExecution (.phase / .childKey) in place of useStructuredAgentSessionHostExecutionPhase.
  • PR's removal preserved — no reference to showTurnStatus, showLiveTurnActivity, the typing indicator, or structuredActivityUi survives at this head; the terminal lane still renders through awaitingInput / tailRow.

The true branch delta also absorbs main's shared native-chat-turn-status.ts, structured-agent-session-turn-timing.ts, use-structured-agent-turn-timing.ts, and the status-bridge changes; no conflicting intent was dropped by the resolution.

Verified at this head: the whole src/renderer/src/components/native-chat/ suite plus structured-agent-session-turn-bars / -turn-timing passes (201 files, 2071 tests), pnpm tc:web is clean, and check:code-quality:changed reports 0 new findings. Both prior pullfrog threads are resolved; none remain open.

Pullfrog  | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes

Changes since the prior pullfrog review (123bbdf → 535cd07, the merge of origin/main @ b6c2de9f):

  • Main's turn-grouping refactor adopted — NativeChatMessageList now resolves each row's owning turn through the shared nativeChatRowTurnKeys(messages, turnKeysByItemId), and native-chat-transcript-slots.ts uses nativeChatSelfAnchoredTurnRows / statusAbove / lastRowByTurn so a provider-opened turn anchors its bar at its first row instead of every run boundary. NativeChatStructuredSession forwards controller.turnKeysByItemId.
  • Terminal lane behavior unchanged — the terminal-backed lane passes no turnKeysByItemId, so the shared helper reproduces the previous preceding-user grouping exactly. activeTurnIsWorking now keys off activeTurnKey; for this lane that is the same latest-user-message key the removed currentTurnKey held, and the unanchored case (no user message yet) is preserved by NATIVE_CHAT_UNANCHORED_TURN_KEY.
  • Removed UI stays removed — no showTurnStatus, showLiveTurnActivity, structuredActivityUi, NativeChatTypingIndicatorRow, or native-chat-typing-indicator reference survives at this head.
  • Absorbed main work — the merge also brings in main's sidebar subagent-row refactor (#22565) and codex account-home index heal (#22971).

Verified at this head: the whole src/renderer/src/components/native-chat/ suite (199 files, 2047 tests) passes, pnpm tc:web is clean, and the one prior pullfrog thread is [RESOLVED].

Pullfrog  | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@brennanb2025
brennanb2025 merged commit 4da485c into main Sep 29, 2026
39 checks passed
brennanb2025 added a commit that referenced this pull request Sep 29, 2026
Main now groups chat rows by the turn the host's turn records say produced
them (#23671), anchors a provider-opened turn's bar on its first row, and
renders the terminal-backed chat through the structured turn status (#22090).
This branch moves each subagent's rows out of the conversation into its own
section under its roster entry.

Conflicts, resolved so both hold:
- Slots: main's owning-turn liveness, statusAbove and last-row rollup
  placement, on this branch's message/section/entries slot union.
- Message list: main's nativeChatRowTurnKeys and active-turn key feed the
  slots; this branch's rollup still merges subagent rows into turn order.
- Transcript row: main's bar-above on this branch's section-indented wrapper.
- Slot tests: main's turn-owned grouping tests kept; the inline subagent
  caption tests stay removed with the caption.

Subagent rows now take their turn from the same rule: the transcript
projection runs nativeChatRowTurnKeys over every row with the host's
attribution, and only a user row the conversation draws opens a turn by
position. The positional rule it replaces put an edit made after a send
queued mid-turn into that send's turn, and never used a turn keyed to its own
record, so the edit counted in the wrong turn's changed files.
brennanb2025 added a commit that referenced this pull request Sep 29, 2026
…3745, #23783, #22971, #22565, #22846, #23724, #23721, #23693, #23810) into #23059

#23671 (group chat rows by the turn that produced them) is ported onto
#23059's turn-scope model, so there is one grouping mechanism, not two:

- A host that states each row's turn scope groups by that scope, as
  before. #23671's journal-order derivation (rows between one turn record
  and the next belong to it) moves from the timing selector into
  src/shared/native-chat-turn-grouping.ts and runs only for a host that
  states no scope, replacing the positional fallback there.
- #23671's anchor rules live in structuredAgentTurnAnchors, which
  membership, settled timing and the live clock all read: a turn whose
  opener key nothing resolves yet takes the send still in flight ahead of
  its record (Codex before its echo), else its own record.
- The live turn is one key again. #23671 made row liveness follow the
  owning turn, so the bar key and the liveness key are always the same;
  nativeChatTurnMembership now returns only liveTurnKey (barTurnKey,
  activeTurnOpenedBy and turnKeysByItemId are gone).
- A turn with no user bubble draws its bar above its first row
  (nativeChatTurnBarRows, desktop and mobile), and a turn's diff rollup
  goes under its last row.
- The Codex full-history restore writes each record ahead of its items;
  that also fixes the derived turn scope on #23059's journal.

#23026 (Stop from the moment a message is sent) is ported onto #23059's
command turns: the cancel paths ask the translator for a command's
provider turn instead of the removed compaction tracker, and a Stop that
names no turn still ends a running /compact through its child.
performCancel moved to structured-agent-session-turns-cancel.ts to keep
the turns module under the line limit.

#22090's awaitingInput replaces showTurnStatus/showLiveTurnActivity; the
waiting-behind-/compact rows are kept.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant