Skip to content

Keep hibernated agent completions visible - #5689

Merged
brennanb2025 merged 2 commits into
mainfrom
brennanb2025/agent-hibernation-visibility
Jun 18, 2026
Merged

brennanb2025 merged 2 commits into
mainfrom
brennanb2025/agent-hibernation-visibility

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Jun 18, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Keeps completed agents visible on the worktree card after experimental auto-hibernation. The shutdown path now distinguishes manual sleep/remove from automatic completed-agent hibernation, retaining only the hibernated clean done pane as passive completion evidence while preserving the resumable sleeping session.

Retained agent rows are marked separately from live rows and are inert when clicked, so the visible completion evidence does not activate, focus, spawn, wake, or resume the slept terminal. Manual sleep/remove still fold retained rows as before.

Design Review

Created a scratch design doc at design-docs/agent-hibernation-retained-worktree-card.md (ignored, not included in the PR). The delegated design review completed as READY after tightening the design to use semantic shutdown reasons and preserve only hibernated pane keys.

Implementation Notes

  • Added auto-hibernate-completed-agent shutdown reason plumbing from the hibernation coordinator into terminal/status teardown.
  • Added hibernated completion evidence capture for clean, non-interrupted done rows in the sleepingPaneKeys allowlist.
  • Prevented stale pre-stop evidence from being retained if the live row changes during exact runtime stop.
  • Added row-source markers so retained rows remain visible but passive in full and compact worktree-card agent lists.

No deviations from the reviewed design remain after completeness fixes.

Verification

Completeness verification:

  • First pass found retained rows were still actionable; fixed with row-source markers and inert retained-row activation.
  • Second pass found stale pre-stop evidence could survive if live state changed; fixed so post-stop live state wins.
  • Final pass returned no issues.

Code review loop:

  • Round 1: one reviewer clean; one reviewer found retained startedAt used completion time instead of original start time.
  • Fix: retained hibernation evidence now uses the first state-history start when available, with regression coverage.
  • Round 2: both independent reviewers returned clean.

brennan-test-changes verdict: land.

  • Validated in Electron against demo-project using a real Codex agent turn.
  • Observed working -> clean done hook state with resumable provider session.
  • Triggered real auto-hibernation coordinator path.
  • Verified retained done evidence stayed visible on the card and row click did not activate/reveal/focus/spawn/wake/resume.
  • Verified manual sleep path folded retained rows afterward.
  • Screenshot evidence path: /tmp/orca-sturgeon-retained-done-row.png.

Checks

  • pnpm exec vitest run --config config/vitest.config.ts src/renderer/src/store/slices/store-cascades.test.ts src/renderer/src/lib/agent-hibernation-coordinator.test.ts src/renderer/src/components/sidebar/useWorktreeAgentRows.test.ts src/renderer/src/components/sidebar/worktree-title-derived-agent-rows.test.ts src/renderer/src/components/sidebar/WorktreeCardAgents.test.tsx passed: 5 files, 153 tests.
  • pnpm run typecheck:web passed.
  • pnpm run typecheck passed during brennan-test-changes.
  • pnpm run lint passed during brennan-test-changes, with one existing warning in SourceControl.tsx.
  • git diff --check passed.
  • Pre-commit hook passed: oxlint, react doctor oxlint config, oxfmt.

Assumptions / Gaps

  • SSH/remoting-specific manual validation was not run; the change preserves existing exact-stop/runtime/remote PTY handling and does not add platform-specific behavior.
  • Manual sleep was validated through the terminal slice after hibernation because the UI sleep menu is only available while live activity exists.

Made with Orca 🐋


Open in Stage

@ghost

ghost commented Jun 18, 2026 •

Copy link
Copy Markdown

Ready to review this PR? Stage has broken it down into 7 individual chapters for you:

Title
1 Define agent row source types
2 Add shutdown reasons to agent status store
3 Wire hibernation reason through terminal slice
4 Trigger auto-hibernation from the coordinator
5 Mark agent rows with source metadata
6 Make retained rows passive in UI
7 Verify hibernation hygiene and UI behavior
Open in Stage

Chapters generated by Stage for commit e70b96d on Jun 18, 2026 6:20pm UTC.

@coderabbitai

coderabbitai Bot commented Jun 18, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 79bb4bdd-a2bb-4a06-aa91-7e2c8c20c71e

📥 Commits

Reviewing files that changed from the base of the PR and between 388bbb1 and e70b96d.

📒 Files selected for processing (1)
  • src/renderer/src/components/sidebar/WorktreeCardAgents.test.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/renderer/src/components/sidebar/WorktreeCardAgents.test.tsx

📝 Walkthrough

Walkthrough

This PR introduces a rowSource: 'live' | 'retained' discriminator on DashboardAgentRow and stamps all row-building sites accordingly. A new 'auto-hibernate-completed-agent' shutdown reason is added to the agent-status and terminals slices. When a worktree is shut down with this reason, shutdownWorktreeTerminals collects completed non-interrupted agent entries as retained evidence via collectHibernatedCompletionEvidenceForWorktree and passes them to dropAgentStatusByWorktree, which preserves them in retainedAgentsByPaneKey instead of discarding them. The hibernation coordinator passes this reason when triggering auto-hibernation. In the sidebar UI, retained rows are wired to a no-op handleActivateRetainedAgent callback so clicking them does not activate any tab.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 6.67% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Keep hibernated agent completions visible' directly reflects the main objective: retaining completed agent hibernations as visible passive completion evidence after auto-hibernation is triggered.
Description check ✅ Passed The description is comprehensive and covers all required template sections: Summary explains the user-visible change, Screenshots section indicates no visual change, Testing section confirms all checks passed with specific test counts, AI Review Report and Security Audit are included with detailed implementation notes, and Notes section addresses verification and design decisions.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 53158a40-9df3-4893-9149-b967a21cd988

📥 Commits

Reviewing files that changed from the base of the PR and between e22d2c2 and 388bbb1.

📒 Files selected for processing (10)
  • src/renderer/src/components/dashboard/useDashboardData.ts
  • src/renderer/src/components/sidebar/WorktreeCardAgents.test.tsx
  • src/renderer/src/components/sidebar/WorktreeCardAgents.tsx
  • src/renderer/src/components/sidebar/worktree-agent-rows.ts
  • src/renderer/src/components/sidebar/worktree-title-derived-agent-rows.ts
  • src/renderer/src/lib/agent-hibernation-coordinator.test.ts
  • src/renderer/src/lib/agent-hibernation-coordinator.ts
  • src/renderer/src/store/slices/agent-status.ts
  • src/renderer/src/store/slices/store-cascades.test.ts
  • src/renderer/src/store/slices/terminals.ts

@brennanb2025
brennanb2025 merged commit 3ce1a26 into main Jun 18, 2026
1 check passed
carlosbaraza added a commit to carlosbaraza/orca that referenced this pull request Jun 18, 2026
* upstream/main: (220 commits)
  Show and Filter Automation-Created Workspaces (stablyai#5697)
  Fix premature project header truncation
  Send review notes to any running agent of a worktree (stablyai#5654)
  Fix workspace sidebar appearance setting (stablyai#5725)
  Highlight the open file in the Source Control sidebar (stablyai#5667)
  release: v1.4.80-rc.1
  Fix premature Codex completion notifications (stablyai#5682)
  Improve Codex startup prompt reliability (stablyai#5686)
  Keep hibernated agent completions visible (stablyai#5689)
  Move Prompt Cache Timer setting to Agents pane, simplify expired state (stablyai#5691)
  release: v1.4.80-rc.0
  Skip GitHub CLI preflight checks if no GitHub projects exist
  fix: restore font family keyboard navigation in settings
  Update README downloads badge
  fix(landing): make GitHub CLI setup nudge dismissible and provider-aware (stablyai#5688)
  Fix nested workspace card indentation (stablyai#5684)
  Fix flaky e2e tests (stablyai#5680)
  Replace plus icon with play button on quick command entry (stablyai#5674)
  Use managed Pi and OMP extensions (stablyai#5681)
  Narrow computer-use e2e trigger (stablyai#5685)
  ...

# Conflicts:
#	mobile/src/terminal/TerminalWebView.tsx
#	mobile/src/terminal/terminal-webview-text-zoom.test.ts
carlosbaraza added a commit to carlosbaraza/orca that referenced this pull request Jun 18, 2026
* upstream/main: (78 commits)
  Show and Filter Automation-Created Workspaces (stablyai#5697)
  Fix premature project header truncation
  Send review notes to any running agent of a worktree (stablyai#5654)
  Fix workspace sidebar appearance setting (stablyai#5725)
  Highlight the open file in the Source Control sidebar (stablyai#5667)
  release: v1.4.80-rc.1
  Fix premature Codex completion notifications (stablyai#5682)
  Improve Codex startup prompt reliability (stablyai#5686)
  Keep hibernated agent completions visible (stablyai#5689)
  Move Prompt Cache Timer setting to Agents pane, simplify expired state (stablyai#5691)
  release: v1.4.80-rc.0
  Skip GitHub CLI preflight checks if no GitHub projects exist
  fix: restore font family keyboard navigation in settings
  Update README downloads badge
  fix(landing): make GitHub CLI setup nudge dismissible and provider-aware (stablyai#5688)
  Fix nested workspace card indentation (stablyai#5684)
  Fix flaky e2e tests (stablyai#5680)
  Replace plus icon with play button on quick command entry (stablyai#5674)
  Use managed Pi and OMP extensions (stablyai#5681)
  Narrow computer-use e2e trigger (stablyai#5685)
  ...

# Conflicts:
#	mobile/app/h/[hostId]/session/[worktreeId].tsx
#	mobile/src/terminal/TerminalWebView.tsx
#	mobile/src/terminal/terminal-webview-html.ts
carlosbaraza added a commit to carlosbaraza/orca that referenced this pull request Jun 18, 2026
* upstream/main: (220 commits)
  Show and Filter Automation-Created Workspaces (stablyai#5697)
  Fix premature project header truncation
  Send review notes to any running agent of a worktree (stablyai#5654)
  Fix workspace sidebar appearance setting (stablyai#5725)
  Highlight the open file in the Source Control sidebar (stablyai#5667)
  release: v1.4.80-rc.1
  Fix premature Codex completion notifications (stablyai#5682)
  Improve Codex startup prompt reliability (stablyai#5686)
  Keep hibernated agent completions visible (stablyai#5689)
  Move Prompt Cache Timer setting to Agents pane, simplify expired state (stablyai#5691)
  release: v1.4.80-rc.0
  Skip GitHub CLI preflight checks if no GitHub projects exist
  fix: restore font family keyboard navigation in settings
  Update README downloads badge
  fix(landing): make GitHub CLI setup nudge dismissible and provider-aware (stablyai#5688)
  Fix nested workspace card indentation (stablyai#5684)
  Fix flaky e2e tests (stablyai#5680)
  Replace plus icon with play button on quick command entry (stablyai#5674)
  Use managed Pi and OMP extensions (stablyai#5681)
  Narrow computer-use e2e trigger (stablyai#5685)
  ...

# Conflicts:
#	src/renderer/src/i18n/locales/en.json
#	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
carlosbaraza added a commit to carlosbaraza/orca that referenced this pull request Jun 18, 2026
* upstream/main: (341 commits)
  Show and Filter Automation-Created Workspaces (stablyai#5697)
  Fix premature project header truncation
  Send review notes to any running agent of a worktree (stablyai#5654)
  Fix workspace sidebar appearance setting (stablyai#5725)
  Highlight the open file in the Source Control sidebar (stablyai#5667)
  release: v1.4.80-rc.1
  Fix premature Codex completion notifications (stablyai#5682)
  Improve Codex startup prompt reliability (stablyai#5686)
  Keep hibernated agent completions visible (stablyai#5689)
  Move Prompt Cache Timer setting to Agents pane, simplify expired state (stablyai#5691)
  release: v1.4.80-rc.0
  Skip GitHub CLI preflight checks if no GitHub projects exist
  fix: restore font family keyboard navigation in settings
  Update README downloads badge
  fix(landing): make GitHub CLI setup nudge dismissible and provider-aware (stablyai#5688)
  Fix nested workspace card indentation (stablyai#5684)
  Fix flaky e2e tests (stablyai#5680)
  Replace plus icon with play button on quick command entry (stablyai#5674)
  Use managed Pi and OMP extensions (stablyai#5681)
  Narrow computer-use e2e trigger (stablyai#5685)
  ...

# Conflicts:
#	src/main/text-generation/commit-message-text-generation.test.ts
#	src/main/text-generation/commit-message-text-generation.ts
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant