Repository navigation
feat(terminals): dashboard terminal previews from the owning host - #27250
Conversation
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.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Priority: ➖ Normal Severity of issue fixed: Medium Merge Risk: ⚪ Minimal · up to 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 |
|
|
CI note: the only failing check,
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 |
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:All other ids still use this app's main-process preview, unchanged. The preview component also catches a failed or missing
connectand 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: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 onorigin/mainwithTypeError: 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, focusedpnpm 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
Notes
terminal.multiplex.Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)