Repository navigation
feat(dashboard): add agent dashboard popout - #9604
Conversation
…nvas-view-lookup # Conflicts: # src/main/runtime/orca-runtime.ts # src/main/window/createMainWindow.ts # src/renderer/src/components/sidebar/SidebarNav.tsx # src/renderer/src/i18n/locales/es.json # src/renderer/src/i18n/locales/ja.json # src/renderer/src/i18n/locales/ko.json # src/renderer/src/i18n/locales/zh.json # src/shared/types.ts
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughAdds an opt-in Electron agent dashboard pop-out with persisted bounds, snapshot and terminal-preview IPC, raw terminal subscriber tracking, and renderer synchronization. The renderer derives agent cards and bucket counts, exposes settings and sidebar controls, and renders a Kanban dashboard with terminal dialogs, reveal actions, acknowledgements, live streaming, and view transitions. It also adds localization, crash-reporting support, navigation policy wiring, tests, build configuration, and standalone dashboard mock designs. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (7)
src/renderer/src/components/dashboard/useDashboardPopoutBridge.ts (3)
20-27: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueExtend HMR preload skew protection to all dashboard IPC methods.
For consistency with your
onAckAgentguard and to fully protect against dev-HMR preload skew, consider adding optional chaining to all the newly registered IPC listeners in this hook.♻️ Proposed refactor
useEffect( () => - window.api.dashboard.onRevealAgent((args) => { + window.api.dashboard.onRevealAgent?.((args) => { useAppStore.getState().setActiveWorktree(args.worktreeId) activateTabAndFocusPane(args.tabId, args.leafId, { flashFocusedPane: true }) }), [] )
48-52: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueCatch unhandled rejections on IPC invokes during dev-reloads.
During local development, if the
dashboardIPC channel goes down (e.g. during renderer reloads or preload skew), the.invoke()call will result in an unhandled promise rejection. Adding a.catchensures the renderer remains clean.♻️ Proposed refactor
const publishNow = (): void => { lastPublishAt = Date.now() const snapshot = buildDashboardSnapshot(useAppStore.getState(), lastPublishAt) - void window.api.dashboard.publishSnapshot(snapshot) + window.api.dashboard.publishSnapshot(snapshot).catch((err) => { + console.error('Failed to publish dashboard snapshot:', err) + }) }
99-112: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueExtend HMR preload skew protection and catch IPC rejections.
Similar to the guards mentioned above, applying optional chaining to the listener registrations and catching the
.invoke()promise here will fully shield this lifecycle effect from dev-HMR errors.♻️ Proposed refactor
- const offOpenChanged = window.api.dashboard.onPopoutOpenChanged((next) => setOpen(next)) + const offOpenChanged = window.api.dashboard.onPopoutOpenChanged?.((next) => setOpen(next)) // Popout mount asks for a fresh snapshot (its cached one may be stale). - const offRequested = window.api.dashboard.onSnapshotRequested(() => { + const offRequested = window.api.dashboard.onSnapshotRequested?.(() => { if (open) { publishNow() } }) // Recover the open state when the main window (re)mounts while a pop-out is // already open — e.g. after a renderer reload. - void window.api.dashboard.getPopoutOpen().then((isOpen) => { - if (!disposed && isOpen) { - setOpen(true) - } - }) + window.api.dashboard.getPopoutOpen() + .then((isOpen) => { + if (!disposed && isOpen) { + setOpen(true) + } + }) + .catch((err) => console.error('Failed to get dashboard pop-out state:', err))src/main/window/dashboard-popout-window.ts (1)
88-98: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win
viewparam is silently dropped when reusing the singleton window.
createOrFocusDashboardPopoutaccepts aviewargument, but the singleton reuse branch (Lines 92-98) only focuses the existing window — it never navigates it to the requestedview. If a future caller passes a different view while the pop-out is already open, that request is silently ignored.♻️ Proposed fix
if (dashboardPopoutWindow && !dashboardPopoutWindow.isDestroyed()) { if (dashboardPopoutWindow.isMinimized()) { dashboardPopoutWindow.restore() } dashboardPopoutWindow.focus() + loadDashboardPopout(dashboardPopoutWindow, view) return dashboardPopoutWindow }src/main/window/createMainWindow.ts (1)
1-1: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winBoundary-check operator diverges between main window and dashboard pop-out bounds restoration. Both implement the same "discard near-minimum saved bounds" guard, but one uses strict
>and the other>=, so a saved rect exactly at the minimum size is treated inconsistently between the two windows.
src/main/window/createMainWindow.ts#L191-197: usesrawSavedBounds.width > MIN_WIDTH && rawSavedBounds.height > MIN_HEIGHT(strict).src/main/window/dashboard-popout-window.ts#L68-75: usesraw.width >= MIN_WIDTH && raw.height >= MIN_HEIGHT(inclusive) — align this with the main window's strict>(or vice versa) so bounds exactly at the minimum are handled the same way in both windows.src/main/ipc/dashboard-popout.ts (1)
27-38: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value
onDashboardPopoutOpenChangedlistener has no removal path if this function is ever re-invoked.Unlike the
ipcMain.removeHandlercalls above, nothing unsubscribes a previously-registeredonDashboardPopoutOpenChangedlistener before adding a new one. This is currently safe only becauseregisterCoreHandlersguards against calling this more than once per process.src/main/ipc/terminal-preview.ts (1)
33-57: 🔒 Security & Privacy | 🔵 Trivial | ⚡ Quick winValidate
ptyIdinsnapshot/subscribelikeinputalready does.
terminalPreview:input(Lines 60-67) validates thatptyIdis a non-empty string before calling into the runtime.terminalPreview:snapshotandterminalPreview:subscribepassargs.ptyIdstraight through without the same check, so a malformed payload reachesruntime.serializeTerminalBuffer/subscribeToTerminalDataunguarded.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: fc757292-0848-42cc-8fde-8f73051fe1df
📒 Files selected for processing (41)
agent-dashboard-mocks/RESEARCH.mdagent-dashboard-mocks/index.htmlelectron.vite.config.tssrc/main/ipc/crash-reporting.tssrc/main/ipc/dashboard-popout.test.tssrc/main/ipc/dashboard-popout.tssrc/main/ipc/register-core-handlers.tssrc/main/ipc/terminal-preview.test.tssrc/main/ipc/terminal-preview.tssrc/main/runtime/orca-runtime.tssrc/main/window/createMainWindow.tssrc/main/window/dashboard-popout-window.test.tssrc/main/window/dashboard-popout-window.tssrc/main/window/focus-existing-window.tssrc/main/window/window-bounds-validation.tssrc/preload/api-types.tssrc/preload/index.tssrc/renderer/popout.htmlsrc/renderer/src/App.tsxsrc/renderer/src/components/dashboard-popout/AgentKanbanBoard.test.tsxsrc/renderer/src/components/dashboard-popout/AgentKanbanBoard.tsxsrc/renderer/src/components/dashboard-popout/AgentKanbanCard.tsxsrc/renderer/src/components/dashboard-popout/AgentTerminalDialog.tsxsrc/renderer/src/components/dashboard-popout/AgentTerminalPreview.tsxsrc/renderer/src/components/dashboard-popout/DashboardPopoutRoot.tsxsrc/renderer/src/components/dashboard-popout/agent-board-transitions.csssrc/renderer/src/components/dashboard-popout/useDashboardSnapshot.tssrc/renderer/src/components/dashboard/build-dashboard-snapshot.test.tssrc/renderer/src/components/dashboard/build-dashboard-snapshot.tssrc/renderer/src/components/dashboard/useAgentBucketCounts.tssrc/renderer/src/components/dashboard/useDashboardPopoutBridge.tssrc/renderer/src/components/sidebar/SidebarNav.tsxsrc/renderer/src/i18n/locales/en.jsonsrc/renderer/src/i18n/locales/es.jsonsrc/renderer/src/i18n/locales/ja.jsonsrc/renderer/src/i18n/locales/ko.jsonsrc/renderer/src/i18n/locales/zh.jsonsrc/renderer/src/popout.tsxsrc/shared/crash-reporting.tssrc/shared/dashboard-snapshot.tssrc/shared/types.ts
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/main/ipc/dashboard-payload-validation.ts (1)
12-12: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueReuse the shared bucket order constant to prevent drift.
Rather than hardcoding the bucket array, you can import and reuse
DASHBOARD_BUCKET_ORDERfromsrc/shared/dashboard-snapshot.tsto build this Set, ensuring the validation exactly matches the shared contract.♻️ Proposed refactor
-const DASHBOARD_BUCKETS = new Set(['attention', 'working', 'idle']) +import { DASHBOARD_BUCKET_ORDER } from '../../shared/dashboard-snapshot' +const DASHBOARD_BUCKETS = new Set(DASHBOARD_BUCKET_ORDER)
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 13e88363-a0dc-4b58-8b4f-ab09195a829e
📒 Files selected for processing (48)
src/main/ipc/dashboard-payload-validation.test.tssrc/main/ipc/dashboard-payload-validation.tssrc/main/ipc/dashboard-popout.test.tssrc/main/ipc/dashboard-popout.tssrc/main/ipc/pty.tssrc/main/ipc/terminal-preview-output-stream.tssrc/main/ipc/terminal-preview.test.tssrc/main/ipc/terminal-preview.tssrc/main/ipc/ui.test.tssrc/main/ipc/ui.tssrc/main/runtime/mobile-presence-lock.test.tssrc/main/runtime/orca-runtime.tssrc/main/runtime/terminal-query-responder.test.tssrc/main/window/createMainWindow.tssrc/main/window/dashboard-popout-window.test.tssrc/main/window/dashboard-popout-window.tssrc/main/window/privileged-window-navigation.tssrc/preload/api-types.tssrc/preload/index.tssrc/renderer/src/App.tsxsrc/renderer/src/components/dashboard-popout/AgentKanbanBoard.test.tsxsrc/renderer/src/components/dashboard-popout/AgentKanbanBoard.tsxsrc/renderer/src/components/dashboard-popout/AgentKanbanCard.test.tsxsrc/renderer/src/components/dashboard-popout/AgentKanbanCard.tsxsrc/renderer/src/components/dashboard-popout/AgentTerminalDialog.tsxsrc/renderer/src/components/dashboard-popout/AgentTerminalPreview.test.tsxsrc/renderer/src/components/dashboard-popout/AgentTerminalPreview.tsxsrc/renderer/src/components/dashboard/build-dashboard-snapshot.test.tssrc/renderer/src/components/dashboard/build-dashboard-snapshot.tssrc/renderer/src/components/dashboard/useDashboardPopoutBridge.test.tsxsrc/renderer/src/components/dashboard/useDashboardPopoutBridge.tssrc/renderer/src/components/settings/ExperimentalPane.test.tsxsrc/renderer/src/components/settings/ExperimentalPane.tsxsrc/renderer/src/components/settings/experimental-search.tssrc/renderer/src/components/sidebar/SidebarNav.test.tsxsrc/renderer/src/components/sidebar/SidebarNav.tsxsrc/renderer/src/i18n/locales/en.jsonsrc/renderer/src/i18n/locales/es.jsonsrc/renderer/src/i18n/locales/ja.jsonsrc/renderer/src/i18n/locales/ko.jsonsrc/renderer/src/i18n/locales/zh.jsonsrc/renderer/src/popout.tsxsrc/shared/constants.test.tssrc/shared/constants.tssrc/shared/dashboard-snapshot.tssrc/shared/telemetry-events.tssrc/shared/terminal-preview.tssrc/shared/types.ts
🚧 Files skipped from review as they are similar to previous changes (13)
- src/shared/types.ts
- src/renderer/src/i18n/locales/es.json
- src/renderer/src/App.tsx
- src/renderer/src/components/dashboard/build-dashboard-snapshot.test.ts
- src/renderer/src/components/dashboard-popout/AgentTerminalDialog.tsx
- src/renderer/src/components/dashboard-popout/AgentKanbanCard.tsx
- src/renderer/src/components/dashboard-popout/AgentKanbanBoard.test.tsx
- src/renderer/src/components/dashboard/build-dashboard-snapshot.ts
- src/main/ipc/dashboard-popout.test.ts
- src/renderer/src/i18n/locales/ko.json
- src/main/window/dashboard-popout-window.ts
- src/main/window/dashboard-popout-window.test.ts
- src/renderer/src/components/dashboard-popout/AgentKanbanBoard.tsx
…nvas-view-lookup # Conflicts: # src/shared/constants.test.ts
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 0cef4bb4-5e26-457f-9d9e-31802944637a
📒 Files selected for processing (25)
agent-dashboard-mocks/RESEARCH.mdagent-dashboard-mocks/index.htmlelectron.vite.config.tssrc/main/ipc/dashboard-payload-validation.test.tssrc/main/ipc/dashboard-payload-validation.tssrc/main/ipc/pty.tssrc/main/runtime/orca-runtime.tssrc/preload/api-types.tssrc/preload/index.tssrc/renderer/src/components/dashboard-popout/AgentKanbanBoard.test.tsxsrc/renderer/src/components/dashboard-popout/AgentKanbanCard.test.tsxsrc/renderer/src/components/dashboard-popout/AgentKanbanCard.tsxsrc/renderer/src/components/dashboard-popout/useDashboardSnapshot.tssrc/renderer/src/components/dashboard/build-dashboard-snapshot.test.tssrc/renderer/src/components/dashboard/build-dashboard-snapshot.tssrc/renderer/src/components/dashboard/useAgentBucketCounts.tssrc/renderer/src/i18n/locales/en.jsonsrc/renderer/src/i18n/locales/es.jsonsrc/renderer/src/i18n/locales/ja.jsonsrc/renderer/src/i18n/locales/ko.jsonsrc/renderer/src/i18n/locales/zh.jsonsrc/shared/constants.test.tssrc/shared/dashboard-snapshot.tssrc/shared/telemetry-events.tssrc/shared/types.ts
🚧 Files skipped from review as they are similar to previous changes (18)
- agent-dashboard-mocks/RESEARCH.md
- electron.vite.config.ts
- src/shared/types.ts
- src/renderer/src/components/dashboard/useAgentBucketCounts.ts
- src/shared/telemetry-events.ts
- src/main/runtime/orca-runtime.ts
- src/shared/constants.test.ts
- src/main/ipc/dashboard-payload-validation.test.ts
- src/renderer/src/components/dashboard/build-dashboard-snapshot.test.ts
- src/preload/api-types.ts
- src/renderer/src/components/dashboard-popout/useDashboardSnapshot.ts
- src/renderer/src/i18n/locales/ja.json
- src/renderer/src/components/dashboard-popout/AgentKanbanCard.test.tsx
- src/renderer/src/i18n/locales/zh.json
- src/renderer/src/components/dashboard-popout/AgentKanbanBoard.test.tsx
- src/renderer/src/i18n/locales/en.json
- src/preload/index.ts
- src/renderer/src/i18n/locales/ko.json
* chore: remove stray agent-dashboard-mocks folder Design mockups (index.html + RESEARCH.md) accidentally committed alongside the agent dashboard popout feature in #9604. These are scratch design artifacts and don't belong in the shipped repo. * chore: remove stray notes/ design docs Internal skill design/research scratch docs committed in #8624. Two of the three are explicitly marked superseded/folded, none are referenced anywhere in the codebase. Planning artifacts, not shipped documentation.
* feat(dashboard): add agent dashboard popout * fix(dashboard): gate and harden agent popout * test(ipc): isolate dashboard handler registration * fix(dashboard): drop diff status from bucket counts * fix(dashboard): address review feedback * perf(dashboard): ignore unrelated store churn
* chore: remove stray agent-dashboard-mocks folder Design mockups (index.html + RESEARCH.md) accidentally committed alongside the agent dashboard popout feature in stablyai#9604. These are scratch design artifacts and don't belong in the shipped repo. * chore: remove stray notes/ design docs Internal skill design/research scratch docs committed in stablyai#8624. Two of the three are explicitly marked superseded/folded, none are referenced anywhere in the codebase. Planning artifacts, not shipped documentation.
Summary
experimentalAgentDashboardPopoutsetting, default off. With the flag off, the sidebar entry, renderer subscriptions, snapshot derivation, IPC relay, and popout window all remain inactive.Screenshots
Experimental toggle (default off)
Live terminal preview
Testing
pnpm typecheckpnpm run build(desktop, web, and native macOS targets)pnpm run verify:localization-catalog(10,129 references and locale parity)pnpm lintreaches two unchangedorigin/mainexhaustiveness errors insrc/renderer/src/components/skills/skill-freshness-group.tsxandsrc/main/daemon/daemon-server.ts.pnpm testwas attempted under local Node 26 (the repository requires Node 24) and encountered widespread unrelated localStorage/runtime timeouts. The focused matrix above passes twice; PR CI is the authoritative Node 24 full-suite gate.Reliability and performance review
Invariant. A terminal preview starts from one authoritative buffer snapshot, then renders monotonically ordered live bytes without replay duplication or a snapshot/live gap. Terminal-query responses have one current owner, and mobile-driver ownership is rechecked for every input chunk. The experimental-off path performs no dashboard subscriptions or derived-store work.
Failure sources covered. Output arriving between snapshot and subscribe; daemon tail thinning; IPC floods or a stalled/minimized renderer; stale/reused PTY ids; a card disappearing while its dialog is open; mobile-driver handoff during input; malformed/unbounded snapshot payloads; overly broad BrowserWindow fanout; and navigation away from the trusted renderer origin.
Correctness oracle. Runtime sequence/high-water marks reconcile snapshot and live output. Main-process handlers compare exact trusted
webContentsidentities, validate bounded structured payloads, and target only the intended main/popout renderer. Mobile driver state is queried at chunk delivery time.Load shedding/backpressure. Terminal bytes batch for up to 5 ms or 64 KiB, enforce a 512 KiB in-flight ceiling plus a 256 KiB pending ceiling, and trigger a delayed resync after sustained overflow. Dashboard cards are memoized by rendered fields and relative-age updates tick every 30 seconds. The popout bridge and sidebar count derivation stay unmounted while the flag is off.
Provider/host matrix. Local/native macOS was exercised live. Runtime-abstraction tests cover the shared local, WSL, and SSH terminal semantics; no live SSH/WSL GUI screenshot was captured. No Git command or provider-specific review behavior changed.
Diagnostics and fail-safe behavior. Sequence mismatch or sustained pressure requests a fresh authoritative snapshot instead of continuing with ambiguous output. Null/closed preview snapshots dispose stale terminal state. Existing PTY query diagnostics remain the source for ownership failures without adding noisy per-chunk logs.
Security review
<webview>, and shares the privileged-window navigation policy that blocks untrusted in-window navigation.Notes
origin/main(c45dc62ea) before the final validation pass.