Skip to content

fix(chat): hide empty assistant messages on desktop and mobile - #46311

Open
zhaoge0202 wants to merge 2 commits into
stablyai:mainfrom
zhaoge0202:fix/hide-empty-chat-messages
Open

zhaoge0202 wants to merge 2 commits into
stablyai:mainfrom
zhaoge0202:fix/hide-empty-chat-messages

Conversation

@zhaoge0202

@zhaoge0202 zhaoge0202 commented Nov 21, 2026 •

Copy link
Copy Markdown

ELI5

Empty assistant messages should not look like replies. This removes blank Chat rows and their orphaned copy/scroll controls on desktop and mobile while keeping meaningful messages visible.

What Changed

  • Share a display-content predicate between desktop and mobile transcript projection.
  • Skip assistant entries containing only whitespace, empty text, or no blocks before tool folding, so they cannot reserve rows or split adjacent tool work.
  • Preserve text, images, tool calls/results, subagent and background-task status, semantic notices/cards, and shortened content. A blank streaming entry becomes visible when text arrives.
  • Keep the upstream removal of the old UI projection test files (test: cut the suite to the tests that guard real invariants #46786), and validate the production behavior with a local runtime smoke script after syncing main.

Why

Filtering at projection time removes the transcript slot and keeps tool grouping correct. Hiding the text or controls alone would leave layout gaps or change grouping. The source transcript and persisted messages are unchanged.

Linked Issue

Fixes #46310

Visual Proof

The same fixed synthetic transcript, English UI, dark theme, and 560 × 420 component viewport. These are isolated shipping-component reproductions: before renders the unfiltered transcript slots with the existing row components; after uses the fixed NativeChatMessageList. The after view additionally has the real list's message rail. No account or conversation data is included.

Before After
Before: empty reply leaves copy, scroll, and timestamp controls After: empty reply is absent and controls stay with real text

Light-theme captures were also checked; neither theme reported page errors.

Testing

  • The reporter manually verified the development build before this main-branch sync. No new physical-device or live SSH verification was performed during the sync.
  • At cfe1643e2d0, a local runtime smoke directly exercised the real desktop and mobile projection entry points. It checked blank/empty message filtering, tool grouping, preservation of images, semantic notices, shortened entries, subagents, background tasks and Orca cards, and blank-to-text-to-blank streaming updates.
  • pnpm check:changed --base=upstream/main: all 38 selected checks passed in 51.9 seconds against upstream 9e2fd8d57c2.
  • The old projection test files were deleted upstream in test: cut the suite to the tests that guard real invariants #46786 and remain deleted, following the current policy against committing UI projection unit tests. The smoke script is local validation and is not committed.
  • Earlier desktop/mobile unit-test counts and screenshots refer to the original fix commit c1c29a7e635. The production changes are byte-identical after the sync; no new screenshots were captured for the merge commit.
  • Upstream CI is awaiting maintainer approval. These are local validation results, not a claim that the remote CI matrix has passed.

Performance

Desktop projection adds a visibility pass over messages; mobile source preparation checks each source when it is prepared. Whitespace-only text checks may scan the relevant strings. Existing block derivations retain their WeakMap cache, and the predicate does not generate markdown. No additional I/O, network requests, subprocesses, or persistent data are introduced. Filtering empty entries avoids their later folding and rendering work. This trade-off was assessed from the code; no dedicated large-transcript performance benchmark was run.

Risk

Level: Low

The main risk is incorrectly hiding a metadata-only assistant entry. The predicate preserves semantic text metadata, cards, tools, images, raw and grouped subagent status, background tasks, and shortened content. The local runtime smoke covers preservation and later streaming text. This only changes display projection: no provider requests, journal storage, permissions, or runtime protocols change. A plain revert restores the previous rendering; there is no data migration to undo.

AI Disclosure

OpenAI Codex (GPT-6) assisted with implementation, regression tests, review, and PR preparation. The reporter manually verified the development build's visual behavior.

Review

Agent review checked desktop/mobile parity, tool folding, streaming updates, and preservation of meaningful non-text content; it identified and fixed raw subagent-row preservation before submission. The change uses shared, platform-neutral presentation logic and introduces no platform paths, shortcuts, IPC, or remote protocol changes. Local, SSH/remote, and folder-workspace transcripts use the same projection. Block derivations retain their WeakMap cache, and the predicate does not build markdown. No new network, filesystem, credential, or execution surface is added. Existing Chat components, layout, and design tokens are retained.

Agent skill upstream boundary

  • Not applicable: no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation is copied or translated.

Notes

The unrelated 0 ms tool-duration issue is outside this PR. Local Corepack/cache and SDK fixes are not included. Screenshots are attachments; temporary capture fixtures are not committed.

Checklist

  • This PR is small and focused
  • I explained what changed and why, including ELI5 and the mechanism
  • I stated what could break, for whom, and how to revert
  • Before/after screenshots attached, with reproduction method stated
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, mobile, and compatibility impact considered
  • Repository-selected local checks passed on the updated branch.
  • Upstream CI: pending maintainer approval.

@coderabbitai

coderabbitai Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The change adds shared helpers to detect whether a native chat message has visible content. Desktop and mobile projections use the helpers to omit visually empty assistant messages. Tests cover blank messages, retained content and tool grouping, and a pending reply that appears after it receives text.

Severity of issue fixed: Medium

Merge Risk: Minimal · up to c1c29

This change hides blank assistant entries in desktop and mobile Chat while keeping meaningful content visible. No concrete merge-blocking risk was found, and the source transcript is unchanged.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title "fix(chat): hide empty assistant messages on desktop and mobile" matches the main change. The changeset filters visually empty assistant messages (whitespace-only, empty text, or no blocks) …
Linked Issues check Passed Issue #46310 requires that assistant entries with no visible content not reserve Chat rows or split tool grouping. It also requires that entries with text, images, tools, worker/task status, semantic …
Out of Scope Changes check Passed All changed areas support the linked objective of hiding blank assistant entries in Chat projection:
- Shared predicate in src/shared/native-chat/transcript/row-content/native-chat-row-content.ts, u…
Description check Passed The description covers the required sections: ELI5, What Changed, Why, Linked Issue (Fixes #46310), Visual Proof (before/after images), Testing, Performance, Risk (Level: Low), AI Disclosure, Review, …
Full details: Title check

Explanation

The title "fix(chat): hide empty assistant messages on desktop and mobile" matches the main change. The changeset filters visually empty assistant messages (whitespace-only, empty text, or no blocks) out of the desktop and mobile Chat projections, and the PR objectives describe the same behavior. The title is concise and specific, and it follows a conventional commit style.

Full details: Linked Issues check

Explanation

Issue #46310 requires that assistant entries with no visible content not reserve Chat rows or split tool grouping. It also requires that entries with text, images, tools, worker/task status, semantic notices, or shortened content stay visible, and that a blank streaming entry appear when text arrives.

The summary shows these changes:

  • nativeChatMessageHasVisibleContent and isVisuallyEmptyNativeChatAssistantMessage in src/shared/native-chat/transcript/row-content/native-chat-row-content.ts define visibility. Visible content includes nonblank text, images, tools, subagent groups or blocks, background tasks, Orca cards, shortened messages, and nonblank drawnMarkdown.
  • Desktop projection (src/renderer/.../native-chat-message-list-projection.ts) filters visually empty assistant messages before unit reuse and before tool folding. This keeps tool grouping intact.
  • Mobile projection (mobile-native-chat-render-data.ts) excludes visually empty messages in isMobileNativeChatSource.
  • Desktop tests cover omission of whitespace-only, empty, and empty-text-block messages, including before tool runs. They also cover preservation of turn notices, shortened messages, subagent rows, and the final answer. Mobile tests cover omission of blank messages, preservation of commentary, tools, images, partial text, notices, and subagent rows, and appearance of a streamed reply once text arrives.

Each expected behavior in #46310 maps to a code change and a test. The summary does not show an unmet coding requirement. Tool-duration (0 ms) reporting is excluded by the issue and is not part of this PR.

Limitation: this verdict relies on the change summary and the PR's reported test results. I did not read the hunks directly.

Full details: Out of Scope Changes check

Explanation

All changed areas support the linked objective of hiding blank assistant entries in Chat projection:

  • Shared predicate in src/shared/native-chat/transcript/row-content/native-chat-row-content.ts, used by both clients.
  • Desktop projection filter in native-chat-message-list-projection.ts and its tests.
  • Mobile projection filter in mobile-native-chat-render-data.ts and its tests.

The PR does not change persisted messages, the source transcript, provider requests, IPC, permissions, or storage. The PR description states that tool-duration, Corepack/cache, and SDK fixes are excluded, and the summary shows no such changes. Test additions support the behavior change and do not expand scope.

Limitation: this verdict relies on the change summary. I did not inspect the full diff.

Full details: Description check

Explanation

The description covers the required sections: ELI5, What Changed, Why, Linked Issue (Fixes #46310), Visual Proof (before/after images), Testing, Performance, Risk (Level: Low), AI Disclosure, Review, the agent skill upstream boundary checkbox, Notes, and Checklist. It explains the mechanism (projection-time filtering before tool folding), the risk, and how to revert. Testing results and screenshots are documented in detail. Minor gaps: the Testing section does not check the template's test-related checkboxes, and the PR is described as having both desktop and mobile verification, but the Testing section cites a local smoke script that is not committed. These gaps are non-critical.

  • 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: dd3f7512-b984-47f1-95a3-f80dc1fdc4df
Commits

Reviewing files that changed from the base of the PR and between 618955b and c1c29a7.

Files selected for processing: 5

  • mobile/src/session/native-chat/transcript/projection/mobile-native-chat-projection.test.tsx
  • mobile/src/session/native-chat/transcript/projection/mobile-native-chat-render-data.ts
  • src/renderer/src/components/native-chat/conversation/projection/native-chat-message-list-projection.test.ts
  • src/renderer/src/components/native-chat/conversation/projection/native-chat-message-list-projection.ts
  • src/shared/native-chat/transcript/row-content/native-chat-row-content.ts

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

This branch has not been deployed

No deployments
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.

[Bug]: Empty assistant messages leave blank Chat rows and orphaned controls

1 participant