Skip to content

feat(mobile): natural touch scrolling + explicit keyboard/cursor modes (FW6-TOUCH) - #95

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

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

Conversation

@cvsloane

@cvsloane cvsloane commented Jul 21, 2026 •

Copy link
Copy Markdown
Owner

Summary

Owner-locked redesign of the mobile touch model after "scrolling barely works":

  1. Native line-precise scrolling. Swipes now send frame-coalesced signed line counts over the channel-scoped terminal.navigate protocol ({op: scroll, lines}, clamped ±120). agentd reads the viewer pane's state in one call and dispatches natively: copy-mode scroll-up/down N (in-mode or entering with -e so bottom auto-exits), literal SGR wheel delivery to mouse-aware alt-screen apps (codex scrolls its own transcript; sub-event residue accumulates per bridge so slow drags work), arrow-key parity for mouse-less alt-screen apps, and no-op scrolling down at live. Replaces the quantized 5-lines-per-wheel emulation for tmux terminals (which remains only as the non-tmux alternate-buffer fallback).
  2. Explicit keyboard. On mobile, xterm's textarea defaults to inputMode=none — taps never summon the Android keyboard (no more mid-read PTY resizes). A new rail Keyboard key toggles typing mode; detach/leave/disconnect resets it. Desktop unchanged.
  3. Explicit cursor-drag. The 450ms hold-to-arm timer is deleted (it hijacked slow scroll starts into arrow-key spam). A rail Cursor key arms exactly one drag gesture, then auto-disarms.

Review chain

  • Lane FW6-TOUCH frozen at 3008c25 (attempt-1 full green gate incl. Go, 32 journeys, 96/100 trace audit). AI Lead review: SHIP with one integration fix — the alt+mouse branch divided lines by 3 statelessly, flooring frame-coalesced 1–2-line messages to zero events (slow codex-pane drags would have stayed inert); fixed with per-bridge signed residue accumulation, reset on window/pane switch, plus a pure-helper Go test.
  • Stabilized the known roster attach/type journey flake at its root (typing now gates on the writable Connected state; 10/10 isolated).
  • Integration gate attempt 2 fully green: lint, typecheck, unit suites, 21/21 smoke, journeys, production build, Go build/vet/test with private-socket coverage of all four scroll branches.

Deploy notes

  • agentd changed → fleet binary rollout required after merge (both hosts).
  • Schema change is additive (scroll variant on the existing navigate union).

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Added smooth native scrolling for tmux terminals, including touch-drag and momentum scrolling.
    • Added mobile terminal controls for explicitly toggling the virtual keyboard and arming cursor-drag mode.
    • Improved scrolling support for copy mode, alternate applications, and mouse-enabled terminal sessions.
  • Bug Fixes

    • Prevented unintended keyboard activation and cursor-input behavior during touch gestures.
    • Reset touch interaction modes when leaving or disconnecting from a terminal.
  • Tests

    • Expanded coverage for scrolling, touch interactions, keyboard behavior, cursor mode, and protocol validation.

cvsloane and others added 13 commits July 21, 2026 09:42
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…cursor modes (owner-locked)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Frame-coalesced scroll messages are often 1-2 lines; stateless count/3 dropped them all, leaving slow drags inert in mouse-aware alt-screen panes (codex). Residue accumulates signed per bridge under the manager lock and resets on window/pane selection.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Typing raced the terminal WS handshake under parallel load (2 gate failures today). Wait for the writable Connected label before typing; 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

📝 Walkthrough

Walkthrough

This change adds bounded terminal.navigate scroll messages, pane-aware tmux scrolling, dashboard touch-scroll coalescing, and explicit mobile keyboard and cursor controls. Protocol, agentd, tmux, dashboard, integration, journey, and handoff coverage are updated.

Changes

Terminal scroll protocol and tmux execution

Layer / File(s) Summary
Scroll protocol and agent entrypoint
packages/ac-schema/..., agents/agentd/..., services/control-plane/tests/..., tests/fixtures/...
Adds the scroll navigation variant with bounded signed lines, forwards it through the control plane, and maps it into agentd terminal navigation.
Pane-aware tmux scroll execution
agents/agentd/internal/tmux/...
Implements clamped scrolling across copy-mode, alternate-screen, mouse-reporting, and read-only viewers, including wheel residue accumulation and pane-selection resets.
Touch-to-navigation scroll pipeline
apps/dashboard/src/hooks/useTerminalTouchScroll.ts, apps/dashboard/src/components/TerminalView.tsx, apps/dashboard/src/components/terminal/PersistentTerminalHost.tsx, apps/dashboard/src/components/tmux/TmuxTerminalWorkspace.tsx
Maps touch movement to lines, resolves navigation paths, coalesces frames, and sends native scroll requests with the tmux session key.
Keyboard and cursor rail modes
apps/dashboard/src/components/mobile/*, apps/dashboard/src/components/terminal/TerminalSurface.tsx, apps/dashboard/src/components/terminal/types.ts, apps/dashboard/src/components/tmux/TmuxMobileShell.tsx
Adds keyboard and cursor rail actions, controls mobile textarea inputMode, supports one-shot cursor arming, and resets modes when leaving or detaching.
Journey validation and handoff records
tests/journeys/*, tasks/*
Validates native scroll frames, keyboard gating, cursor disarming, connection readiness, and FW6-TOUCH handoff state.

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

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant TerminalView
  participant TouchScroll
  participant ControlPlane
  participant Agentd
  participant TmuxViewer

  User->>TerminalView: drag or momentum gesture
  TerminalView->>TouchScroll: provide touch deltas and tmux session key
  TouchScroll->>ControlPlane: send coalesced terminal.navigate scroll
  ControlPlane->>Agentd: relay bounded scroll request
  Agentd->>TmuxViewer: execute pane-aware navigation
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly captures the main mobile touch-scrolling and keyboard/cursor mode changes described in the PR.
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.

🔧 golangci-lint (2.12.2)

level=error msg="[linters_context] typechecking error: pattern ./...: directory prefix . does not contain main module or its selected dependencies"

🔧 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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (2)
tests/journeys/fw6-focus.journey.spec.ts (1)

69-93: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Assert exclusive navigation routing and scroll direction.

The test accepts either sign and excludes only one input encoding. Snapshot terminal input before the drag, assert it remains unchanged, and verify the new scroll frames have the intended sign; add the reverse drag for the opposite direction.

🤖 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 69 - 93, Update the
test around dragTerminal to snapshot terminal input and scroll-frame counts
before the gesture, then assert the drag produces only new scroll frames with
the intended sign and leaves terminal input unchanged. Add a reverse-direction
drag assertion to verify the opposite scroll sign, while retaining the existing
frame validity checks.
agents/agentd/internal/tmux/terminal_scroll_test.go (1)

5-29: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Add a manager-level residue regression test.

This verifies the helper only; it still passes if navigateScrollLocked drops residue between requests. Send three Lines: -1 navigation calls and assert exactly one wheel event after the third call.

🤖 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 `@agents/agentd/internal/tmux/terminal_scroll_test.go` around lines 5 - 29, Add
a manager-level regression test around navigateScrollLocked that sends three
navigation requests with Lines: -1, preserving the manager’s residue across
calls and asserting exactly one wheel event is emitted on the third request.
Verify the first two requests emit none, so the test covers request-to-request
accumulation rather than only accumulateWheelEvents.
🤖 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.

Nitpick comments:
In `@agents/agentd/internal/tmux/terminal_scroll_test.go`:
- Around line 5-29: Add a manager-level regression test around
navigateScrollLocked that sends three navigation requests with Lines: -1,
preserving the manager’s residue across calls and asserting exactly one wheel
event is emitted on the third request. Verify the first two requests emit none,
so the test covers request-to-request accumulation rather than only
accumulateWheelEvents.

In `@tests/journeys/fw6-focus.journey.spec.ts`:
- Around line 69-93: Update the test around dragTerminal to snapshot terminal
input and scroll-frame counts before the gesture, then assert the drag produces
only new scroll frames with the intended sign and leaves terminal input
unchanged. Add a reverse-direction drag assertion to verify the opposite scroll
sign, while retaining the existing frame validity checks.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 56c9cad2-fe5e-411a-85ec-3404a022a666

📥 Commits

Reviewing files that changed from the base of the PR and between b98a93a and 674c686.

📒 Files selected for processing (33)
  • agents/agentd/cmd/agentd/main.go
  • agents/agentd/cmd/agentd/main_terminal_test.go
  • agents/agentd/internal/protocol/terminal.go
  • agents/agentd/internal/tmux/pty_bridge_test.go
  • agents/agentd/internal/tmux/terminal.go
  • agents/agentd/internal/tmux/terminal_scroll_test.go
  • agents/agentd/internal/tmux/viewer_pty.go
  • apps/dashboard/src/components/TerminalView.tsx
  • apps/dashboard/src/components/mobile/TerminalContextMenu.tsx
  • apps/dashboard/src/components/mobile/TerminalKeyRail.tsx
  • apps/dashboard/src/components/mobile/terminalRailConfig.test.ts
  • apps/dashboard/src/components/mobile/terminalRailConfig.ts
  • apps/dashboard/src/components/terminal/PersistentTerminalHost.tsx
  • apps/dashboard/src/components/terminal/TerminalSurface.tsx
  • apps/dashboard/src/components/terminal/terminalHostStore.test.ts
  • apps/dashboard/src/components/terminal/types.ts
  • apps/dashboard/src/components/tmux/TmuxMobileShell.tsx
  • apps/dashboard/src/components/tmux/TmuxTerminalWorkspace.tsx
  • apps/dashboard/src/components/tmux/accessibilityContracts.test.ts
  • apps/dashboard/src/hooks/useTerminalTouchScroll.test.ts
  • apps/dashboard/src/hooks/useTerminalTouchScroll.ts
  • packages/ac-schema/src/message.ts
  • packages/ac-schema/src/terminal.ts
  • packages/ac-schema/tests/protocol-fixtures.test.ts
  • packages/ac-schema/tests/terminal.test.ts
  • services/control-plane/tests/terminalRoute.test.ts
  • tasks/2026-07-21-fw6-touch-brief.md
  • tasks/frontend-ux-handoffs/fw6-touch.md
  • tasks/frontend-ux-log.md
  • tests/fixtures/protocol/terminal-navigate-scroll.json
  • tests/journeys/command-center.journey.spec.ts
  • tests/journeys/controlPlaneMock.ts
  • tests/journeys/fw6-focus.journey.spec.ts
💤 Files with no reviewable changes (1)
  • apps/dashboard/src/components/mobile/TerminalContextMenu.tsx

@cvsloane
cvsloane merged commit b835f78 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