Skip to content

fix(native-chat): keep the prose before an answered question visible after the turn folds - #43724

Merged
AmoabaKelvin merged 1 commit into
mainfrom
f-question-prose-visible
Nov 18, 2026
Merged

AmoabaKelvin merged 1 commit into
mainfrom
f-question-prose-visible

Conversation

@AmoabaKelvin

@AmoabaKelvin AmoabaKelvin commented Nov 17, 2026 •

Copy link
Copy Markdown
Collaborator

ELI5

When an agent writes something for you (a table, a cost estimate, a draft) and then asks you a question about it, that text now stays on screen after you answer. Before, it disappeared behind "Worked for …" as soon as the turn finished, leaving only the question and the final reply.

Files Added Deleted Net
Test 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​47 $\color{#cf222e}{\Huge{\mathbf{−}}}$​4 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​43
Prod 4 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​24 $\color{#cf222e}{\Huge{\mathbf{−}}}$​9 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​15

What Changed

  • Before: a turn like "15 tool calls → a findings table → AskUserQuestion → you answer → more work → final reply" settled to: the "Asked: …" receipt and the final reply. The table you used to make the choice folded away with the tool work.
  • After: the prose that leads straight into the question stays visible next to its receipt. Tool work still folds as before.

Mechanism: the shared turn fold (src/shared/native-chat/transcript/folding/native-chat-turn-fold.ts) decides which rows of a settled turn are "answers" and stay visible. It already keeps the last reply, the reply before a steer or a Stop-hook send-back, and back-to-back replies. It had no idea a question is another place where the agent hands the turn to the person. Each fold row now carries an asks fact: the row holds an ask tool call (hasNativeChatAskCall: Claude AskUserQuestion, Codex async question) or carries a structured question receipt. nativeChatTurnAnswerRows keeps the latest prose when it is that row itself (terminal chats merge the ask call into the prose row) or the row drawn right before it (structured chats draw the question as its own row). Older narration that work followed still folds. nativeChatTurnFoldRow now takes the receipt rather than a hasReceipt boolean, so it can tell a question from an approval; desktop slots and mobile rows already had the receipt map.

Why

Root cause: nativeChatTurnAnswerRows treated a question as ordinary work, so the words written for the person to answer from were indistinguishable from narration once the turn settled.

Options considered:

  • Reuse endsAnswer (the steer rule) for question rows. Rejected: it runs before the current row can become the answer, so a terminal row whose own words lead into the question would not count, and it keeps any earlier prose in the turn, even narration far above the question.
  • Keep finished turns expanded (a setting, [Feature]: Setting to keep finished Chat UI turns expanded #23432). Rejected for this bug: it switches off folding for every turn instead of fixing which rows count as an answer.
  • Treat approvals the same way. Left out: prose before an approval is usually narration ("Let me run the tests"), and approvals are frequent, so settled turns would get much noisier.
  • Chosen: a question boundary in the fold owner. One shared rule covers desktop and mobile, terminal and structured chats.

Agents checked: Claude terminal chat (ask call merged into the prose row), Claude structured chat (question row with a receipt, confirmed live), Codex async questions (request_user_input_async via isNativeChatAskCall), and ACP/structured agents whose questions land as journal question items (same receipt path).

Linked Issue

Fixes #32073

#43602: the "after it is answered" half is fixed here. The "while it is pending" half did not reproduce. A pending question keeps the turn running on both routes: on terminal chats Claude's PreToolUse hook for AskUserQuestion reports waiting, which keeps turnActive true (native-chat-terminal-turn.ts); on structured chats the SDK holds canUseTool open, so the turn never settles and nothing folds. In a live run the findings table stayed visible above the open card (screenshot below).

Visual Proof

Structured Claude chat in a hidden dev build, real Claude CLI 2.1.326 against a local fake Anthropic API (3 Bash calls → findings table → AskUserQuestion → answer → 1 Bash call → final reply).

While the question is open (main and this branch alike; nothing folds):

pending-structured.png

Before (main), after answering After (this branch), after answering
before-settled.png after-settled.png

Testing

  • Live repro on macOS (above): before, the table folded after the answer; after hot-reloading this change, the same settled turn keeps the table and still folds "Ran 3 commands".

  • New case in native-chat-turn-fold.test.ts covers the terminal shape (words and ask call in one row), the structured shape (question row with a receipt), and prose that work followed staying folded. It fails without the fix (answers [5] instead of [3, 5]).

  • Focused tests: native-chat-turn-fold.test.ts, native-chat-side-chat-fork-point.test.ts, native-chat-message-list-projection.test.ts, mobile use-mobile-native-chat-transcript-rows.test.tsx; pnpm check:changed.

  • I manually tested these changes locally

  • Automated tests added/updated, or explained why not below

  • Every added test fails without this change and avoids the test anti-patterns

Risk

Riskiest part: settled turns that contain a question now show one more prose row than before. If the rule misfired, a turn would show a bit of extra prose (never hide more than before). Pure client-side rendering; no saved data, wire or host change, so mixed-version phones and hosts are unaffected. Back out with a plain revert.

Level: Low

AI Disclosure

Review

review-loop, one round (Codex + Claude): no P0/P1. Taken: keep only prose that leads straight into the question (not any earlier narration). Left: a recovered system error directly before a question could be the kept row (rare, P3); an ask call whose result errored still counts as a question, matching isNativeChatAskCall used by work runs.

Agent skill upstream boundary

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

Shared module used by desktop and mobile, so the phone gets the same behaviour. No platform, SSH or folder-workspace specific code. Per-row cost is one cached some() over the row's blocks.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • I stated the risk: what could break, for whom, and how to back it out
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

…in a settled turn

The turn fold kept only a settled turn's last reply as its answer, so the words an agent wrote right before AskUserQuestion folded behind "Worked for" once the person answered and the turn went on. A row that asks the person (an ask tool call, or a structured question receipt) now keeps the prose leading straight into it visible, on desktop and mobile, for terminal and structured chats.
@coderabbitai

coderabbitai Bot commented Nov 17, 2026

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Transcript rows now receive resolved prompt receipts instead of receipt-presence booleans. Row derivation identifies questions from receipts or ask calls. Answer folding retains the latest candidate assistant prose when a question occurs on that row or the immediately preceding drawn row. Tests cover questions represented by ask calls and resolved receipts.

Severity of issue fixed: Medium

Merge Risk: Minimal · up to a3c6e

This change keeps the prose that leads into an answered question visible after the turn folds. No concrete merge-blocking risk was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the change: prose before an answered question stays visible after the turn folds. It fits the changeset, which adds a question boundary to the native-chat turn fold rule. It uses a con…
Description check Passed The description follows the repository template closely. It has ELI5, What Changed, Why, Linked Issue (Fixes #32073), Visual Proof with before and after images, Testing, Risk with level Low, AI Disclo…
Linked Issues check Passed Issue #32073 asks that assistant prose directly preceding a question stay visible after the turn settles. The diff to native-chat-turn-fold.ts adds an asks fact to each fold row (`hasNativeChatAskCa…
Out of Scope Changes check Passed All changed files relate to the objective. The core change is in native-chat-turn-fold.ts. The signature change from hasReceipt: boolean to receipt is propagated to its callers: mobile use-mobile-…
Full details: Title check

Explanation

The title names the change: prose before an answered question stays visible after the turn folds. It fits the changeset, which adds a question boundary to the native-chat turn fold rule. It uses a conventional fix(native-chat) prefix and is one sentence. It is a little long at 89 characters, but it is specific and accurate.

Full details: Description check

Explanation

The description follows the repository template closely. It has ELI5, What Changed, Why, Linked Issue (Fixes #32073), Visual Proof with before and after images, Testing, Risk with level Low, AI Disclosure (left blank), Review, Agent skill upstream boundary, Notes, and Checklist. It explains the mechanism, the alternatives considered, and the backout plan. Remaining gaps are minor: the AI Disclosure section is empty, and the pnpm lint, typecheck, test, and build checklist item is unchecked.

Full details: Linked Issues check

Explanation

Issue #32073 asks that assistant prose directly preceding a question stay visible after the turn settles. The diff to native-chat-turn-fold.ts adds an asks fact to each fold row (hasNativeChatAskCall(message.blocks) or a receipt with kind === 'question'). nativeChatTurnAnswerRows now adds the latest candidate prose to answers when that prose is the asking row itself or the row drawn immediately before it. Earlier narration that work followed still folds. This matches the issue's first proposed outcome and its 'directly precedes' condition. The mobile and desktop call sites pass the resolved receipt, so both surfaces use the same rule. The issue's pending-state behaviour is not a coding requirement the PR must change; the PR author reports it did not reproduce. Tests for the terminal shape, structured shape, and folded-narration case are described in the PR. I did not run them. Visual blocks in the kept prose are retained with the row, as the issue requires.

Full details: Out of Scope Changes check

Explanation

All changed files relate to the objective. The core change is in native-chat-turn-fold.ts. The signature change from hasReceipt: boolean to receipt is propagated to its callers: mobile use-mobile-native-chat-transcript-rows.ts, desktop native-chat-transcript-slots.ts, and native-chat-generated-image-answers.ts (which passes undefined). These edits are required for the new signature. The test file updates cover the new behaviour. No unrelated behaviour change was found in the reviewed diff hunks.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 77efd442-f81c-456b-977e-b9bdf0f0eb78
Commits

Reviewing files that changed from the base of the PR and between ebaa257 and a3c6eef.

Files selected for processing: 5

  • mobile/src/session/native-chat/transcript/turn-state/use-mobile-native-chat-transcript-rows.ts
  • src/renderer/src/components/native-chat/conversation/slots/native-chat-transcript-slots.ts
  • src/shared/native-chat/transcript/folding/native-chat-turn-fold.test.ts
  • src/shared/native-chat/transcript/folding/native-chat-turn-fold.ts
  • src/shared/native-chat/transcript/images/native-chat-generated-image-answers.ts

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

@AmoabaKelvin
AmoabaKelvin merged commit 96e2e86 into main Nov 18, 2026
76 of 78 checks passed
nwparker added a commit to Pr1p/orca that referenced this pull request Nov 24, 2026
A settled turn keeps back-to-back replies visible but folds a reply that
work follows. Reasoning rows advanced the per-turn "previous drawn row"
pointer, so a reply split by interleaved thinking (text -> thinking ->
text) looked like a reply followed by work, and the collapsed turn showed
only the text after the last thinking block.

Reasoning rows no longer move that pointer. Prose rows separated only by
thinking are linked so the pieces show or fold together: a split reply
that ends the turn (or leads into another reply, a question or a steer)
stays visible in full, and one that work follows folds in full instead of
leaving a lone first fragment.

Intended side effect: words -> thinking -> AskUserQuestion now keeps the
words visible, since the question check no longer sees the thinking row
as the row before it. This matches the intent of stablyai#43724.

Fixes stablyai#48352

Co-authored-by: Neil <[email protected]>
nwparker added a commit that referenced this pull request Nov 24, 2026
#48353)

A settled turn keeps back-to-back replies visible but folds a reply that
work follows. Reasoning rows advanced the per-turn "previous drawn row"
pointer, so a reply split by interleaved thinking (text -> thinking ->
text) looked like a reply followed by work, and the collapsed turn showed
only the text after the last thinking block.

Reasoning rows no longer move that pointer. Prose rows separated only by
thinking are linked so the pieces show or fold together: a split reply
that ends the turn (or leads into another reply, a question or a steer)
stays visible in full, and one that work follows folds in full instead of
leaving a lone first fragment.

Intended side effect: words -> thinking -> AskUserQuestion now keeps the
words visible, since the question check no longer sees the thinking row
as the row before it. This matches the intent of #43724.

Fixes #48352

Co-authored-by: Neil <[email protected]>
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.

[Feature]: Keep the prose that precedes a question visible after the turn settles

1 participant