Skip to content

fix(web,mobile): keep substantive assistant prose outside the settled-turn fold - #8075

Closed
spiky02plateau wants to merge 1 commit into
pingdotgg:mainfrom
spiky02plateau:fix/keep-substantive-prose-unfolded
Closed

spiky02plateau wants to merge 1 commit into
pingdotgg:mainfrom
spiky02plateau:fix/keep-substantive-prose-unfolded

Conversation

@spiky02plateau

@spiky02plateau spiky02plateau commented Aug 24, 2026 •

Copy link
Copy Markdown
Contributor

When a settled turn folds behind the "Worked for ..." row, every assistant message between the first and the terminal one is hidden, regardless of what it contains. The server mints a separate message per assistant stream segment (segments close at tool boundaries), so a model that interleaves real prose with tool calls gets the substance of its reply folded: write three paragraphs of analysis, run a tool, close with "Done", and the analysis is invisible until the fold is clicked. With reasoning-heavy models this happens on most turns, and users report the majority of a reply routinely hidden.

The middle of a turn is only sometimes narration. "Looking around first." should fold; a multi-paragraph explanation of the root cause should not. Since nothing in the data model distinguishes the two, this adds a small shared predicate, isFoldableAssistantNarration in @t3tools/client-runtime/state/turn-fold: a mid-turn assistant message folds only when it is a single block (no blank-line paragraph break) of at most 240 characters. Web and mobile both apply it, so the two surfaces keep agreeing on what a fold contains. Everything else is unchanged: tool and work rows still fold, the first and terminal messages stay visible as today, agent-spawn rows keep their escape, and the running turn is never folded.

One boundary I left alone: the copy button still appears only on the terminal message, because showAssistantMeta doubles as the row-spacing signal in the timeline and decoupling them is a layout change of its own.

Verification

  • vp test run src/state/turnFold.test.ts in packages/client-runtime: 6 passed (boundary at 240, paragraph breaks, whitespace-only)
  • vp test run src/components/chat/MessagesTimeline.logic.test.ts in apps/web: 46 passed, including a new case asserting a long mid-turn message stays visible while tool rows still fold; the new case fails on main
  • vp test run src/lib/threadActivity.test.ts in apps/mobile: 20 passed, same new case for the mobile fold; also fails on main
  • tsgo --noEmit: clean in apps/web and packages/client-runtime; apps/mobile output byte-identical to the main baseline (pre-existing react-navigation noise only)
  • No existing test expectation changed; the short narration fixtures in the current fold tests still fold

Screenshots

Same seeded thread, identical crops, collapsed state in both (the fold was never expanded). The turn is: "Looking around first." / tool run / two-paragraph analysis / tool run / "Done. The fix is batching the rebuild."

Before, the analysis is inside the fold:

before

After, the analysis renders; the tool rows are still behind "Worked for 18s":

after

Change made by Claude Opus via Claude Code.


Note

Low Risk
Presentation-only fold heuristic on web and mobile; no auth, data, or protocol changes. Heuristic may still hide some mid-length single-paragraph answer text.

Overview
Stops the settled-turn “Worked for …” fold from hiding real mid-turn answer text. Stream segments close at tool calls, so one reply is often several messages; previously everything between the first and last assistant message was folded.

Web and mobile now share isFoldableAssistantNarration: a mid-turn assistant message folds only if it is a single block of at most 240 characters. Longer or multi-paragraph chunks stay visible; tool/work rows, first/terminal messages, and running turns are unchanged.

Reviewed by Cursor Bugbot for commit 57238e2. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

Keep substantive mid-turn assistant messages visible in settled-turn folds

  • Adds isFoldableAssistantNarration in turnFold.ts: an assistant message is foldable only if it is under 240 chars and contains no blank-line paragraph break.
  • Exposes this utility via the new ./state/turn-fold subpath export in package.json.
  • Updates deriveThreadFeedTurnFolds (threadActivity.ts) and deriveTurnFolds (MessagesTimeline.logic.ts) so mid-turn assistant messages that are not foldable narration stay visible instead of being hidden with other work entries.
  • Risk: any mid-turn assistant message shorter than FOLDABLE_NARRATION_MAX_CHARS with no paragraph break will still be folded; content that previously collapsed may now appear inline and change timeline scroll height.

Macroscope summarized 57238e2.

…-turn fold

A reply is minted as one message per provider stream segment, and a segment
closes on every tool call, so one answer routinely arrives as several messages
with tool activity between them. The settled-turn fold hid every assistant
message except the turn's first and last, which meant a reasoning-heavy model
interleaving prose with tools had most of its actual answer swallowed by the
"Worked for ..." row, with nothing to hint prose was inside.

Fold a mid-turn assistant message only when it reads as narration: a single
block with no paragraph break, under FOLDABLE_NARRATION_MAX_CHARS. Anything
longer or multi-paragraph is answer text and stays visible. The predicate lives
in @t3tools/client-runtime/state/turn-fold so web and mobile share one
definition. Terminal-message behavior, work-entry folding, agent-spawn escapes,
and unsettled-turn skips are unchanged.
@coderabbitai

coderabbitai Bot commented Aug 24, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: df1ec92a-471c-486c-b828-48aec306cba3

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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.

@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:M 30-99 changed lines (additions + deletions). labels Aug 24, 2026
@macroscopeapp

macroscopeapp Bot commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved at 57238e2

Macroscope's review found this PR approvable — This is a narrowly scoped settled-turn rendering fix: substantive assistant segments remain visible while short narration and work entries continue to fold. The only notable effect is potentially increased timeline height when previously hidden prose is displayed.

You can add or adjust custom eligibility rules. Learn more.

@iskandersierra

Copy link
Copy Markdown

I can reproduce the settled-turn folding behavior during an interactive interview flow.

The affected turn contains multiple assistant outputs: first a substantive Markdown question round, then a shorter progress/status or follow-up message. Once the turn settles, the UI keeps the last assistant entry visible and folds the earlier assistant output into the work section. As a result, the question list appears to be missing even though it was emitted and persisted normally.

Asking the agent to repeat the questions as plain text makes them visible because the repeated response is the terminal assistant output of a new turn. This suggests the issue is related to settled-turn folding and terminal-message selection, rather than question generation or data loss.

This appears to be another instance of the existing issue where substantive assistant prose is hidden when a turn ends with a shorter progress message. Keeping substantive assistant messages visible while folding only work/progress entries would address this case as well.

@t3-code

t3-code Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

closing this version as part of a pr cleanup at the request of @StiensWout.

a 240-character cutoff and paragraph breaks cannot reliably distinguish progress narration from substantive assistant output. short but important answers still get folded. a replacement should preserve assistant prose or use explicit metadata to identify progress messages, rather than infer importance from length.

thanks for the contribution. if you disagree with this decision, you are welcome to open a new pr, link back to this one, and explain how your proposal addresses these concerns or why a different approach is warranted.

@t3-code t3-code Bot closed this Sep 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M 30-99 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants