Skip to content

Native chat keeps scrolling to bottom - #20898

Merged
AmethystLiang merged 4 commits into
mainfrom
native-chat-keeps-scrolling-to-bottom
Sep 16, 2026
Merged

AmethystLiang merged 4 commits into
mainfrom
native-chat-keeps-scrolling-to-bottom

Conversation

@AmethystLiang

@AmethystLiang AmethystLiang commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 6 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​953 $\color{#cf222e}{\Huge{\mathbf{−}}}$​512 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​441
Prod 8 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​196 $\color{#cf222e}{\Huge{\mathbf{−}}}$​89 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​107

ELI5

What Changed

Why

Linked Issue

Fixes #

Visual Proof

Testing

  • I manually tested these changes locally
  • Automated tests added/updated, or explained why not below

AI Disclosure

Review

Agent skill upstream boundary

  • Not applicable, or this change follows docs/reference/agent-skill-sharing-upstream-boundary.md and copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

Ensure no issues in: Security, Cross-platoform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance

Checklist

  • This PR is small and focused
  • I explained what changed and why (including ELI5)
  • 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)

@coderabbitai

coderabbitai Bot commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 3ccc34c5-d7bb-4dc1-aef8-b9a9eacb5d09

📥 Commits

Reviewing files that changed from the base of the PR and between 5aa5a4d and 4885f4a.

📒 Files selected for processing (14)
  • src/renderer/src/components/native-chat/NativeChatMessageList.growth-windowing.test.tsx
  • src/renderer/src/components/native-chat/NativeChatMessageList.tsx
  • src/renderer/src/components/native-chat/NativeChatMessageList.windowing.test.tsx
  • src/renderer/src/components/native-chat/NativeChatResolvedView.tsx
  • src/renderer/src/components/native-chat/NativeChatStructuredSession.test-harness.tsx
  • src/renderer/src/components/native-chat/NativeChatStructuredSession.test.tsx
  • src/renderer/src/components/native-chat/NativeChatStructuredSession.tsx
  • src/renderer/src/components/native-chat/NativeChatStructuredSessionStatus.tsx
  • src/renderer/src/components/native-chat/native-chat-windowing-test-harness.tsx
  • src/renderer/src/components/native-chat/use-native-chat-transcript-scroll.test.tsx
  • src/renderer/src/components/native-chat/use-native-chat-transcript-scroll.ts
  • src/renderer/src/components/native-chat/use-native-chat-transcript-window.options.test.tsx
  • src/renderer/src/components/native-chat/use-native-chat-transcript-window.ts
  • tests/e2e/native-chat-history-prepend-anchor.spec.ts

📝 Walkthrough

Walkthrough

The change propagates transcript visibility from chat views to NativeChatMessageList and its windowing and scrolling hooks. Hidden viewports no longer receive scroll operations while their geometry is unavailable. Detached scroll positions are stored and restored when the viewport becomes visible. The test harness models hidden layout behavior, and unit, windowing, and end-to-end tests cover hidden updates, reveal restoration, and following behavior.

Merge Risk: ⚪ Minimal · up to 5aa5a

The available review context identifies no concrete merge-blocking behavior risk.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description includes the required headings but provides no substantive content. The ELI5, What Changed, Why, Linked Issue, Visual Proof, Testing, Review, Notes, and Checklist sections remain incom… Complete each required section. Add a high-level explanation, detailed change summary, rationale, a linked issue after “Fixes #”, visual proof or N/A with a reason, testing steps and platforms, AI disclosure if applicable, review notes, c…
Docstring Coverage ⚠️ Warning Docstring coverage is 13.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 30 functions across 14 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the primary change: native chat scrolling behavior keeps the transcript at the bottom when appropriate.
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.
Full details: Description check

Explanation

The description includes the required headings but provides no substantive content. The ELI5, What Changed, Why, Linked Issue, Visual Proof, Testing, Review, Notes, and Checklist sections remain incomplete.

Resolution

Complete each required section. Add a high-level explanation, detailed change summary, rationale, a linked issue after “Fixes #”, visual proof or N/A with a reason, testing steps and platforms, AI disclosure if applicable, review notes, cross-platform and compatibility considerations, and completed checklist items.

  • Fix all pre-merge checks with AI
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

Warning

Git: CodeRabbit could not clone the repository, so clone-backed analysis was skipped and this review may be incomplete. Verify repository clone access, such as SSH credentials, before requesting another full review. If clone access is intentionally unavailable, use path_filters to narrow the review scope.


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 — the visibility gating and the reveal-time offset restore are both sound. One test-fidelity note inline.

Reviewed changes

  • Auto-scroll suppressed while hidden — NativeChatMessageList threads a new isVisible prop into both transcript hooks; scrollToEnd and syncScrollState early-return while the pane is hidden, so a retained display:none pane can no longer be yanked to the bottom by appends it never paints.
  • Detached offset restored on reveal — the scroll hook records the reader's offset while detached and replays it on the false→true visibility edge through the virtualizer's new restoreScrollOffset, preserving the reading position across a hide/show. A reader who was still following is re-pinned to the end instead.
  • Call sites — NativeChatResolvedView and NativeChatStructuredSession both forward their pane visibility; these are the only two production renderers of the list, so the prop's true default is safe.
  • Tests — a new use-native-chat-transcript-scroll unit test, three windowing cases, an isVisible knob on the shared stubLayout harness, and an e2e hidden-update spec.

I traced scrollToOffset/getOffsetForAlignment in the pinned @tanstack/[email protected]: it writes the offset verbatim into scrollTop, so passing the captured raw scrollTop is consistent with the existing retired-measurement compaction call. No cross-session stale-offset issue was reachable either — NativeChatResolvedView keeps the list mounted across a session rebind, but syncScrollState re-records the offset as soon as the new content settles.

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

@AmethystLiang
AmethystLiang force-pushed the native-chat-keeps-scrolling-to-bottom branch from 63723bb to 3338b38 Compare September 16, 2026 04:19

@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 — one dead prop in the extracted status component.

Reviewed changes

Since the prior pullfrog review, the branch was rebased and one refactor commit landed (3338b38). Reviewed the delta:

  • Extracted the growth/append windowing suite — the transcript follow ownership across growth and appends block moved verbatim into a new NativeChatMessageList.growth-windowing.test.tsx, leaving the hidden-scroll-root cases (plus shared paint/settleVirtualizer helpers) in NativeChatMessageList.windowing.test.tsx.
  • Extracted NativeChatStructuredSessionStatus — the error line and background-tasks strip were pulled out of NativeChatStructuredSession into a new always-mounted component that now owns the stopping/expanded state; the parent keeps rendering NativeChatDeliveryRetry and NativeChatLaunchRetry itself.
  • Made the hidden-pane stub model display:none — stubLayout's retained scrollTop storage is now dropped on the visible→hidden edge, so a reveal can only read a reader's place back through production's restoreScrollOffset; list() gained an isVisible knob.
  • Added a visibility-forwarding test — NativeChatStructuredSession.test.tsx now asserts the pane's isVisible reaches the message list for both values.

I re-checked the prior inline note about reveal assertions not discriminating: with the restoreScrollOffset call removed, both hidden-update windowing cases now fail (expected +0 to be 2000), where the old harness left them green. The extracted suite is otherwise a faithful move, and all 53 tests across the touched files pass locally.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | 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

Since the prior pullfrog review (3338b38), one refactor commit landed (5aa5a4d), reviewed here:

  • Removed the unreachable retry branch from NativeChatStructuredSessionStatus — dropped the retryableOutboxEntry/onRetry props and the retry markup they gated. That branch could never render (its only call site passed null) and duplicated NativeChatDeliveryRetry, which the parent still mounts at NativeChatStructuredSession.tsx:289, so delivery retry is untouched.
  • Left the status component's stopping/expanded state in place — it remains in NativeChatStructuredSessionStatus, which the parent mounts unconditionally, so its state still survives the transient unmounts of the inner tasks strip exactly as the moved-out comment described.

The delta is a pure 35-line deletion across two files with no test or behavior surface; I verified every caller and confirmed no reference to the removed props remains.

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

Stop following new messages to bottom when the chat view is not visible
(e.g., in an inactive tab). Restore scroll position when the transcript
becomes visible again.
When a reader scrolls away from the latest messages and the chat tab becomes hidden, save their scroll position. If messages arrive while the tab is hidden, don't auto-scroll. When the tab is revealed, restore the saved offset instead of jumping to latest, preserving their reading context across hide/reveal cycles.
Move transcript growth/append test suite to dedicated growth-windowing.test.tsx file for better organization. Extract status rendering logic (errors, retry, background tasks) from NativeChatStructuredSession into NativeChatStructuredSessionStatus. Fix scroll offset preservation in test harness when transcript visibility toggles.
Remove unused retry functionality for failed message delivery from the native chat status component. The retryableOutboxEntry state is no longer managed, so the retry button and associated handling can be safely removed.
@AmethystLiang
AmethystLiang force-pushed the native-chat-keeps-scrolling-to-bottom branch from 5aa5a4d to 4885f4a Compare September 16, 2026 07:43
@AmethystLiang
AmethystLiang merged commit 15cac68 into main Sep 16, 2026
1 of 4 checks passed
Jinwoo-H added a commit that referenced this pull request Sep 16, 2026
main's tip fails `typecheck` and `static analysis` on
`NativeChatMessageList.windowing.test.tsx`: #20898 moved the growth/append
suite into its own file and took the last use of `NativeChatMessage` with
it, leaving the import. Every open PR reds both jobs through the merge ref,
so this rides the first branch that has to merge main in.
Jinwoo-H added a commit that referenced this pull request Sep 16, 2026
* feat(session-search): add ranked history panel search and consent

* test: wait for initial session indexing before refreshing results

* fix(lint): drop the type import #20898 left behind in the windowing test

main's tip fails `typecheck` and `static analysis` on
`NativeChatMessageList.windowing.test.tsx`: #20898 moved the growth/append
suite into its own file and took the last use of `NativeChatMessage` with
it, leaving the import. Every open PR reds both jobs through the merge ref,
so this rides the first branch that has to merge main in.
ivanvykopal pushed a commit to ivanvykopal/orca that referenced this pull request Sep 20, 2026
* fix(native-chat): prevent auto-scroll when transcript is hidden

Stop following new messages to bottom when the chat view is not visible
(e.g., in an inactive tab). Restore scroll position when the transcript
becomes visible again.

* fix(native-chat): preserve reader scroll offset when transcript is revea

When a reader scrolls away from the latest messages and the chat tab becomes hidden, save their scroll position. If messages arrive while the tab is hidden, don't auto-scroll. When the tab is revealed, restore the saved offset instead of jumping to latest, preserving their reading context across hide/reveal cycles.

* refactor(native-chat): extract growth-append tests and status component

Move transcript growth/append test suite to dedicated growth-windowing.test.tsx file for better organization. Extract status rendering logic (errors, retry, background tasks) from NativeChatStructuredSession into NativeChatStructuredSessionStatus. Fix scroll offset preservation in test harness when transcript visibility toggles.

* refactor(native-chat): remove retry UI

Remove unused retry functionality for failed message delivery from the native chat status component. The retryableOutboxEntry state is no longer managed, so the retry button and associated handling can be safely removed.
ivanvykopal pushed a commit to ivanvykopal/orca that referenced this pull request Sep 20, 2026
…lyai#20580)

* feat(session-search): add ranked history panel search and consent

* test: wait for initial session indexing before refreshing results

* fix(lint): drop the type import stablyai#20898 left behind in the windowing test

main's tip fails `typecheck` and `static analysis` on
`NativeChatMessageList.windowing.test.tsx`: stablyai#20898 moved the growth/append
suite into its own file and took the last use of `NativeChatMessage` with
it, leaving the import. Every open PR reds both jobs through the merge ref,
so this rides the first branch that has to merge main in.
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