Skip to content

feat(terminals): dashboard terminal previews from the owning host - #27250

Merged
OrcaWin merged 2 commits into
mainfrom
OrcaWin/d4-d4-v2c
Oct 10, 2026
Merged

OrcaWin merged 2 commits into
mainfrom
OrcaWin/d4-d4-v2c

Conversation

@OrcaWin

@OrcaWin OrcaWin commented Oct 10, 2026 •

Copy link
Copy Markdown
Collaborator
Files Added Deleted Net
Test 3 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​268 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​268
Prod 5 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​379 $\color{#cf222e}{\Huge{\mathbf{−}}}$​36 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​343

ELI5

The Agent Dashboard's "click a card to see the agent's terminal" window was blank (web client) or said "no preview" (desktop) for agents running on a paired Orca server. It now shows the live terminal from the machine the agent actually runs on.

What Changed

Before: in the web client, clicking a card opened a dialog with an empty body — not even the "no preview" message. In the desktop app, a card for an agent on a paired server always read "No preview for this remote session". Both asked this app's own main process for the preview, which does not hold that terminal.

After: a card whose terminal belongs to a paired server previews it from that server. You see the live screen, can type into it, and the dialog sizes the terminal to its own box, exactly as it does for local agents. If no preview can be produced (an old link with no owner, the stream ends, or the bridge is missing), the dialog shows the "unavailable" message instead of a blank body.

Mechanism: the preview's transport is now picked by the terminal's own id. Ids that name a paired server (remote:<server>@@<handle>) go through a new renderer adapter, remote-runtime-terminal-preview-api.ts. It speaks the same preview interface as before (connect / input / fit / unsubscribe / data events), but sits on the multiplexed terminal stream that panes already use for that server:

  • connect = subscribe and wait for the host's first snapshot
  • refresh = a snapshot request on the same stream, replaying only output past the snapshot's sequence number
  • fit = the stream's existing viewport claim; the host's fit event triggers the repaint
  • closing the dialog closes the stream, which releases the claim

All other ids still use this app's main-process preview, unchanged. The preview component also catches a failed or missing connect and shows the unavailable message.

Why

The design called for a new terminalPreview.* RPC with its own capability flag. I adapted that. The existing terminal stream already does everything the preview needs on the host side:

  • it marks exactly where the snapshot ends and live output begins
  • it handles flow control
  • it accepts input and viewport claims with the same parking and reclaim rules the local preview uses

A parallel RPC would duplicate all of that on the host. It would also leave every older server with no preview. Reusing the stream means no wire change and nothing to negotiate, and any server that can show a pane can now show a preview.

Routing goes only by the server named in the pty id. An id with no owner is refused rather than sent to the "active" server, so we never show one machine's terminal as another's. Loss of contact reopens the stream instead of reporting the pane as closed. Only an ended stream shows the remote "no preview" message, which never claims the pane exited.

Out of scope: the web client's Pop-out mode still does nothing. That half of #22218 is tracked separately.

Linked Issue

Fixes #22218 (preview half: the blank dialog. The web pop-out half is handled in a follow-up)

Visual Proof

N/A: no layout change. The dialog renders the existing preview terminal or the existing unavailable message. Behaviour is covered by the tests below (no local Electron runs on this machine).

Testing

  • AgentTerminalPreview.test.tsx: new tests for (a) a paired-server card subscribing on its owning server and painting/typing through that stream, and (b) a missing bridge showing the unavailable message. Both fail on origin/main with TypeError: undefined is not an object (evaluating 'connection.snapshot') / no subscription, and pass here.

  • remote-runtime-terminal-preview-api.test.ts: owner routing, refusing an owner-less id, refresh boundary (covered output dropped, newer output replayed), repaint only on a real grid change, ended stream reads unavailable, loss of contact reopens, and unsubscribe releasing the stream.

  • pnpm tc:web, focused pnpm test src/renderer/src/components/dashboard-popout/ src/renderer/src/components/dashboard, oxlint, pnpm run check:code-quality:changed.

  • I manually tested these changes locally

  • Automated tests added/updated, or explained why not below

Review

Agent skill upstream boundary

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

  • Mixed versions: no new RPC, opcode or field, so old client and new server (and the reverse) behave as before. A new client previews from any server that supports terminal.multiplex.
  • SSH: SSH terminals keep previewing through this app's main process. Only paired-server ids use the new path.
  • Cross-platform: renderer-only, no platform-specific code.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • 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)

m4air added 2 commits October 10, 2026 06:14
A paired host's agent pane now previews over the same multiplexed terminal
stream panes already use, routed by the host named in the pty id. The web
client and desktop pop-out no longer render a blank dialog when no preview
bridge exists; they show the unavailable message instead.
…edit

A requested snapshot is followed by every chunk the host buffered, covered
ones included, so live output is now trimmed against the snapshot's output
high-water for as long as the stream lives. Each emitted chunk keeps the
host's delivery credit until the preview parses it, so a slow preview
applies backpressure instead of overrunning its parser.
@coderabbitai

coderabbitai Bot commented Oct 10, 2026

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: b0b7c2fc-95e0-47bb-b87e-79007ab3c46d

📥 Commits

Reviewing files that changed from the base of the PR and between 3e7ab3f and 12c56dd.


📒 Files selected for processing (8)
  • src/renderer/src/components/dashboard-popout/AgentTerminalPreview.clipboard-routes.test.tsx
  • src/renderer/src/components/dashboard-popout/AgentTerminalPreview.test.tsx
  • src/renderer/src/components/dashboard-popout/AgentTerminalPreview.tsx
  • src/renderer/src/components/dashboard-popout/preview-grid-claim.ts
  • src/renderer/src/components/dashboard-popout/preview-terminal-paste.ts
  • src/renderer/src/components/dashboard-popout/remote-runtime-terminal-preview-api.test.ts
  • src/renderer/src/components/dashboard-popout/remote-runtime-terminal-preview-api.ts
  • src/renderer/src/components/dashboard-popout/terminal-preview-api.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.



📝 Walkthrough

Walkthrough

The change adds a remote-runtime terminal preview API backed by the terminal multiplexer. It selects the preview API by PTY ID and routes dashboard preview connections, input, acknowledgements, data subscriptions, and viewport claims through that API. Preview setup now handles connection failures and missing snapshots by marking the PTY unavailable and releasing terminal resources. Tests cover remote routing, snapshots, streamed output, input, acknowledgements, resyncs, and unavailable previews.


Priority: ➖ Normal

Severity of issue fixed: Medium

Merge Risk: ⚪ Minimal · up to 12c56

Dashboard previews for paired-server terminals now use the owning host's terminal stream, and missing or failed connections show the unavailable message. No actionable merge-blocking risk was found. Manual testing against a real paired host was not performed.

Pre-merge checks | Passed 3 | Failed 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Linked Issues check Warning Directly linked issue #22218 has two coding requirements. The preview requirement is addressed: AgentTerminalPreview now uses terminalPreviewApiFor, catches a failed or missing connect, and show… Implement the #22218 Pop-out requirement by hiding the Pop-out option in the web client or making the action fall back to In-window. Add an automated test for the selected behavior.
Docstring Coverage Warning Docstring coverage is 40.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 15 functions across 8 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 and concisely describes the main change: dashboard terminal previews now use the owning host.
Description check Passed The description is mostly complete. It explains the user impact, mechanism, rationale, linked issue, testing, scope, compatibility considerations, and checklist status. It also states that manual test…
Out of Scope Changes check Passed The changed production files route terminal preview connections, input, acknowledgements, fit requests, and cleanup through the selected preview API. The new remote adapter supports the linked preview…

Full details: Linked Issues check

Explanation

Directly linked issue #22218 has two coding requirements. The preview requirement is addressed: AgentTerminalPreview now uses terminalPreviewApiFor, catches a failed or missing connect, and shows the unavailable state. The new remote adapter and tests cover paired-host routing and stream behavior. The Pop-out requirement remains unmet. The PR description states that Pop-out stays out of scope, and no change is shown for that behavior.


  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@OrcaWin

OrcaWin commented Oct 10, 2026

Copy link
Copy Markdown
Collaborator Author

CI note: the only failing check, e2e / changed e2e specs, is golden-tab-bar-agent-launch.spec.ts › "launches claude into a live TUI". CI picks that spec because this PR touches the preview paste path, but the test exercises a regular tab-bar launch and never reaches the dashboard preview. It fails the same way on main without this PR. I ran the spec on its own through e2e.yml workflow_dispatch:

  • current main 3e7ab3f5a1: fail (run 38056718167)
  • 4dfc74e5e6, which comes before this whole stack: pass once (run 38056956508), fail twice (runs 38057494317, 38057499277)
  • 26bca8914a~1: pass (run 38056950786)

On this PR it failed on the first run and on one rerun. The same spec passed in yesterday's scheduled full-suite run. So it is an existing intermittent failure when this spec runs on its own, not a regression from this change. All other checks are green on 12c56ddcd8.

@OrcaWin
OrcaWin merged commit 61a99d7 into main Oct 10, 2026
69 of 71 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.

[Bug]: Web client: Agent Dashboard pop-out is a silent no-op and the agent terminal preview dialog renders blank (window.api fallback proxy)

1 participant