Repository navigation
Hibernate completed runtime-owned agents - #5473
Conversation
|
Ready to review this PR? Stage has broken it down into 8 individual chapters for you: Chapters generated by Stage for commit faf934e on Jun 16, 2026 7:06am UTC. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📥 CommitsReviewing files that changed from the base of the PR and between 24d776d59bf784a549d70f712d1cfb0d65c80474 and faf934e. 📒 Files selected for processing (17)
🚧 Files skipped from review as they are similar to previous changes (15)
📝 WalkthroughWalkthroughThis PR implements runtime-backed agent hibernation with exact PTY stop verification. The daemon IPC protocol is bumped to version 14 with an 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
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: 4
🧹 Nitpick comments (3)
src/main/daemon/daemon-pty-router.ts (1)
124-125: ⚡ Quick winAdd a short “why” comment for fail-closed aggregation.
This change is intentionally non-obvious (one adapter failure now rejects the whole call), so please document the rationale inline to prevent future regressions.
Suggested patch
async listProcesses(): Promise<{ id: string; cwd: string; title: string }[]> { + // Why: runtime exact-stop/liveness flows must fail closed if any adapter + // cannot provide a trustworthy process list. const results = await Promise.all(this.allAdapters().map((adapter) => adapter.listProcesses())) return results.flat() }As per coding guidelines, "When writing or modifying code driven by a design doc or non-obvious constraint, add a comment explaining why the code behaves the way it does."
Source: Coding guidelines
src/renderer/src/lib/agent-hibernation-planner.test.ts (1)
180-210: ⚡ Quick winAdd a regression test where runtime liveness is empty but renderer PTY state is stale/non-empty.
Please add a case with
runtimeLivenessRequiredWorktreeIds: ['wt-bg'],runtimeLivePtyIdsByWorktreeId: { 'wt-bg': [] }, andptyIdsByTabId: { 'tab-1': ['pty-1'] }to assert no candidate is produced.src/renderer/src/store/slices/terminals.ts (1)
1703-1735: 💤 Low valueConsider extracting the suppression rollback pattern.
The same rollback logic (
set+ loop deleting fromsuppressedPtyExitIds) appears three times in the exact-stop error handling paths. A small helper function would reduce duplication and make the intent clearer.♻️ Suggested helper extraction
+ const clearSuppressedPtyExits = (ptyIds: string[]) => { + set((s) => { + const next = { ...s.suppressedPtyExitIds } + for (const ptyId of ptyIds) { + delete next[ptyId] + } + return { suppressedPtyExitIds: next } + }) + }Then each rollback becomes
clearSuppressedPtyExits(shutdownPtyIds).
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 68b87ed1-8ff4-4b46-bd90-f71039b5965d
📥 Commits
Reviewing files that changed from the base of the PR and between 1ccc07c and 29090fdf20898c48f7320c223df960be9f480d54.
📒 Files selected for processing (29)
src/main/daemon/daemon-pty-adapter.test.tssrc/main/daemon/daemon-pty-adapter.tssrc/main/daemon/daemon-pty-provider.tssrc/main/daemon/daemon-pty-router.test.tssrc/main/daemon/daemon-pty-router.tssrc/main/daemon/daemon-server.tssrc/main/daemon/terminal-host.test.tssrc/main/daemon/terminal-host.tssrc/main/daemon/types.tssrc/main/ipc/pty.test.tssrc/main/ipc/pty.tssrc/main/runtime/orca-runtime.test.tssrc/main/runtime/orca-runtime.tssrc/main/runtime/orchestration/groups.test.tssrc/main/runtime/rpc/methods/orchestration.test.tssrc/main/runtime/rpc/methods/terminal.tssrc/main/runtime/runtime-rpc.test.tssrc/renderer/src/components/terminal-pane/pty-connection.test.tssrc/renderer/src/components/terminal-pane/pty-connection.tssrc/renderer/src/components/terminal-pane/use-notification-dispatch.test.tssrc/renderer/src/components/terminal-pane/use-notification-dispatch.tssrc/renderer/src/lib/agent-hibernation-coordinator.test.tssrc/renderer/src/lib/agent-hibernation-coordinator.tssrc/renderer/src/lib/agent-hibernation-planner.test.tssrc/renderer/src/lib/agent-hibernation-planner.tssrc/renderer/src/store/slices/agent-status.tssrc/renderer/src/store/slices/store-cascades.test.tssrc/renderer/src/store/slices/terminals.tssrc/shared/runtime-types.ts
24d776d to
faf934e
Compare
Summary
ptyIdsByTabIdis empty.Design and review
.agents/tmp/agent-hibernation-liveness-design.md(scratch pipeline context, intentionally not committed).RuntimeTerminalSummary.ptyId, exact-stop verification, and fail-closed handling for missing/error/truncated liveness.Completeness verification
Code review
review-coderound completed after the final fixes.No issues found.No issues found.Brennan test changes
Verdict:
land.Evidence:
brennanb2025/investigate-memory-usage, root/Users/thebr/orca/workspaces/orca/horseshoe.terminal.stopExact({ keepHistory: true }): before stop, bothterminal.list(requireFreshPtyLiveness)andpty.listSessionsshowed the PTY live; stop returnedpostStopVerified: true; after stop, both lists were empty. This retested the prior blocker.pty.kill(..., { keepHistory: true }): before kill the PTY was live in runtime and PTY session lists; after kill both were empty.orca-ssh-test-1781587136, repo/work/demo-project; Orca connected, relay deployed, remote repo/worktree created, remote PTY listed live,terminal.stopExact({ keepHistory: true })returnedpostStopVerified: true, and after stop both runtime list andpty.listSessionswere empty.Tests
pnpm exec vitest run --config config/vitest.config.ts src/renderer/src/components/terminal-pane/pty-connection.test.ts -t "cold-spawns slept remote runtime PTYs|remote runtime PTY handles|restored encoded remote"pnpm exec vitest run --config config/vitest.config.ts src/main/ipc/pty.test.ts -t "ordinary daemon-backed pty kill|stopAndWait"pnpm exec vitest run --config config/vitest.config.ts src/renderer/src/lib/agent-hibernation-planner.test.ts src/renderer/src/lib/agent-hibernation-coordinator.test.ts src/renderer/src/components/terminal-pane/use-notification-dispatch.test.ts src/renderer/src/components/terminal-pane/pty-connection.test.ts src/renderer/src/store/slices/store-cascades.test.ts src/main/runtime/orca-runtime.test.ts src/main/runtime/runtime-rpc.test.ts src/main/ipc/pty.test.ts src/main/daemon/daemon-pty-router.test.ts src/main/daemon/terminal-host.test.ts src/main/daemon/daemon-pty-adapter.test.ts(11 files, 918 tests)pnpm run typecheck:nodepnpm run typecheck:webpnpm run typecheck:clipnpm run typecheckpnpm run lintpnpm exec oxlint $(git diff --name-only)pnpm build:relaygit diff --checkAssumptions and residual risk