Repository navigation
fix(native-chat): show one live-turn indicator, and make Thinking mean reasoning - #19977
Conversation
The turn-timing row and the spinner+activity line were two rows saying "Working" at once. A settled turn keeps its own row; the live turn now has only the spinner row, labelled provider activity -> Thinking -> Working for N through the shared resolver. Reasoning is the turn's content, so it no longer becomes the activity label, and "Thinking" now means the turn is reasoning right now rather than that it has produced no output yet.
Mobile's per-turn row is already the only live indicator on the structured lane, but it pulsed a bare word and never showed what the provider said it was doing. It now renders a spinner beside the same resolved label desktop uses, and reads reasoning from the journal instead of inferring it from missing output. The bridge lane's four prompt/interrupt write seams move to one module so the controller stays under its line cap.
… markers The settled reasoning item carried the marker but the streaming one did not, so a live Codex turn - the only time the indicator is on screen - never read as reasoning. Both paths now stamp it; a plan document keeps its own presentation and must never read as reasoning.
📝 WalkthroughWalkthroughThe change represents reasoning journal entries as typed reasoning messages. Shared helpers now identify active turns, reasoning state, running tools, provider activity, and elapsed-time labels. Renderer and mobile chat surfaces display live and settled turn indicators from this state. Mobile structured sessions pass turn indicators through the controller and view footer. Mobile bridge answer, cancel, permission, and stop writes now use one consolidated hook. Priority: ➖ Normal Merge Risk: 🔵 Low · up to A newly submitted turn can briefly show “Thinking” from the previous running turn on desktop and mobile. Update the shared selector and both callers before merge so the live indicator reflects the active transcript turn. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: 60cd5988-db38-4239-ad4a-77fda2088351
📒 Files selected for processing (38)
mobile/src/session/MobileNativeChatMessage.test.tsmobile/src/session/MobileNativeChatMessage.tsxmobile/src/session/MobileNativeChatOverlay.tsxmobile/src/session/MobileNativeChatTurnStatus.test.tsmobile/src/session/MobileNativeChatTurnStatus.tsxmobile/src/session/MobileNativeChatView.test.tsmobile/src/session/MobileNativeChatView.tsxmobile/src/session/mobile-native-chat-controller-contract.tsmobile/src/session/use-mobile-bridge-chat-prompt-writes.tsmobile/src/session/use-mobile-native-chat-controller.tsmobile/src/session/use-mobile-native-chat-turn-disclosure.tsmobile/src/session/use-mobile-native-chat-turn-status.tsmobile/src/session/use-mobile-structured-agent-session.tsmobile/src/session/use-mobile-structured-turn-indicator.test.tsxsrc/main/claude/claude-structured-journal-translation.test.tssrc/main/claude/claude-structured-journal-translation.tssrc/main/codex/codex-notice-item-translation.test.tssrc/main/codex/codex-structured-item-translation.test.tssrc/main/codex/codex-structured-item-translation.tssrc/main/codex/codex-structured-journal-translation-settlement.test.tssrc/renderer/src/components/native-chat/NativeChatMessageList.test.tsxsrc/renderer/src/components/native-chat/NativeChatMessageList.tsxsrc/renderer/src/components/native-chat/NativeChatMessageList.turn-indicator.test.tsxsrc/renderer/src/components/native-chat/NativeChatTurnActivityLine.tsxsrc/renderer/src/components/native-chat/NativeChatWorkingStatus.tsxsrc/renderer/src/components/native-chat/use-native-chat-elapsed-seconds.tssrc/renderer/src/components/native-chat/use-native-chat-turn-status.tssrc/renderer/src/components/native-chat/use-structured-agent-session.tssrc/shared/agent-session-journal-types.tssrc/shared/native-chat-turn-activity.test.tssrc/shared/native-chat-turn-activity.tssrc/shared/native-chat-turn-status.test.tssrc/shared/native-chat-turn-status.tssrc/shared/native-chat-unverifiable-turn-status.test.tssrc/shared/structured-agent-session-live-turn.test.tssrc/shared/structured-agent-session-live-turn.tssrc/shared/structured-agent-session-projection.tssrc/shared/structured-agent-session-turn-timing.test.ts
💤 Files with no reviewable changes (1)
- src/renderer/src/components/native-chat/NativeChatMessageList.test.tsx
Included review availability: Your plan provides up to 10 included reviews per hour; 3 remain after this review.
| const thinking = status?.thinking === true | ||
| // The clock only ticks when its number is the label; activity text and | ||
| // "Thinking" carry no duration. | ||
| const counting = status != null && !thinking && !activity?.text |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Start the elapsed clock for whitespace-only activity.
At Line 25, activity?.text treats whitespace as activity, but describeNativeChatActiveTurnLabel trims it. If the provider sends " ", the resolver selects workingFor while counting is false, so the row stays at Working for 0s.
Proposed fix
- const counting = status != null && !thinking && !activity?.text
+ const counting = status != null && !thinking && !activity?.text?.trim()📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| const counting = status != null && !thinking && !activity?.text | |
| const counting = status != null && !thinking && !activity?.text?.trim() |
| if (body.presentation === AGENT_JOURNAL_THINKING_PRESENTATION) { | ||
| continue |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Stop the activity scan at the newest reasoning row.
continue lets the scan select an older status row. For [turnStart, status, reasoning], the indicator displays the stale status because activity text has precedence over Thinking.
Return null when the scan reaches reasoning. Provider activity remains unaffected because the function resolves it before this loop. Add a regression test with an ordinary status before the reasoning row.
Proposed fix
if (body.presentation === AGENT_JOURNAL_THINKING_PRESENTATION) {
- continue
+ return null
}📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| if (body.presentation === AGENT_JOURNAL_THINKING_PRESENTATION) { | |
| continue | |
| if (body.presentation === AGENT_JOURNAL_THINKING_PRESENTATION) { | |
| return null |
There was a problem hiding this comment.
Important
One fidelity gap to confirm before merge: for Claude, the reasoning-derived "Thinking" label effectively never appears while the model is actually reasoning.
Reviewed changes
A focused follow-up to #19695 that collapses native chat's two stacked "working" rows into one live indicator and re-derives "Thinking" from journal reasoning instead of "no output yet".
- One live-turn indicator — the live turn renders a single spinner row labeled by
describeNativeChatActiveTurnLabel(provider activity → "Thinking" → "Working for Ns"); settled turns keepNativeChatWorkingStatus. Shared across desktop and mobile. - Reasoning is marked as reasoning —
AGENT_JOURNAL_THINKING_PRESENTATION('thinking') is stamped on Claude thinking items and Codex reasoning items (settled and streamed); Codexplanitems are deliberately not. - "Thinking" is derived from journal content — new
isStructuredAgentSessionThinkingscans the turn tail;selectNativeChatTurnStatusesnow takesthinkinginstead ofhasCurrentTurnResponse, andnativeChatTurnHasResponseis removed. - Reasoning text stays off the indicator —
selectStructuredAgentTurnActivityskips'thinking'status rows. - Bridge-lane write seams extracted — the four mobile prompt/interrupt hooks move into
use-mobile-bridge-chat-prompt-writes(behavior-preserving).
⚠️ Claude's "Thinking" is suppressed during the actual reasoning phase
For Claude, streamed thinking is never journaled as reasoning rows: handleStream only persists text deltas through streamedText, and the marked thinking status row is appended in handleMessage once the message settles. So during extended thinking the journal tail is just the running turn record, isStructuredAgentSessionThinking reads false, and the indicator shows "Working for Ns". "Thinking" only appears in the brief window after a thinking block settles and before the next item lands — arguably the reverse of what the headline intends. Codex streams reasoning and gets "Thinking" live. This is a real fidelity gap for the provider whose thinking is usually the longest; worth confirming the tradeoff is intended (or journaling Claude's streamed thinking).
Technical details
# Claude reasoning not journaled during streaming
## Affected sites
- `src/main/claude/claude-structured-journal-translation.ts:126` — `handleStream` persists only text deltas (`streamedText.append(delta.identity, delta.text)`); no thinking-delta path.
- `src/main/claude/claude-structured-journal-translation.ts:183` — thinking `status` row (marked `presentation: AGENT_JOURNAL_THINKING_PRESENTATION`) is appended in `handleMessage`, i.e. at settlement.
- `src/shared/structured-agent-session-live-turn.ts:33` — `isStructuredAgentSessionThinking` reads the journal tail; a running turn record alone returns false.
## Required outcome
- Confirm whether "Working for Ns" during Claude extended thinking is the intended behavior, or make Claude's in-progress reasoning visible to the indicator (e.g. journal streamed thinking deltas as reasoning rows, mirroring Codex's streamed-reasoning path).
## Open questions for the human
- Is Claude extended thinking common enough that losing the "Thinking" signal during it matters? The PR's own Claude visual proof shows "Working for 16s", suggesting the author may already consider this acceptable.ℹ️ Nitpicks
selectStructuredAgentTurnActivityskips onlyAGENT_JOURNAL_THINKING_PRESENTATION, so a Codexplan-documentrow still surfaces its text on the one-line indicator. The PR's own rationale ("reasoning is the turn's content, not what it is doing") applies equally to a plan, which the PR describes as "a durable artifact, not what the model is doing right now" — consider excludingplan-documenttoo, or documenting why plans stay on the line.NativeChatWorkingStatus's live/active state is now dead in the app: it is only rendered forworkedSeconds != null(and settled statuses hardcodethinking: false), so itsthinkingprop,countingpath, and thedata-native-chat-turn-status={workedSeconds == null ? 'active' : 'settled'}branch are unreachable outside its own unit tests.NativeChatTurnActivityLine'sstatus == nullfallback is likewise unreachable (turnStatuses.activeis non-null wheneverisWorking). Consider trimming the settled component down to its settled-only shape.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/shared/native-chat-turn-activity.ts (1)
94-94: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winStop the activity scan at a reasoning message.
When
selectStructuredAgentTurnActivityscans[running turn, status, message(role: 'reasoning')], it skips the reasoning message and returns the older status. Both renderer and mobile consumers prioritize this activity text overThinking. Resolve matching provider activity first, then returnnullwhen the scan reaches reasoning. Add a regression test for this order.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: 396ce599-91f9-432f-bc00-b3970ea2ab05
📒 Files selected for processing (17)
mobile/src/session/MobileNativeChatMessage.test.tsmobile/src/session/MobileNativeChatMessage.tsxmobile/src/session/MobileNativeChatView.test.tsmobile/src/session/MobileNativeChatView.tsxmobile/src/session/use-mobile-native-chat-turn-disclosure.tsmobile/src/session/use-mobile-structured-turn-indicator.test.tsxsrc/main/claude/claude-structured-journal-translation.test.tssrc/main/claude/claude-structured-journal-translation.tssrc/main/codex/codex-notice-item-translation.test.tssrc/main/codex/codex-structured-item-translation.test.tssrc/main/codex/codex-structured-item-translation.tssrc/main/codex/codex-structured-journal-translation-settlement.test.tssrc/renderer/src/components/native-chat/NativeChatMessageList.turn-indicator.test.tsxsrc/shared/native-chat-turn-activity.test.tssrc/shared/native-chat-turn-activity.tssrc/shared/structured-agent-session-live-turn.test.tssrc/shared/structured-agent-session-live-turn.ts
🚧 Files skipped from review as they are similar to previous changes (1)
- src/shared/native-chat-turn-activity.test.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 7 remain after this review.
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
Reviewed the follow-up commit that tightens live-turn reasoning state since the prior Pullfrog review.
- Turned reasoning into transcript content — Claude and Codex reasoning rows changed from
kind: 'status'+presentation: 'thinking'tokind: 'message'+role: 'reasoning', andAGENT_JOURNAL_THINKING_PRESENTATIONwas deleted (both desktop and mobile already render thereasoningrole). - Rewrote
isStructuredAgentSessionThinking— it now reads the newest non-chrome content and reports thinking only while the turn record isrunningand that content is reasoning, fixing completed-turn reasoning leaking into the next pending dispatch and stopping on a pending approval/question. - Moved the mobile live indicator to the list footer — the live status row now renders at the turn tail (desktop parity) rather than under the user message; settled turns keep their "Worked for N" row under the user message.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
Final review status: CLEANReviewed and fixed through two substantive rounds plus a final adversarial rereview on head Issues found and fixed
Judgments
Verification
Rendered proofDesktop live provider activity — exactly one activity row and one spinner: Desktop pending dispatch — exactly one tail indicator and one spinner: Native iOS, real paired Codex tool turn — exactly one Remaining gapsLive Windows/Linux/WSL/SSH UI and permission/interrupted journeys were not exercised. CI did pass Windows packaging and the shared compatibility/type/test gates. Future PR suggestionsNone. |
|
Conflict resolution status:
Fresh final-head CI completed successfully: all required checks are green. Remaining live-validation gaps are Windows/Linux/WSL/SSH UI and permission/interrupted journeys. |
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
Reviewed the two origin/main merge commits that rebased the branch onto the windowed-transcript architecture and ported the single-indicator behavior onto it.
- Ported the indicator onto the slot builder —
native-chat-transcript-slots.tsnow reserves an inline status slot only for settled turns (candidateStatus?.workedSeconds != null), so the running turn's live state is owned entirely by the tailNativeChatTurnActivityLine.showTypingIndicatorwas dropped from the slot input since the tail indicator subsumes it. - Wired the tail indicator through
status—NativeChatMessageListpassesturnStatuses.active(already carrying thethinkingmemo) intoNativeChatTurnActivityLine; settled durations still render under the originating user message viaNativeChatTranscriptRow. - Extracted
reasoningMessageBody— a behavior-preserving helper in the Codex structured-item translation; the reasoning-is-not-plan split predates this delta. - Updated tests — the turn-indicator suite installs a virtualizer viewport harness and the slots test was renamed to match the new ownership.
The adaptation is faithful to the pre-merge behavior: the running turn renders exactly one live indicator, settled turns keep their duration row, and Thinking still derives from journal reasoning content.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: 58f890ba-072f-408c-b488-49edca84e670
📒 Files selected for processing (10)
mobile/src/session/use-mobile-native-chat-controller.tssrc/main/claude/claude-structured-journal-translation.test.tssrc/main/codex/codex-structured-item-translation.test.tssrc/main/codex/codex-structured-item-translation.tssrc/renderer/src/components/native-chat/NativeChatMessageList.test.tsxsrc/renderer/src/components/native-chat/NativeChatMessageList.tsxsrc/renderer/src/components/native-chat/NativeChatMessageList.turn-indicator.test.tsxsrc/renderer/src/components/native-chat/native-chat-transcript-slots.test.tssrc/renderer/src/components/native-chat/native-chat-transcript-slots.tssrc/shared/structured-agent-session-projection.ts
💤 Files with no reviewable changes (1)
- src/renderer/src/components/native-chat/NativeChatMessageList.test.tsx
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.
| // "Thinking" is real reasoning content at the tail of the turn, not the absence | ||
| // of output — the latter reports thinking while the request is merely in flight. | ||
| const thinking = useMemo( | ||
| () => (journalItems ? isStructuredAgentSessionThinking(journalItems) : false), |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Pass the active transcript turn identity to the shared reasoning selector.
NativeChatMessageList and use-mobile-structured-agent-session derive thinking from journal items alone, then apply it to the latest transcript message. After a new message is submitted but before its journal turn record arrives, the previous running turn can make the new turn display “Thinking.” Update isStructuredAgentSessionThinking to require the active transcript turn identity, pass that identity from both surfaces, and add a regression test.




ELI5
While an agent is working, native chat showed two stacked rows saying nearly the same thing. Now desktop and mobile show one live row at the end of the transcript, and “Thinking” appears only while the current running turn’s newest meaningful content is reasoning.
What Changed
One live-turn indicator. The active turn renders one spinner row, using provider activity → “Thinking” → “Working for ” in priority order. Desktop and mobile share the label resolver. Settled turns keep their duration row under the originating user message.
Reasoning is first-class journal content. Claude thinking and Codex reasoning are translated to the existing typed journal shape
{ kind: 'message', role: 'reasoning', blocks: [...] }. This replaces the review version’s display-onlypresentation: 'thinking'marker and uses the same carrier already understood by persistence, wire schemas, transcript translation, and both renderers.Thinking is scoped to the current running turn. The scan routes through
readAgentJournalTurn, so typed and legacy lifecycle boundaries behave consistently. It requires the relevant turn record to berunning, preventing completed reasoning from a previous turn leaking into a newly pending dispatch. Tool calls, diffs, approvals, and questions end reasoning state.Provider activity is preserved. Ordinary status rows remain transparent to the reasoning scan because they are presentation chrome, while provider-authored activity still outranks “Thinking.” Codex’s non-reasoning streamed fallback remains a status row, so activity such as “Running a command” continues to render.
Why
The old UI had two competing owners for live state, and
thinking: !hasCurrentTurnResponsetreated “no response yet” as reasoning. A single tail indicator plus typed reasoning content removes both failure mechanisms instead of adding another display guard.Linked Issue
No existing issue — this follows #19822, which made working state visible from send time and exposed the duplicate rows.
Visual Proof
Before frames are from
origin/main. Attached frames are from the pre-sync feature head7492004773a697606c00debd9800db99013a4b11. After resolving conflicts, the desktop flow was revalidated with background Electron/CDP on exact final head26b9e9356d4f940b031f1da9b6be11863931c3c3; the native iOS frame remains from the pre-sync head. Row counts were asserted in the rendered UI/accessibility state, not only inspected visually.Before
Claude — two rows,
Working for 7saboveWorking…:Codex — two rows,
Working for 10saboveRunning a command:Final desktop
Live provider activity — exactly one indicator/spinner; activity progressed through
Thinking,Drafting a response, andRunning a command, matching the subscribed provider state:Pending dispatch — exactly one indicator/spinner with the duration fallback at the transcript tail:
Final native mobile
A real paired Codex turn showed assistant content, a shell tool row, and exactly one
Running a commandspinner beneath both at the transcript tail. The accessibility tree independently counted one running-command label and one in-progress indicator:Testing
Final-head validation:
pnpm tcand mobile’s owntsc --noEmitpassed.git diff --checkpassed; both lockfiles are unchanged.Not covered: Windows/Linux/WSL/SSH live UI and permission/interrupted journeys.
Review
Agent skill upstream boundary
Notes
Checklist