Skip to content

fix(terminal): phone wake reaches hibernated agent panes in place - #27450

Merged
OrcaWin merged 1 commit into
mainfrom
OrcaWin/fix-wake-event-name
Oct 11, 2026
Merged

OrcaWin merged 1 commit into
mainfrom
OrcaWin/fix-wake-event-name

Conversation

@OrcaWin

@OrcaWin OrcaWin commented Oct 11, 2026 •

Copy link
Copy Markdown
Collaborator
Files Added Deleted Net
Test 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​14 $\color{#cf222e}{\Huge{\mathbf{−}}}$​10 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​4
Prod 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​39 $\color{#cf222e}{\Huge{\mathbf{−}}}$​24 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​15

ELI5

When you open a worktree on your phone, Orca is supposed to wake any sleeping agents in it right where they were. The part that sends the "wake up" signal and the part that listens for it were using two slightly different names for the signal, so the listener never heard it.

What Changed

Before: opening a worktree from the phone did not wake its already-mounted, hibernated agent panes in place. The wake code still ran its fallback path, which resumes sessions into fresh tabs, so an agent could come back in a new tab instead of in the pane it was sleeping in.

After: the mounted panes receive the wake signal, wake in place, and report which sessions they took, so the fallback doesn't resume those a second time.

Mechanism: the sender fires WAKE_HIBERNATED_AGENTS_WORKTREE_EVENT (orca-wake-hibernated-agents-worktree). The pane listener subscribed to a hand-typed orca:wake-hibernated-agents-worktree (colon instead of a dash). That literal came from an earlier refactor that split a large file and replaced the shared constant with a mistyped string. This PR moves the listener into a small hibernated-agent-wake-listener.ts that imports the same constant the sender uses, and removes two type casts along the way.

Why

Using one shared constant means the sender and listener can't drift apart again. The dispatcher test used to register its own stand-in listener with the correct name, which is why it missed the bug. It now registers the real pane listener, so a mismatch fails the test. I confirmed the test fails before the fix and passes after it.

I also scanned the renderer for other custom events where a hand-typed listener or sender name has no matching counterpart. This was the only one. The other unmatched names are built-in webview events.

Linked Issue

N/A (maintainer fix)

Visual Proof

N/A. This is a signal-name fix with no visual change, and the dispatcher-to-listener test covers it.

Testing

  • I manually tested these changes locally
  • Automated tests added/updated, or explained why not below

wake-sleeping-agents-in-background.test.ts now drives the real pane listener. It checks that the targeted worktree's pane wakes, that another worktree's pane does not, and that the woken session is skipped by the fallback resume. I also ran pnpm tc, oxlint, pnpm run check:code-quality:changed and pnpm lint.

Review

Agent skill upstream boundary

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

This is renderer-only and the event never leaves the window. SSH, mobile and other platforms are unaffected except that the phone wake now works as intended.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

The pane listener subscribed to 'orca:wake-hibernated-agents-worktree' while the
dispatcher fires WAKE_HIBERNATED_AGENTS_WORKTREE_EVENT ('orca-wake-...'), so the
in-place wake never ran. Extract the listener and bind it to the shared constant;
the dispatcher test now drives the real listener instead of a stand-in.
@coderabbitai

coderabbitai Bot commented Oct 11, 2026

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 45372917-5c60-4166-9d3e-e2315eb5f352

📥 Commits

Reviewing files that changed from the base of the PR and between 6d51651 and a2f39c7.


📒 Files selected for processing (3)
  • src/renderer/src/components/terminal-pane/hibernated-agent-wake-listener.ts
  • src/renderer/src/components/terminal-pane/use-terminal-pane-lifecycle.ts
  • src/renderer/src/lib/wake-sleeping-agents-in-background.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 2 remain after this review.



📝 Walkthrough

Walkthrough

The lifecycle hook now delegates hibernated-agent wake handling to a dedicated listener. The listener filters events by type and worktree, invokes matching pane bindings, tracks returned claim keys, and provides a cleanup function. A test registers listeners for two worktrees and verifies that a wake for one worktree invokes only its pane’s wake callback.


Priority: ➖ Normal

Merge Risk: ⚪ Minimal · up to a2f39

This change fixes the event-name mismatch so hibernated agents wake in their existing panes. No actionable merge risk was found.

Pre-merge checks | Passed 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check Passed The title clearly and concisely describes the primary fix: phone-triggered wake events now reach hibernated terminal agent panes in place.
Description check Passed The description includes all required sections and clearly explains the user impact, root cause, implementation, testing, scope, and checklist status. It provides an appropriate N/A explanation for vi…
Docstring Coverage Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 3 files.
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.

✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@OrcaWin
OrcaWin merged commit 4468a53 into main Oct 11, 2026
37 checks passed
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