feat(agent-dashboard): persist hook status across Orca restart#1480
Open
brennanb2025 wants to merge 2 commits intomainfrom
Open
feat(agent-dashboard): persist hook status across Orca restart#1480brennanb2025 wants to merge 2 commits intomainfrom
brennanb2025 wants to merge 2 commits intomainfrom
Conversation
Hydrates the hook server's per-pane lastStatusByPaneKey from userData/agent-hooks/last-status.json before binding the HTTP listener, mirrors mutations to disk via a 250ms trailing debounce, and flushes synchronously on stop(). Renderer dismissals fan out a new agentStatus:drop IPC so the on-disk file evicts the entry and a relaunch cannot resurrect it. Adds a bounded bootstrap queue in useIpcEvents so events replayed by setListener() during window creation are not dropped while App.tsx is still hydrating tabsByWorktree. Gated on settings.experimentalAgentDashboard. Done, blocked, and quiet working rows now all survive across restart. Co-authored-by: Orca <help@stably.ai>
Address review findings on the retention-restart branch:
- Wrap agentStatus:getSnapshot and agentStatus:drop IPC handlers in
try/catch so a throw cannot surface as an unhandled invoke rejection
(silent startup-hydration failure) or crash main from a fire-and-
forget listener.
- runStatusPersist no longer permanently suppresses gate-off deletion
retries on transient unlink errors (e.g. EPERM); deletedOnDisable
now flips only on success or ENOENT.
- Tighten tests: stale-version-hydrate now asserts the warn message
content; getSnapshot test uses toEqual; drop-handler test rejects
null/{}/[] in addition to the prior bad inputs.
Co-authored-by: Orca <help@stably.ai>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
lastStatusByPaneKeytouserData/agent-hooks/last-status.json(atomic write, 250ms trailing debounce, sync flush onstop()), gated onexperimentalAgentDashboard. Fixesdone,blocked, and quietworkingrows winking out after restart.agentStatus:dropIPC so renderer dismissals (dropAgentStatus,dismissRetainedAgentsByWorktree) propagate to the main-process cache and the on-disk file, preventing dismissed rows from resurrecting on relaunch.useIpcEventssosetListener()replay during window creation isn't dropped whileApp.tsxis still hydratingtabsByWorktree; drains on theworkspaceSessionReadyfalse→true transition.Design doc:
docs/agent-dashboard-retention-restart.md.Test plan
pnpm typecheckpnpm test src/main/agent-hooks/server.test.ts(13 new persistence/hydration tests)pnpm test src/main/ipc/agent-hooks.test.ts(new IPC handler tests)pnpm test src/renderer/src/store/slices/agent-status-drop-ipc.test.ts(slice IPC fan-out)pnpm test src/renderer/src/hooks/agent-status-bootstrap-queue.test.ts(queue/drain/cap)useIpcEvents.test.tsmocks updated foruseAppStore.subscribedone, quit, relaunch — row reappears within first dashboard frameblockedon a permission prompt — row reappears with prompt + tool namelast-status.jsonno longer contains themlast-status.jsonis never createdlast-status.jsonto invalid JSON, relaunch — single warn, dashboard renders normallyMade with Orca 🐋