Repository navigation
FW6-HIST: local-first history overlay for mobile touch scrolling - #96
Conversation
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…ning off Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
AI Lead integration fixes on FW6-HIST: - open gesture flipped to downward drag (content-follows-finger; brief had it inverted, colliding with the upward dismiss overscroll) - single pure gate shouldOpenHistoryOnGesture used by both touchmove paths - prepend compensation reads live scrollTop inside the rAF (no jump-back when scrolling during a load-older fetch) - loadingOlder state reset when the overlay closes mid-fetch - short histories bottom-anchor via flex mt-auto - journeys: upward-swipe no-op pin restored; History dialog pane-actions journey restored Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…9c51a) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
📝 WalkthroughWalkthroughTerminal history access for attached tmux sessions now opens an inline, virtualized overlay that fetches paginated scrollback locally. Touch routing, scrollback math, terminal integration, and journey coverage were updated accordingly. ChangesTerminal history overlay
Estimated code review effort: 4 (Complex) | ~60 minutes Sequence Diagram(s)sequenceDiagram
participant User
participant TerminalView
participant useTerminalTouchScroll
participant TerminalHistoryOverlay
participant ScrollbackAPI
User->>useTerminalTouchScroll: upward touch gesture
useTerminalTouchScroll->>TerminalView: onOpenHistory
TerminalView->>TerminalHistoryOverlay: open session overlay
TerminalHistoryOverlay->>ScrollbackAPI: getSessionScrollback range
ScrollbackAPI-->>TerminalHistoryOverlay: scrollback content
TerminalHistoryOverlay-->>User: virtualized history view
Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint install timed out. The project may have too many dependencies for the sandbox. 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: 1
🧹 Nitpick comments (2)
apps/dashboard/src/components/terminal/ScrollbackPager.tsx (1)
158-163: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winVirtualization math still duplicated; adopt
resolveScrollbackVirtualWindow.This file already switched to the shared
contentScrollbackLines/compensateScrollbackPrependhelpers (lines 13-14, 66, 124-130), but the equivalent start/end index computation here still reimplements the same overscan logic that now lives inresolveScrollbackVirtualWindow(scrollbackPaging.ts). Leaving both implementations around risks them silently diverging.♻️ Proposed refactor
- const startIndex = Math.max(0, Math.floor(scrollTop / LINE_HEIGHT) - OVERSCAN); - const endIndex = Math.min( - filteredLines.length, - startIndex + VIEWPORT_LINE_ESTIMATE + OVERSCAN * 2 - ); + const { startIndex, endIndex } = resolveScrollbackVirtualWindow({ + lineCount: filteredLines.length, + scrollTop, + viewportHeight: VIEWPORT_LINE_ESTIMATE * LINE_HEIGHT, + lineHeight: LINE_HEIGHT, + overscan: OVERSCAN, + });🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@apps/dashboard/src/components/terminal/ScrollbackPager.tsx` around lines 158 - 163, Replace the duplicated startIndex/endIndex virtualization calculation in ScrollbackPager with the shared resolveScrollbackVirtualWindow helper from scrollbackPaging.ts. Pass the existing scroll position, filtered line collection, viewport estimate, line height, and overscan inputs as required, then slice using the helper’s resolved window while preserving current rendering behavior.tests/journeys/fw6-focus.journey.spec.ts (1)
261-273: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winRestore the session-identity check for the pane-actions History dialog test.
The assertion was weakened from checking
scrollbackSessionIds.at(-1)torecorder.scrollbackRequests.length > 0, so this test no longer verifies the History dialog fetched scrollback for the correct session — only that some request happened. Since this test runs in isolation (no prior overlay activity), restoring the session-id check should be low-cost and would catch a regression where the dialog resolves the wrong pane/session.♻️ Proposed fix
- await expect.poll(() => recorder.scrollbackRequests.length).toBeGreaterThan(0); + await expect.poll(() => recorder.scrollbackSessionIds.at(-1)).toBe(sessionId);🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@tests/journeys/fw6-focus.journey.spec.ts` around lines 261 - 273, Restore the session-identity assertion in the pane-actions History dialog test after opening the dialog: verify the latest recorder.scrollbackSessionIds entry equals windowSession.id, replacing the weaker scrollbackRequests.length check while preserving the dialog visibility assertion.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@apps/dashboard/src/components/terminal/TerminalHistoryOverlay.tsx`:
- Around line 120-156: Keep the loading guard active until the
scroll-compensation requestAnimationFrame callback in loadOlder has applied
compensateScrollbackPrepend and updated scrollTop/setScrollTop. Move the
successful-load cleanup of loadingOlderRef.current and setLoadingOlder(false)
into that callback, while preserving generation checks and ensuring error or
stale-generation paths still release the guard without allowing a second load
before compensation.
---
Nitpick comments:
In `@apps/dashboard/src/components/terminal/ScrollbackPager.tsx`:
- Around line 158-163: Replace the duplicated startIndex/endIndex virtualization
calculation in ScrollbackPager with the shared resolveScrollbackVirtualWindow
helper from scrollbackPaging.ts. Pass the existing scroll position, filtered
line collection, viewport estimate, line height, and overscan inputs as
required, then slice using the helper’s resolved window while preserving current
rendering behavior.
In `@tests/journeys/fw6-focus.journey.spec.ts`:
- Around line 261-273: Restore the session-identity assertion in the
pane-actions History dialog test after opening the dialog: verify the latest
recorder.scrollbackSessionIds entry equals windowSession.id, replacing the
weaker scrollbackRequests.length check while preserving the dialog visibility
assertion.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: a0373229-dd20-467a-bc24-4b89b275efa6
📒 Files selected for processing (13)
apps/dashboard/src/components/TerminalView.tsxapps/dashboard/src/components/terminal/ScrollbackPager.tsxapps/dashboard/src/components/terminal/TerminalHistoryOverlay.tsxapps/dashboard/src/components/terminal/TerminalSurface.tsxapps/dashboard/src/components/terminal/scrollbackPaging.test.tsapps/dashboard/src/components/terminal/scrollbackPaging.tsapps/dashboard/src/hooks/useTerminalTouchScroll.test.tsapps/dashboard/src/hooks/useTerminalTouchScroll.tstasks/2026-07-21-fw6-hist-brief.mdtasks/2026-07-21-orchestration-handoff-heavisidelinux.mdtasks/frontend-ux-handoffs/fw6-hist.mdtasks/frontend-ux-log.mdtests/journeys/fw6-focus.journey.spec.ts
|
Re CodeRabbit's loading-guard note: acknowledged and reviewed. Because prepend compensation reads the live scrollTop inside the rAF (cc9c51a), a load-older triggered in the guard-release window computes against the already-grown scrollHeight and stays consistent — the effect is at most one eager page prefetch, not a position error. Leaving as-is to avoid coupling the guard lifetime to paint timing. |
Device finding 6 (owner, S25 Ultra): the FW6-TOUCH server-side scroll was slow, artifact-prone, and largely unusable; owner locked a local-first direction.
What changed
TerminalHistoryOverlay: downward drag on an attached tmux terminal opens a bottom-anchored, natively-scrolling local history surface fed by the existing capture-pane range scrollback API (500-line pages, auto load-older — effectively unlimited history). Swipe up at the bottom (or the Live pill) returns instantly to the live terminal; the WS attachment stays connected throughout.navigate {op:'scroll'}touch path and its rAF coalescer are removed from the dashboard (protocol/CP/agentd untouched for other callers), structurally eliminating both the round-trip latency and the escape-byte/repaint artifacts.Review chain
Known (inherited) limitation flagged to owner: capture-pane ranges are relative to the moving history end, so browsing while a pane streams can duplicate a band at page seams (same as the existing History dialog).
🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Bug Fixes
Tests