Repository navigation
fix(hibernation): park completed background tabs in the active worktree - #16214
sanshengai wants to merge 1 commit into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthroughThe agent hibernation planner no longer excludes the active worktree from candidate evaluation. Foreground-tab and other eligibility checks remain in place. Tests now focus the first case on disabled and foreground conditions, and the sibling-tab case marks Merge Risk: ⚪ Minimal · up to The change narrows hibernation protection to the visible tab while allowing completed idle sibling tabs to hibernate; no actionable merge-blocking risk remains after normal checks and review. 🚥 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 |
The planner skipped the entire activeWorktreeId, so the tree a user actually works in never parked anything — exactly where a 16 GB Windows host accumulates its idle Codex/Grok panes and starts hard-paging (#16211). The two guards that remain are the correct granularity and already existed: foregroundTerminalTabIds covers the tab on screen, and the foregroundTerminalLastSeenAtByTabId floor in getEligiblePane holds any tab left inside the idle window. Test lever taken from @sanshengai's #16214, which found this first: pinning the existing sibling-tab regression to activeWorktreeId means it fails against the pre-fix planner. A standalone background-worktree case does not, because the fixture's active worktree is a different one — that is why the first cut of this change shipped a vacuous test. #16214 changed only the planner suite; the same one-line change also breaks agent-hibernation-coordinator's two revalidation tests, which used activeWorktreeId as their eligibility lever. Those now flip setForegroundTerminalTabIds instead, which is the property they were written to prove. Co-authored-by: sanshengai <sanshengai@users.noreply.github.com>
) The planner skipped the entire activeWorktreeId, so the tree a user actually works in never parked anything — exactly where a 16 GB Windows host accumulates its idle Codex/Grok panes and starts hard-paging (#16211). The two guards that remain are the correct granularity and already existed: foregroundTerminalTabIds covers the tab on screen, and the foregroundTerminalLastSeenAtByTabId floor in getEligiblePane holds any tab left inside the idle window. Test lever taken from @sanshengai's #16214, which found this first: pinning the existing sibling-tab regression to activeWorktreeId means it fails against the pre-fix planner. A standalone background-worktree case does not, because the fixture's active worktree is a different one — that is why the first cut of this change shipped a vacuous test. #16214 changed only the planner suite; the same one-line change also breaks agent-hibernation-coordinator's two revalidation tests, which used activeWorktreeId as their eligibility lever. Those now flip setForegroundTerminalTabIds instead, which is the property they were written to prove. Co-authored-by: sanshengai <sanshengai@users.noreply.github.com>
|
Thank you for this — you found this root cause first, and your test approach was better than mine. What happened: I independently hit the same one-line planner fix in #16591. My version shipped a vacuous test — it used a background worktree while the fixture's Why this PR could not merge as-is: it is ~142 commits behind What landed: #16591, which takes your test lever and adds the coordinator-test fix, with you credited as Closing this in favour of that, but the credit is yours. Also worth saying: your #16217 (auto-releasing completed worker terminals) covers a part of #16211 that none of my PRs touch — my own triage confirmed completed workers stay |
…blyai#16591) The planner skipped the entire activeWorktreeId, so the tree a user actually works in never parked anything — exactly where a 16 GB Windows host accumulates its idle Codex/Grok panes and starts hard-paging (stablyai#16211). The two guards that remain are the correct granularity and already existed: foregroundTerminalTabIds covers the tab on screen, and the foregroundTerminalLastSeenAtByTabId floor in getEligiblePane holds any tab left inside the idle window. Test lever taken from @sanshengai's stablyai#16214, which found this first: pinning the existing sibling-tab regression to activeWorktreeId means it fails against the pre-fix planner. A standalone background-worktree case does not, because the fixture's active worktree is a different one — that is why the first cut of this change shipped a vacuous test. stablyai#16214 changed only the planner suite; the same one-line change also breaks agent-hibernation-coordinator's two revalidation tests, which used activeWorktreeId as their eligibility lever. Those now flip setForegroundTerminalTabIds instead, which is the property they were written to prove. Co-authored-by: sanshengai <sanshengai@users.noreply.github.com>
…blyai#16591) The planner skipped the entire activeWorktreeId, so the tree a user actually works in never parked anything — exactly where a 16 GB Windows host accumulates its idle Codex/Grok panes and starts hard-paging (stablyai#16211). The two guards that remain are the correct granularity and already existed: foregroundTerminalTabIds covers the tab on screen, and the foregroundTerminalLastSeenAtByTabId floor in getEligiblePane holds any tab left inside the idle window. Test lever taken from @sanshengai's stablyai#16214, which found this first: pinning the existing sibling-tab regression to activeWorktreeId means it fails against the pre-fix planner. A standalone background-worktree case does not, because the fixture's active worktree is a different one — that is why the first cut of this change shipped a vacuous test. stablyai#16214 changed only the planner suite; the same one-line change also breaks agent-hibernation-coordinator's two revalidation tests, which used activeWorktreeId as their eligibility lever. Those now flip setForegroundTerminalTabIds instead, which is the property they were written to prove. Co-authored-by: sanshengai <sanshengai@users.noreply.github.com>
…blyai#16591) The planner skipped the entire activeWorktreeId, so the tree a user actually works in never parked anything — exactly where a 16 GB Windows host accumulates its idle Codex/Grok panes and starts hard-paging (stablyai#16211). The two guards that remain are the correct granularity and already existed: foregroundTerminalTabIds covers the tab on screen, and the foregroundTerminalLastSeenAtByTabId floor in getEligiblePane holds any tab left inside the idle window. Test lever taken from @sanshengai's stablyai#16214, which found this first: pinning the existing sibling-tab regression to activeWorktreeId means it fails against the pre-fix planner. A standalone background-worktree case does not, because the fixture's active worktree is a different one — that is why the first cut of this change shipped a vacuous test. stablyai#16214 changed only the planner suite; the same one-line change also breaks agent-hibernation-coordinator's two revalidation tests, which used activeWorktreeId as their eligibility lever. Those now flip setForegroundTerminalTabIds instead, which is the property they were written to prove. Co-authored-by: sanshengai <sanshengai@users.noreply.github.com> (cherry picked from commit e2cb797)
…blyai#16591) The planner skipped the entire activeWorktreeId, so the tree a user actually works in never parked anything — exactly where a 16 GB Windows host accumulates its idle Codex/Grok panes and starts hard-paging (stablyai#16211). The two guards that remain are the correct granularity and already existed: foregroundTerminalTabIds covers the tab on screen, and the foregroundTerminalLastSeenAtByTabId floor in getEligiblePane holds any tab left inside the idle window. Test lever taken from @sanshengai's stablyai#16214, which found this first: pinning the existing sibling-tab regression to activeWorktreeId means it fails against the pre-fix planner. A standalone background-worktree case does not, because the fixture's active worktree is a different one — that is why the first cut of this change shipped a vacuous test. stablyai#16214 changed only the planner suite; the same one-line change also breaks agent-hibernation-coordinator's two revalidation tests, which used activeWorktreeId as their eligibility lever. Those now flip setForegroundTerminalTabIds instead, which is the property they were written to prove. Co-authored-by: sanshengai <sanshengai@users.noreply.github.com>
ELI5
Orca already knows which terminal tab is actually visible. It was nevertheless exempting every completed agent in the active worktree from auto-hibernation, so background tabs in the worktree a user was viewing could stay alive forever.
What changed
The hibernation planner now applies the existing per-tab foreground guard to every worktree, including the active one. The visible terminal tab remains protected; completed, resumable sibling tabs can hibernate after the configured idle window.
Why
On small Windows hosts, users often keep several long-lived agent tabs in one active product worktree. Skipping the whole worktree leaves every completed Codex/Claude process and its MCP descendants resident. Per-tab visibility is already the more precise safety boundary.
Linked issue
Addresses #16211 (proposed slice 3).
Tests
pnpm exec vitest run --config config/vitest.config.ts src/renderer/src/lib/agent-hibernation-planner.test.ts— 31 passed.pnpm run typecheck:web— passed.oxlintandgit diff --check— passed.The repository's
pnpm testwrapper could not rebuildwindows-native-registryfor local Node 24.19.0; the same test was run directly with the repository Vitest config.Scope
AI Disclosure
This change and its regression coverage were developed with Codex assistance and reviewed against the existing hibernation safety gates.
Checklist