Skip to content

fix(mobile): native touch scroll-back in attached tmux terminals (FW6-SCROLL) - #94

Merged
cvsloane merged 12 commits into
mainfrom
refactor/frontend-command-center
Jul 21, 2026
Merged

cvsloane merged 12 commits into
mainfrom
refactor/frontend-command-center

Conversation

@cvsloane

@cvsloane cvsloane commented Jul 21, 2026 •

Copy link
Copy Markdown
Owner

Summary

Fixes owner device finding: swipe-scrolling an attached tmux terminal on mobile showed no history.

Root cause (verified with byte-level probes): an attached tmux client always runs the outer terminal on the alternate screen, where xterm's local scrollLines — what touch scrolling called — is a no-op. Live swipe scroll-back never worked in attached mode; the pre-Wave-6 stream view (plain DOM scroll) masked the gap, and attach-everywhere + Focus made it the primary surface.

Fix: vertical touch drag and momentum now synthesize SGR mouse-wheel reports at the finger's cell position whenever the buffer is alternate, mouse tracking is active (tmux mouse on — set on both hosts), and the connection is writable. tmux then scrolls copy-mode natively (verified working while zoomed, auto-exits at bottom) and passes wheel through to alt-screen TUIs (codex transcript scrolls itself) — identical to native desktop tmux behavior, which is why trackpad scroll already worked. Normal-buffer terminals keep the existing local-scroll path; read-only terminals send nothing.

Also fixes a second defect found during diagnosis: after an FW6-FOCUS in-session switch, the History pager captured scrollback for the originally-attached session instead of the selected one (historySessionId now threads the selected session; the WebSocket keeps its attachment identity).

Review chain

  • Lane FW6-SCROLL frozen at 3f085d9 (green full gate, attempt 1); AI Lead review: SHIP clean, firewall clean. Pure dashboard change — no protocol, agentd, or CP edits; no binary rollout needed.
  • Integration gate attempt 1 surfaced a latent timing-sensitive journey (scrollback pager asserted the oldest virtualized line right after open, racing the bottom-anchor rAF — 1/10 isolated failure). Made deterministic (assert count → pin viewport top → assert content); 10/10 green. Two unrelated load flakes verified 10/10 green isolated and backlogged for a stabilization pass.
  • Integration gate attempt 2 fully green: lint, typecheck, 515 unit tests, 21/21 smoke, 30 journeys, production build.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Improved mobile terminal scrolling, including touch scrolling through attached sessions and tmux panes.
    • Touch scrolling now targets the touched terminal area and supports momentum scrolling.
    • Terminal history now stays aligned with the currently selected session during navigation.
  • Bug Fixes

    • Restored scrollback access in attached terminals where standard scrolling was ineffective.
    • Improved reliability of history loading and mobile interaction flows.
  • Tests

    • Added coverage for touch scrolling, session-specific history, and mobile terminal journeys.

cvsloane and others added 12 commits July 21, 2026 01:58
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…orts + pager session fix

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The pager bottom-anchors and virtualizes rows, so asserting the oldest line right after open raced the anchor rAF. Assert the line count, pin the viewport to the top, then assert content. 10x repeat green.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jul 21, 2026 •

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: e14e0c44-e064-4b86-9c48-4515a1e99f95

📥 Commits

Reviewing files that changed from the base of the PR and between 7b21b26 and ecf6c82.

📒 Files selected for processing (11)
  • BACKLOG.md
  • apps/dashboard/src/components/TerminalView.tsx
  • apps/dashboard/src/components/terminal/PersistentTerminalHost.tsx
  • apps/dashboard/src/hooks/useTerminalTouchScroll.test.ts
  • apps/dashboard/src/hooks/useTerminalTouchScroll.ts
  • tasks/2026-07-21-fw6-scroll-brief.md
  • tasks/frontend-ux-handoffs/fw6-scroll.md
  • tasks/frontend-ux-log.md
  • tests/journeys/command-center.journey.spec.ts
  • tests/journeys/controlPlaneMock.ts
  • tests/journeys/fw6-focus.journey.spec.ts

📝 Walkthrough

Walkthrough

Changes

Terminal scroll-back

Layer / File(s) Summary
Touch scroll dispatch
apps/dashboard/src/hooks/useTerminalTouchScroll.ts, apps/dashboard/src/hooks/useTerminalTouchScroll.test.ts
Touch deltas are mapped to clamped terminal cells and tmux SGR wheel reports when the terminal is writable, alternate-buffered, and mouse-tracked; other cases retain direct scrolling or no-op behavior.
Terminal and history identity wiring
apps/dashboard/src/components/TerminalView.tsx, apps/dashboard/src/components/terminal/PersistentTerminalHost.tsx
historySessionId is threaded to ScrollbackPager, while writable state and scroll input callbacks are passed to the touch-scroll hook.
Journey validation and mock coverage
tests/journeys/controlPlaneMock.ts, tests/journeys/fw6-focus.journey.spec.ts, tests/journeys/command-center.journey.spec.ts
Journey mocks record scrollback sessions and terminal output; tests cover touch wheel input, session switching, and deterministic history virtualization.
FW6 specification and handoff records
tasks/2026-07-21-fw6-scroll-brief.md, tasks/frontend-ux-handoffs/fw6-scroll.md, tasks/frontend-ux-log.md, BACKLOG.md
Task, handoff, program-log, and backlog records document the scroll-back implementation, verification, and follow-up items.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant TerminalView
  participant useTerminalTouchScroll
  participant dispatchTerminalTouchScroll
  participant XTerminal
  TerminalView->>useTerminalTouchScroll: Provide writable state and scroll input callback
  useTerminalTouchScroll->>dispatchTerminalTouchScroll: Dispatch drag or momentum delta
  dispatchTerminalTouchScroll->>XTerminal: Scroll directly or emit SGR wheel input
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: enabling native touch scroll-back for attached tmux terminals on mobile.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch refactor/frontend-command-center

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

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@cvsloane
cvsloane merged commit b98a93a into main Jul 21, 2026
5 checks passed
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