Skip to content

Fix desktop terminal viewport and transactional pane focus - #99

Merged
cvsloane merged 32 commits into
mainfrom
refactor/frontend-command-center
Jul 22, 2026
Merged

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

Conversation

@cvsloane

@cvsloane cvsloane commented Jul 22, 2026 •

Copy link
Copy Markdown
Owner

Outcome

  • fixes the production desktop terminal cold-open collapse from one row to a usable local-fit grid
  • makes pane/window switching and reconnect reconciliation authoritative before input is enabled
  • keeps font zoom, scrollback, multi-host navigation, and launch-new-session behavior on the existing path

Verification

  • fresh independent R2 review: PASS, no critical/high findings
  • dashboard terminal units: 21/21
  • schema units: 30/30
  • control-plane units: 13/13
  • affected agentd Go packages: pass
  • dashboard/schema/control-plane typechecks: pass
  • desktop Command Center journey: 14 passed, 5 mobile-only skipped

Production rollout will be followed by SOURCE_COMMIT, health, two-agent reconnect, and live laptop checks.

Summary by CodeRabbit

  • New Features

    • Added reliable pane focusing with zoom support and confirmation of the active pane.
    • Added automatic viewer-state restoration after reconnecting or resuming a terminal.
    • Added local chat presentation for supported terminal sessions, including live transcript refresh and unread-entry navigation.
    • Added pane search, grouping, freshness indicators, and improved switching feedback.
    • Added terminal text-size controls.
  • Bug Fixes

    • Prevented terminal and prompt input while pane changes are pending.
    • Improved recovery when pane switching fails or times out.
    • Preserved the selected pane during reconnection and focus transitions.

cvsloane and others added 28 commits July 21, 2026 20:47
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Reproduce the topology-independent cold attach where the mobile visualViewport height rule zeroed the desktop terminal, and require a grid above the observed nine-row failure.
@coderabbitai

coderabbitai Bot commented Jul 22, 2026 •

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@cvsloane, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 38 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 2eedc8be-7139-487f-b0d7-66e16f854ee8

📥 Commits

Reviewing files that changed from the base of the PR and between 2fbac22 and dd00148.

📒 Files selected for processing (9)
  • project_status.md
  • services/control-plane/src/routes/terminal.ts
  • services/control-plane/tests/terminalRoute.test.ts
  • tasks/2026-07-22-android-terminal-daily-driver-acceptance-checklist.md
  • tasks/2026-07-22-android-terminal-daily-driver-log.md
  • tasks/2026-07-22-android-terminal-daily-driver-metrics.jsonl
  • tasks/2026-07-22-android-terminal-daily-driver-plan.md
  • tasks/2026-07-22-android-terminal-daily-driver-status.md
  • tests/smoke/dashboard.spec.ts
📝 Walkthrough

Walkthrough

Terminal navigation now supports correlated viewer_state and focus_pane operations with verified tmux pane/zoom results, rollback, control-plane forwarding, metrics, dashboard input fencing, and resumed-viewer reconciliation. Claude panes also support persisted local chat presentation and live transcript refresh.

Changes

Terminal navigation and reconciliation

Layer / File(s) Summary
Navigation contracts and tmux state
packages/ac-schema/*, agents/agentd/internal/{protocol,tmux}/*
Adds navigation request/result schemas, viewer-state reads, transactional pane focus, zoom convergence checks, and rollback behavior.
Control-plane forwarding and metrics
services/control-plane/src/*, services/control-plane/tests/*
Tracks pending requests, forwards agent results to browsers, acknowledges agent messages, and records navigation outcomes and latency.
Dashboard navigation orchestration
apps/dashboard/src/hooks/*, apps/dashboard/src/components/terminal/*, apps/dashboard/src/components/tmux/*
Correlates navigation results, reconciles resumed viewers, fences input during pending navigation, and propagates asynchronous focus outcomes through controls.
Navigation validation
agents/agentd/cmd/agentd/*, tests/fixtures/protocol/*, tests/journeys/*
Adds agent, schema, fixture, unit, integration, and journey coverage for focus, viewer state, delayed acknowledgement, rejection, and reconnection flows.

Local Claude chat

Layer / File(s) Summary
Persisted presentation and transcript refresh
apps/dashboard/src/stores/settings.ts, apps/dashboard/src/components/terminal/TerminalHistoryOverlay.*, apps/dashboard/src/components/TerminalView.tsx
Adds per-session Chat/Terminal presentation, chat-first loading, incremental live transcript merging, unread tracking, and refresh after terminal output.
Chat and terminal surface wiring
apps/dashboard/src/components/terminal/*, apps/dashboard/src/components/tmux/*
Adds local chat entry points, chat-mode propagation, interaction-blocked overlays, disabled prompt controls, and provider-specific presentation defaults.
Chat journey coverage
tests/journeys/fw6-focus.journey.spec.ts, tests/journeys/controlPlaneMock.ts
Covers persisted presentation, live transcript refresh, transcript errors, automatic chat opening, and older transcript loading.

Estimated code review effort: 5 (Critical) | ~120 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 4.26% 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 two main changes: desktop viewport fixes and transactional pane focus.
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 unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch refactor/frontend-command-center

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.

Actionable comments posted: 7

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
services/control-plane/src/routes/terminal.ts (1)

453-469: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Return a navigation failure when agent dispatch fails.

The pending request is recorded, but this sendToAgent result is ignored. If the agent disconnects here, no navigation_result reaches the browser and the dashboard can remain input-fenced. Check the return value, remove and record the pending request as failure, then send the correlated failure payload to the UI.

🤖 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 `@services/control-plane/src/routes/terminal.ts` around lines 453 - 469, Handle
the result of pubsub.sendToAgent in the terminal navigation dispatch: when
sending fails, remove the correlated entry from pendingNavigationRequests,
record it as a failure, and send the matching navigation_result failure payload
to the UI using the existing request correlation and response path. Preserve the
current successful dispatch behavior and idle-timeout reset.
🤖 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/hooks/useTerminalConnection.ts`:
- Around line 296-303: Wrap the entire case 'attached' body in braces so the
lexical declarations terminalSnapshot, selectedDescriptor, selectedPaneId, and
attachmentPaneChanged are scoped to that case and no longer trigger
noSwitchDeclarations.
- Around line 344-357: Update the reconciliation error handling in the catch
block alongside beginViewerReconciliation and reconcilingViewerRef so the local
path resets reconcilingViewerRef.current and setReconcilingViewer(false) when
persistentReconciliation is false. Preserve finishViewerReconciliation for the
persistent path, while ensuring every reconciliation failure releases the
input-blocking state used by sendInput.

In `@project_status.md`:
- Line 20: Specify the language identifier for the fenced code block in
project_status.md by changing the bare fence to use text, preserving the block’s
existing content.

In `@tasks/2026-07-22-android-terminal-daily-driver-acceptance-checklist.md`:
- Line 3: Update the checklist’s Status declaration from approved to in progress
while required criteria, including HUMAN-1, remain unchecked and the final
report indicates pending completion. Only restore approved after all mandatory
checkboxes are checked and supported by recorded evidence.

In `@tasks/2026-07-22-android-terminal-daily-driver-plan.md`:
- Around line 170-174: Update the “Current reviewed local candidate baseline”
entry in the recovery record to use the integrated candidate commit
59daa0e40f77405d5a8dee290dad73488a6ef29e, or explicitly label
d3416a9d1934ddf49b5e97fd0e61c707a1c466d5 as historical. Ensure the rollout and
rollback provenance is unambiguous.
- Around line 103-106: Gate production rollout behind explicit authorization: in
tasks/2026-07-22-android-terminal-daily-driver-plan.md lines 103-106, change the
production deployment policy so approval is required and direct-to-production is
not the default; in tasks/2026-07-22-android-terminal-daily-driver-status.md
lines 34-39, replace the immediate rollout sequence with an authorization gate,
recording deployment and health receipts only after approval.

In `@tasks/2026-07-22-android-terminal-daily-driver-status.md`:
- Around line 14-18: Update the W2 row’s “Blocked on” entry to remove the
completed W1 reviewer pass prerequisite and reflect the remaining gate of W1
production rollout and live laptop acceptance; if that gate is already complete,
transition W2 out of “held” accordingly.

---

Outside diff comments:
In `@services/control-plane/src/routes/terminal.ts`:
- Around line 453-469: Handle the result of pubsub.sendToAgent in the terminal
navigation dispatch: when sending fails, remove the correlated entry from
pendingNavigationRequests, record it as a failure, and send the matching
navigation_result failure payload to the UI using the existing request
correlation and response path. Preserve the current successful dispatch behavior
and idle-timeout reset.
🪄 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: d94869f5-99b9-41d8-85c3-6122e87c7c51

📥 Commits

Reviewing files that changed from the base of the PR and between 7b30df0 and 2fbac22.

📒 Files selected for processing (67)
  • agents/agentd/cmd/agentd/main.go
  • agents/agentd/cmd/agentd/main_terminal_test.go
  • agents/agentd/internal/protocol/messages.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/viewer_pty.go
  • agents/agentd/internal/ws/protocol_fixtures_test.go
  • apps/dashboard/src/components/TerminalView.tsx
  • apps/dashboard/src/components/session/SessionWorkbench.tsx
  • apps/dashboard/src/components/terminal/PersistentTerminalHost.tsx
  • apps/dashboard/src/components/terminal/TerminalHistoryOverlay.test.ts
  • apps/dashboard/src/components/terminal/TerminalHistoryOverlay.tsx
  • apps/dashboard/src/components/terminal/TerminalSurface.tsx
  • apps/dashboard/src/components/terminal/terminalHostStore.test.ts
  • apps/dashboard/src/components/terminal/terminalHostStore.ts
  • apps/dashboard/src/components/terminal/terminalNavigationRequests.test.ts
  • apps/dashboard/src/components/terminal/terminalNavigationRequests.ts
  • apps/dashboard/src/components/terminal/types.ts
  • apps/dashboard/src/components/tmux/PromptComposer.tsx
  • apps/dashboard/src/components/tmux/TmuxActionSheet.tsx
  • apps/dashboard/src/components/tmux/TmuxMobileShell.tsx
  • apps/dashboard/src/components/tmux/TmuxPaneControls.tsx
  • apps/dashboard/src/components/tmux/TmuxPaneSwitcher.tsx
  • apps/dashboard/src/components/tmux/TmuxQuickSwitchStrip.tsx
  • apps/dashboard/src/components/tmux/TmuxTerminalWorkspace.tsx
  • apps/dashboard/src/components/tmux/TmuxWindowStrip.tsx
  • apps/dashboard/src/components/tmux/paneSwitcher.test.ts
  • apps/dashboard/src/components/tmux/paneSwitcher.ts
  • apps/dashboard/src/hooks/useTerminalConnection.ts
  • apps/dashboard/src/hooks/useTmuxRosterData.ts
  • apps/dashboard/src/stores/settings.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
  • project_status.md
  • services/control-plane/src/metrics.test.ts
  • services/control-plane/src/metrics.ts
  • services/control-plane/src/routes/terminal.ts
  • services/control-plane/src/ws/agent.ts
  • services/control-plane/tests/terminalRoute.test.ts
  • tasks/2026-07-22-android-terminal-daily-driver-acceptance-checklist.md
  • tasks/2026-07-22-android-terminal-daily-driver-escalation-report.md
  • tasks/2026-07-22-android-terminal-daily-driver-final-report.md
  • tasks/2026-07-22-android-terminal-daily-driver-handoffs/README.md
  • tasks/2026-07-22-android-terminal-daily-driver-handoffs/w1-shared-terminal-r2-review.md
  • tasks/2026-07-22-android-terminal-daily-driver-handoffs/w1-shared-terminal-r2.md
  • tasks/2026-07-22-android-terminal-daily-driver-handoffs/w1-shared-terminal-review.md
  • tasks/2026-07-22-android-terminal-daily-driver-handoffs/w1-shared-terminal.md
  • tasks/2026-07-22-android-terminal-daily-driver-log.md
  • tasks/2026-07-22-android-terminal-daily-driver-metrics.jsonl
  • tasks/2026-07-22-android-terminal-daily-driver-plan.md
  • tasks/2026-07-22-android-terminal-daily-driver-status.md
  • tasks/2026-07-22-android-w1-shared-terminal-brief.md
  • tasks/2026-07-22-android-w1-shared-terminal-r2-brief.md
  • tasks/2026-07-22-android-w1-shared-terminal-r2-review-brief.md
  • tasks/2026-07-22-android-w1-shared-terminal-review-brief.md
  • tasks/frontend-ux-log.md
  • tasks/lessons.md
  • tests/fixtures/protocol/terminal-focus-pane.json
  • tests/fixtures/protocol/terminal-navigation-result.json
  • tests/fixtures/protocol/terminal-viewer-state.json
  • tests/journeys/command-center.journey.spec.ts
  • tests/journeys/controlPlaneMock.ts
  • tests/journeys/fw6-focus.journey.spec.ts
  • tests/journeys/fw6-precision.journey.spec.ts

Comment thread project_status.md Resolved
@cvsloane
cvsloane merged commit 938e7eb into main Jul 22, 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