Repository navigation
Fix recipe serve desktop promotion - #8646
Conversation
|
Warning Review limit reached
Next review available in: 7 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📥 CommitsReviewing files that changed from the base of the PR and between a4fea5b9acd52519a37a4608df5a34fc8028125b and 6ad6e84. 📒 Files selected for processing (20)
📝 WalkthroughWalkthroughAdds a gated headless-to-desktop activation flow that reports desktop window availability, preserves runtime and PTY identity during promotion, and blocks activation when local PTY support is unavailable. CLI clients now propagate and display desktop status while polling for activation. Startup, runtime, single-instance, quit-policy, unit, wiring, Electron lifecycle, and reliability-gate coverage are added or updated. 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 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 |
There was a problem hiding this comment.
Actionable comments posted: 3
🧹 Nitpick comments (2)
src/cli/runtime/client.ts (2)
118-121: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winConsistently resolve desktop window status.
For remote status, this code only checks
response.result.desktopWindowStatusand misses the fallback for older runtimes that rely onauthoritativeWindowId. Consider exporting and reusingresolveDesktopWindowStatusfromstatus.tsto ensure consistent reporting across local and remote connections.♻️ Proposed fix
You will also need to export
resolveDesktopWindowStatusfromsrc/cli/runtime/status.tsand import it in this file.- ...(response.result.desktopWindowStatus - ? { desktopWindowStatus: response.result.desktopWindowStatus } - : {}) + ...(() => { + const resolved = resolveDesktopWindowStatus(response.result) + return resolved ? { desktopWindowStatus: resolved } : {} + })()
179-182: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick winCheck for blocked status before launching the app.
If the app is already known to be
blocked(i.e. running headlessly and cannot open a window), callinglaunchOrcaApp()unnecessarily spawns a detached process that will simply hit the single-instance lock and exit. Moving this check before the launch avoids the unnecessary process spawn.⚡ Proposed fix
- launchOrcaApp() - if (initial.result.app.desktopWindowStatus === 'blocked') { - throwDesktopActivationBlocked() - } + if (initial.result.app.desktopWindowStatus === 'blocked') { + throwDesktopActivationBlocked() + } + launchOrcaApp()
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: f5b81bce-5f61-4c70-b1b6-20780d26ad23
📥 Commits
Reviewing files that changed from the base of the PR and between 67fdb1c and a4fea5b9acd52519a37a4608df5a34fc8028125b.
📒 Files selected for processing (20)
config/reliability-gates.jsoncsrc/cli/format.tssrc/cli/runtime-client.test.tssrc/cli/runtime/client.tssrc/cli/runtime/status.tssrc/cli/runtime/websocket-transport.test.tssrc/main/index.tssrc/main/runtime/orca-runtime.test.tssrc/main/runtime/orca-runtime.tssrc/main/ssh/ssh-remote-cli-format.tssrc/main/ssh/ssh-remote-orca-cli.tssrc/main/startup/serve-desktop-activation-wiring.test.tssrc/main/startup/serve-desktop-activation.test.tssrc/main/startup/serve-desktop-activation.tssrc/main/startup/single-instance-lock.test.tssrc/main/startup/single-instance-lock.tssrc/main/startup/window-all-closed-quit-policy.test.tssrc/main/startup/window-all-closed-quit-policy.tssrc/shared/runtime-types.tstests/e2e/headless-serve-desktop-activation.spec.ts
- Check desktopWindowStatus before spawning the Orca app so a blocked runtime no longer launches a doomed second instance. - Reuse resolveDesktopWindowStatus for remote runtime status so it honors the same authoritativeWindowId fallback as local status. - Re-check the authoritative window at spawn time instead of trusting a possibly-stale snapshot, since it can be destroyed mid-await. - Harden the e2e activation spec against silent spawn failures.
c521442 to
6ad6e84
Compare
…esktop promotion (#12666) STA-1716 reported that a packaged `orca serve` could become the single-instance owner after the desktop app exits, leaving Dock/Finder unable to restore a window — and that forcing a reopen made the headless process hydrate a renderer that interrupted and DUPLICATED live agent sessions. Verification against main found every criterion already fixed (#8646 for desktop promotion and the fail-closed CLI, #12212 for duplicate serve activation, #12574 + #9729 for the resume/ownership guards). The genuine gap was criterion 6: the ticket's own automated regression never existed. An existing reliability gate asserted PTY identity survives promotion, but nothing asserted what the incident was actually about — how many agents the promoted renderer resumes. This adds that coverage: a unit/service-level journey that drives the real single-instance lock, activation gate, settle and focus paths, then runs the real resume logic against a store seeded as a renderer freshly mounted inside the serve process, asserting zero duplicate resumes. `settleServeDesktopActivation` moved from `index.ts` into its own module with identical semantics, so the test drives the real decision rather than re-implementing it — the earlier repro had to mirror that logic locally, which is the "test passes without running the scenario" failure mode. Proven to be a real oracle: breaking each guard individually turns it red, and reverting the pre-#12574 pane form reproduces the incident exactly (two duplicate `codex resume` tabs).
* fix(runtime): preserve terminals during headless desktop activation * rm design doc * Fix desktop activation launch ordering and blocked-window status resolut - Check desktopWindowStatus before spawning the Orca app so a blocked runtime no longer launches a doomed second instance. - Reuse resolveDesktopWindowStatus for remote runtime status so it honors the same authoritativeWindowId fallback as local status. - Re-check the authoritative window at spawn time instead of trusting a possibly-stale snapshot, since it can be destroyed mid-await. - Harden the e2e activation spec against silent spawn failures. --------- Co-authored-by: bbingz <[email protected]>
…esktop promotion (stablyai#12666) STA-1716 reported that a packaged `orca serve` could become the single-instance owner after the desktop app exits, leaving Dock/Finder unable to restore a window — and that forcing a reopen made the headless process hydrate a renderer that interrupted and DUPLICATED live agent sessions. Verification against main found every criterion already fixed (stablyai#8646 for desktop promotion and the fail-closed CLI, stablyai#12212 for duplicate serve activation, stablyai#12574 + stablyai#9729 for the resume/ownership guards). The genuine gap was criterion 6: the ticket's own automated regression never existed. An existing reliability gate asserted PTY identity survives promotion, but nothing asserted what the incident was actually about — how many agents the promoted renderer resumes. This adds that coverage: a unit/service-level journey that drives the real single-instance lock, activation gate, settle and focus paths, then runs the real resume logic against a store seeded as a renderer freshly mounted inside the serve process, asserting zero duplicate resumes. `settleServeDesktopActivation` moved from `index.ts` into its own module with identical semantics, so the test drives the real decision rather than re-implementing it — the earlier repro had to mirror that logic locally, which is the "test passes without running the scenario" failure mode. Proven to be a real oracle: breaking each guard individually turns it red, and reverting the pre-stablyai#12574 pane form reproduces the incident exactly (two duplicate `codex resume` tabs).
Summary
Describe the user-visible change.
Screenshots
No visual change.Testing
pnpm lintpnpm typecheckpnpm testpnpm buildAI Review Report
Summarize the code review you ran with your AI coding agent. Include the main risks it checked, what it flagged, and what you changed or verified as a result.
Confirm that the review explicitly checked cross-platform compatibility for macOS, Linux, and Windows, including shortcuts, labels, paths, shell behavior, and any Electron-specific platform differences touched by this PR.
Security Audit
Provide a basic security audit summary from your AI coding agent. Call out any input handling, command execution, path handling, auth, secrets, dependency, or IPC risks that were reviewed, plus any follow-up needed.
Notes
Call out any platform-specific behavior, risks, or follow-up work.