Restore interrupted Orca sessions after crashes - #4
Conversation
Packaged apps still use the system login item. In electron . / pnpm app:dev, install a LaunchAgent that runs pnpm app:dev from the project directory so login launch does not open Electron's default template. Disable the leftover development login item on startup.
…aths Move process matching onto the server, cache ps/lsof briefly, and serve /api/sessions?liveOnly=1 from actual Orca agent processes. Stop treating a Codex sessions/ path as live, keep pinned running rows marked live, and let desktop recovery reuse the API result instead of matching processes twice.
Do not warm or periodically rebuild the search index while the desktop app is idle. Poll live sessions less often, drop infinite live-dot keyframes, and let macOS vibrancy follow the window so idle windows stop animating.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 47a7a4faa4
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| scanLimit: 20000, | ||
| updateLimit: 20000, | ||
| updateLimit: 200, | ||
| includeTools: true, |
There was a problem hiding this comment.
Keep live-search fallback until bootstrap finishes
When a profile has more than 200 uncached or changed sessions, this bootstrap stops updating at updateLimit and reports the rest as pending, but syncSearchIndex still records the Codex-home coverage marker. The next request therefore considers coversAll true and calls searchIndexed, silently omitting every session beyond the first 200; the later 20-row refreshes only repair this gradually. Keep using the live fallback until the sync reports no pending sessions, or avoid marking partial indexes as covering the corpus.
Useful? React with 👍 / 👎.
| /(?:^|\s)node\s+\S*[/\\]codex(?:\s|$)/.test(text) | ||
| || /(?:^|\s)\S*[/\\]codex\s+(?!app-server\b)/.test(text) |
There was a problem hiding this comment.
Recognize bare Codex and Claude process names
When Orca launches the commands produced by this repository (codex resume ... and claude --resume ...) with a bare executable name, the process command line can begin directly with codex or claude. These patterns require a preceding path separator, so processEngine rejects those agents and /api/sessions?liveOnly=1 remains empty, disabling completion detection, sleep prevention, and crash-recovery recording for the normal launch form. Accept bare executable names as well as qualified paths.
Useful? React with 👍 / 👎.
| // A deliberate Agent Snapshots quit is not evidence that Orca died. Pending | ||
| // recovery entries remain, but currently live sessions are not promoted on | ||
| // the next launch unless this process itself terminates unexpectedly. | ||
| persistSessionRecovery({ monitoring: false }); |
There was a problem hiding this comment.
Preserve monitored sessions during system shutdown
When the OS performs an orderly logout or reboot and Electron delivers before-quit, this writes monitoring: false. On the next launch, readSessionRecoveryState only promotes the saved liveSessions when that flag is true, so all sessions running immediately before a normal reboot are discarded from recovery—the primary reboot scenario advertised by this change. The clean-shutdown marker needs to distinguish an explicit in-app quit from an OS shutdown, or otherwise retain those live entries.
Useful? React with 👍 / 👎.
What changed
Why
A computer crash closes Orca terminals even though the underlying Codex or Claude transcripts remain available. Previously, Agent Snapshots could resume sessions one at a time but did not remember which sessions were open before the crash.
The existing
liveOnlysession heuristic also includes old transcripts without an explicit completion event. Using it directly for recovery could incorrectly reopen many historical sessions. Recovery now matches real Orca agent processes to session metadata by engine, workspace, start time, and explicit resume ID when available.Impact
After Agent Snapshots has observed an Orca session, an abnormal app or computer shutdown leaves that session in a recoverable queue. At the next launch, users can restore all interrupted sessions with one action. Normal exits do not create false recovery entries. The launcher always shows whether crash protection is ready.
Validation
node scripts/test-session-recovery.mjsnode scripts/test-orca-live-sessions.mjspnpm typecheckpnpm test:client-ui(17/17)pnpm test:electron-e2e