Skip to content

fix(updater): keep macOS Orca open when background instances block updates - #24952

Merged
OrcaWin merged 6 commits into
mainfrom
fix/macos-update-running-instances
Oct 3, 2026
Merged

OrcaWin merged 6 commits into
mainfrom
fix/macos-update-running-instances

Conversation

@OrcaWin

@OrcaWin OrcaWin commented Oct 3, 2026 •

Copy link
Copy Markdown
Collaborator
Files Added Deleted Net
Test 19 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​1247 $\color{#cf222e}{\Huge{\mathbf{−}}}$​13 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​1234
Prod 15 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​305 $\color{#cf222e}{\Huge{\mathbf{−}}}$​57 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​248

ELI5

On macOS, updating Orca could close the desktop and leave it waiting indefinitely for background Orca servers to exit. Orca now checks for those blockers before shutting down, explains what to close, and lets you retry installation without downloading again. Ordinary Quit retains macOS’s existing install-on-exit behavior and does not relaunch Orca; the new blocker check applies to Update & Restart.

What Changed

  • Query macOS's native running-application registry with the same bundle identifier and standardized bundle path that Squirrel uses. Exclude self, unregistered Node-mode workers, terminal daemons, and other installed copies. Bound the query and reject incomplete or invalid results.
  • Check before cleanup or native installation. Keep runtime services, window bounds persistence, and the renderer usable after refusal; release the restart checkpoint and provide an install retry in the update card and Settings.
  • Run the update quit guard before startup listeners. Protect the accepted retry delay, process query, and asynchronous cleanup from concurrent quits. Ordinary quit (Cmd+Q, profile-switch/admin restarts) is not intercepted: it stays on Squirrel's install-on-exit path without a relaunch; only Update & Restart runs the blocker check. Preserve that distinction when quits arrive during native staging, allow both shutdown passes after a readiness timeout, and guard the queued readiness handoff.
  • Prevent competing update checks/downloads from replacing the staged target. Cancel queued check attempts before accepting installation, protect the native staging wait as well as installation, and recheck queued launches after feed preparation.
  • Add a macOS CI workflow for the platform-specific registry and shutdown regressions, which Linux-only unit shards would otherwise skip.

The new optional retryAction status field preserves older-client behavior; status equality includes it. Two test-only repairs keep this branch compatible with current main: supply the newly required prompt registry in the Claude retention fixture, and explicitly model a legacy published tab without a host ID in the collision test. Production behavior outside the updater remains unchanged from main. No remote process enumeration or termination is introduced. Linux and Windows bypass the macOS query.

Why

Squirrel's termination listener waits for all registered application processes from the target bundle. In the original incident, the desktop exited while four orphaned --serve instances remained. Stopping those instances immediately allowed ShipIt to install and relaunch.

Checking before shutdown avoids leaving the user without a desktop while preserving background servers that may have active clients. The native registry is necessary: an executable-path process scan would incorrectly count Node-mode workers that never block Squirrel.

Linked Issue

Maintainer-reported local failure; no separate issue opened.

Visual Proof

Before/after behavior evidence:

  • Before, observed on this Mac: updating 1.4.215 → 1.4.219 closed the desktop. ShipIt logged an install request at 21:44:50 and made no progress while four background instances remained; stopping them allowed installation and relaunch at 21:50:07.
  • After, exercised with isolated native apps: two registered applications from the same temporary bundle are identified as siblings; a worker using the same executable and a registered copy from another bundle are excluded. Exiting the sibling removes the blocker.
  • After, shutdown and renderer regressions: a blocked attempt keeps services/terminals alive, displays the blocker message, and offers Try Again to install the staged package. A normal quit completes both shutdown passes. Retry-delay/query/cleanup races are vetoed; concurrent and queued checks cannot change the staged target.

No visible Orca test windows were launched. Renderer behavior is tested through component interactions rather than a screenshot. Full signed packaged bundle replacement remains unexercised.

Testing

  • Automated tests added/updated.
  • Real macOS application-registry exercise with compiled AppKit fixtures: paths with spaces, registered sibling, same-executable worker, another bundle copy, and blocker exit. Fixtures prohibit activation, create no windows, and clean up only their own processes.
  • Three independent adversarial sub-agent reviews, with fixes and regressions for the concrete findings; final re-review reported no remaining actionable P1/P2 findings.
  • Full signed packaged Update & Restart with this patch (not performed).

Passed locally on macOS:

  • 451 tests across 39 updater, native registry, startup, window lifecycle, preload, renderer, and compatibility test files after integrating current main.
  • Node, web, and CLI typechecks.
  • Production main and renderer builds; renderer boot-graph verification.
  • Changed-code quality, staged lint/React Doctor lint/format checks, and diff whitespace checks.

All tests ran with ORCA_BACKGROUND_LAUNCH=1. Linux/Windows bypass and older-host status fallback are covered by unit tests; those operating systems and SSH were not exercised locally. All required checks passed on final head e7ebe20593: five unit-test shards, macOS updater tests, Node/web/CLI typechecks, static analysis, relay integration, mobile checks, Linux/Windows packaging, and test-selection evidence. GitHub reports the PR is mergeable.

Review

Adversarial review caught and corrected:

  1. Executable scans falsely treating Node-mode workers as Squirrel blockers.
  2. A vetoed ordinary quit partially shutting down runtime services or freezing bounds persistence.
  3. Duplicate quits bypassing async cleanup.
  4. Retry errors offering a download instead of installation.
  5. Quit allowances bypassing a pending retry or blocking the second normal-shutdown pass.
  6. The accepted-retry timer window and competing/queued check races, including native staging.
  7. Ordinary quits during native staging becoming relaunching installs, a timeout blocking the second shutdown pass, and duplicate quits slipping through the readiness callback handoff.

When the registry check repeatedly fails, the error explains how to close other instances and quit normally to allow install-on-exit.

Remaining limitations: ordinary Quit keeps Squirrel’s existing behavior, so sibling applications can still delay its automatic installation. The registry query is a snapshot. An instance launched after enumeration can still make Squirrel wait; eliminating that race requires coordinated launch/update gating.

Agent skill upstream boundary

  • Not applicable.

Checklist

  • Focused on macOS update shutdown and retry behavior.
  • Explained the user-facing before/after, mechanism, and approach.
  • Before/after behavior evidence provided above.
  • Adversarially reviewed correctness and lifecycle races.
  • Cross-platform, older-client, and SSH execution boundaries considered.
  • Final-head PR CI checks passed; local verification passed.

@coderabbitai

coderabbitai Bot commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

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: e06e2c24-88c7-4dfc-a5b1-3ac777f60486
📥 Commits

Reviewing files that changed from the base of the PR and between 1e5540c and 39ac2aa.

📒 Files selected for processing (1)
  • src/main/claude/claude-child-work-evidence-retention.test.ts

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


📝 Walkthrough

Walkthrough

The change adds macOS detection for other processes running from the same app bundle. Before quit-and-install, the updater checks for those processes and reports an error if the check fails or finds any. The change also updates quit-event handling and adds an install retry action for eligible updater errors. Tests cover process queries, install preflight, quit handling, and retry behavior.

Priority: ➖ Normal

Merge Risk: ⚪ Minimal · up to 39ac2

This increment updates a child-work retention test fixture and does not change production behavior. No concrete merge-blocking risk is identified.

Architecture Summary

Architecture risk: 🔵 Low · up to 39ac2

The change affects 1 system.

Changed systems: src

Architecture concerns
No architecture-level concerns identified.

Review details

Systems and components

  • observed — src (service) was modified; 32 changed files map to changed impact.

Before / after behavior

  • observed — Modified behavior in src/main/macos-update-running-instances.integration.test.ts: Adds imports and embedded Objective-C source for a minimal AppKit application that runs normally and sleeps when given an argument.
  • observed — Modified behavior in src/main/macos-update-running-instances.integration.test.ts: Adds a Darwin-gated integration test that compiles the app, copies its bundle, and launches two instances from the original executable, a worker using that executable, and an instance from the copy. The test expects lookup by the original executable and the current PID to return only the sibling PID, lookup by the copied executable with PID 0 to return only that copy’s PID, and the sibling to disappear after termination. It checks the worker’s reported executable path and terminates remaining children and removes the temporary directory in cleanup.
  • observed — Modified behavior in src/main/macos-update-running-instances.test.ts: Imports the query and parser under test, mocks runProcess, defines a test executable path, and resets the mock before each test.
  • observed — Modified behavior in src/main/macos-update-running-instances.test.ts: Adds parser tests asserting that the current PID is excluded, empty results remain empty, and malformed, non-positive, fractional, non-number, or unsafe-integer registry values throw.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 12.50% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 24 functions across 32 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
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.
Title check ✅ Passed The title clearly summarizes the main change: keeping Orca open on macOS when background instances block an update.
Description check ✅ Passed The description covers the template’s main sections, explains the user impact and implementation, and reports testing, limitations, and review findings. It identifies the linked-issue exception for ma…
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
  • Autopilot · 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.

@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: Advanced
  • Run ID: 79cb83b5-dc02-4cb1-98da-26ad6dc39aef
📥 Commits

Reviewing files that changed from the base of the PR and between 77ad467 and 3355580.

📒 Files selected for processing (6)
  • src/main/macos-update-running-instances.integration.test.ts
  • src/main/macos-update-running-instances.test.ts
  • src/main/macos-update-running-instances.ts
  • src/main/updater-mac-install.ts
  • src/main/updater.mac-install.test.ts
  • src/main/updater/updater-install-execution.ts

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

@pullfrog pullfrog 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.

Important

The new ordinary-quit branch is fail-closed with no escape valve, so a staged update plus a failing/blocked process probe can make Cmd+Q stop working entirely. Details inline.

Reviewed changes

  • Sibling-instance probe — new macos-update-running-instances.ts lists the current user's processes with /bin/ps -U <uid> -ww -o pid=,comm=, fails closed on timeout/truncation, and returns PIDs whose normalized comm equals process.execPath (excluding self, helpers, other bundle copies, shells).
  • Pre-install gate — performQuitAndInstall awaits the probe before any cleanup, native install, or terminal shutdown; abort paths reset state, send updater:quitAndInstallAborted, surface an error, and record lifecycle.
  • Before-quit interception — a macInstallPreflightInProgress flag suppresses duplicate quits during the async probe, and ordinary quits with a ready staged update now route through performQuitAndInstall.
  • Tests — parser/probe units, a darwin-only real-process integration test, and darwin-only updater tests for blocker abort/retry, probe failure, and duplicate-quit suppression.

I verified the matching logic against upstream: SQRLTerminationListener waits for NSRunningApplications whose bundleURL equals the target bundle, so comparing comm to the main executable is a sound proxy and correctly excludes Orca Helper.app (a distinct bundle) and other app copies.

ℹ️ Nitpicks

  • The comment on updater-mac-install.ts:52 says "use the same checks as Update & Restart", but this branch also performs the install, not just checks — worth rephrasing so a future reader doesn't assume it only inspects.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏

Comment thread src/main/updater-mac-install.ts Resolved

@pullfrog pullfrog 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.

✅ No new issues found.

Reviewed changes

  • Native registry query — replaced the /bin/ps executable scan with /usr/bin/osascript running a JXA/ObjC script that calls NSRunningApplication.runningApplicationsWithBundleIdentifier and filters by bundleURL.URLByStandardizingPath, reproducing Squirrel's SQRLTerminationListener predicate exactly. The bundle path is passed as an argv element, not interpolated, and the result is parsed as strict JSON.
  • Ordinary-quit escape valve — every abort path (probe failure, blockers, native-invoke failure, error event) now calls allowMacQuitWithoutInstall(), and the guard consults macQuitWithoutInstallAllowed before the "install on ordinary quit" branch, so a refused install no longer leaves Cmd+Q un-quittable. The guard moved to app.prependListener so it vetoes before startup services tear down.
  • Install retry UX — abort statuses carry retryAction: 'install'; the update card and Settings offer Try Again that re-runs the staged install without re-downloading, while older hosts still get the download retry.
  • Check/download fencing — a pending or in-progress install now finishes the active check attempt, clears the queued background launch, and makes menu/scheduled checks and downloads bail, so a queued feed check cannot repoint the target or clear the staged package.
  • Vetoed-quit teardown — main-process-quit returns early when before-quit was already prevented, and the main-window and dashboard-popout bounds persistence skips its freeze on a vetoed quit, keeping services and persistence alive until a real quit.
  • Tests/CI — new macOS CI workflow plus tests for the native registry (compiled AppKit fixtures), quit-guard ordering, retry paths, and the check/download fences.

The prior review's open thread (fail-closed ordinary quit) is addressed. An independent pass on the quit-lifecycle state machine found no reachable sequence that leaves macInstallPreflightInProgress stuck, and an independent check against Squirrel.Mac source confirmed the registry predicate matches the termination listener. One accepted, intended consequence: after a refusal, ordinary quit stays allowed until the next update attempt, so an ordinary quit skips applying the still-staged update (consistent with "you can still quit normally without installing").

Pullfrog  | View workflow run | Using deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏

…path

Converting every quit with a staged update into quitAndInstall made Cmd+Q
relaunch Orca, refused the quit when background instances existed, and
hijacked app.relaunch()+app.quit() restart flows (profile switch, admin
restart) into an update install racing the relaunched old app. Only
Update & Restart runs the running-instance preflight now; the
quit-without-install allowance is no longer reachable and is removed.

@pullfrog pullfrog 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.

✅ No new issues found.

Reviewed changes

  • Dropped ordinary-quit interception — the before-quit guard no longer converts an ordinary quit with a staged update into a relaunching performQuitAndInstall(); ordinary quit stays on Squirrel's install-on-exit path, avoiding a race with restart flows that call app.relaunch() then app.quit(). Only the user-initiated Update & Restart path runs the blocker check.
  • Removed the now-dead escape valve — macQuitWithoutInstallAllowed / allowMacQuitWithoutInstall() and its calls in the probe-failure, blocker, and install-failure abort paths are gone, since ordinary quit is no longer blocked and the abort paths already clear preflight via resetQuitForUpdateState() → resetMacInstallState().
  • Tests updated — the darwin quit-guard and mac-install suites now assert an ordinary quit with a staged update is left alone, and that duplicate quits are still vetoed only while an Update & Restart preflight or running-instance check is pending.

This directly implements the alternate fix suggested on the earlier thread (scope the hard block to a user-initiated Update & Restart), which is cleaner than the one-shot bypass the previous commit added.

Pullfrog  | View workflow run | Using deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏

@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: Advanced
  • Run ID: ffc9e930-6225-4b7c-afc6-9e6ae701fa35
📥 Commits

Reviewing files that changed from the base of the PR and between 5b552d6 and 1e5540c.

📒 Files selected for processing (7)
  • src/main/updater-mac-install.ts
  • src/main/updater-mac-quit-guard.test.ts
  • src/main/updater.mac-install.test.ts
  • src/main/updater/updater-download-install.ts
  • src/main/updater/updater-install-execution.ts
  • src/main/updater/updater-menu-checks.ts
  • src/main/updater/updater-scheduling.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/main/updater/updater-install-execution.ts

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

return
}
// A queued check must not repoint the feed while native staging or installation is pending.
this.finishActiveUpdateCheckAttempt()

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.

🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win

🔎 Supported by static analysis

🏁 Script executed:

#!/bin/bash
# Inspect feed-pin mutations and the point at which an update-check attempt ends.
rg -n -C 12 'pinDefaultReleaseFeed\s*\(|setFeedURL\s*\(|finishActiveUpdateCheckAttempt\s*\(' src/main

Repository: stablyai/orca

Length of output: 37520


Cancel an in-flight feed pin when the check ends.

If pinDefaultReleaseFeed() is awaiting release-tag lookup when finishActiveUpdateCheckAttempt() runs, it can still call setFeedURL() afterward. The later guard in launch() prevents the stale check from starting, but it does not prevent the feed change. Check that the attempt is still active before changing the feed.

@pullfrog pullfrog 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.

✅ No new issues found.

Reviewed changes

  • Separated quit from install intent during macOS staging — replaced the boolean installRequestedAfterSquirrelReady with a 'quit' | 'install' | null requestedActionAfterSquirrelReady, so an ordinary Cmd+Q deferred while Squirrel.Mac stages now calls app.quit() once readiness arrives instead of routing into a relaunching install, and a late ordinary quit cannot downgrade a pending Update & Restart.
  • One bypass covering both shutdown passes — swapped the one-shot bypassMacInstallGuardOnce for bypassMacInstallGuardUntilNextAttempt, set by the 15s readiness-timeout safety valve and revoked by a new install attempt (setMacInstallPreflightInProgress(true) / beginMacUpdateDownload), so a timed-out quit is not re-vetoed on its second pass.
  • Fenced queued checks/downloads on the install intent — added isMacInstallRequested() to the menu/scheduled check and download gates and moved finishActiveUpdateCheckAttempt() / clearBackgroundCheckLaunchPending() ahead of the staging deferral, so a queued check cannot repoint the feed while a deferred install waits for ShipIt.
  • Tests — extended the darwin quit-guard suite to cover quit resumption, install-intent preservation, both-pass timeout bypass and its revocation, and the handoff-rejection release path, plus an end-to-end check that an explicit install requested before readiness runs the blocker probe and aborts with retryAction: 'install'.

I traced the intent state machine against every early return in performQuitAndInstall and found no reachable path that leaves macInstallPreflightInProgress set, and confirmed the new fences cannot deadlock with the timeout bypass (they are mutually exclusive by construction). CodeRabbit's feed-repoint race is already closed by the isActiveUpdateCheckAttempt(attemptId) guard before every setFeedURL; the new early teardown strengthens it.

Pullfrog  | View workflow run | Using deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏

@pullfrog pullfrog 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.

✅ No new issues found.

Reviewed changes

  • Merged current main into the branch; the only branch-authored change in this delta is the merge resolution in claude-child-work-evidence-retention.test.ts.
  • Repaired that fixture for main's new drainClaudeChildWork contract by importing ClaudePromptRegistry and passing prompts: new ClaudePromptRegistry() alongside childWork and translator.

No production file touched by this PR differs between the previously approved head 1e5540c and this head — the entire updater / quit-guard / window / renderer surface is byte-identical. drainClaudeChildWork now reads session.prompts (via claudeWaitingChildIds, claude-child-work-evidence.ts:145), and ClaudePromptRegistry takes no constructor arguments, so the fixture satisfies the new signature and the test's assertion is unaffected (no prompt cards are open, so awaitsAnswer stays false). The single prior Pullfrog thread was resolved on an earlier commit.

Pullfrog  | View workflow run | Using deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏

@pullfrog pullfrog 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.

✅ No new issues found.

Reviewed changes

  • Repaired the paired-chat collision test in StructuredAgentSessionAttentionBridge.test.tsx to model a legacy tab explicitly: it now asserts the web-session snapshot stamps executionHostId: 'runtime:env-1', then deletes that field on a copy so the test still exercises owner resolution and completion delivery for a host-stamped-absent (legacy) tab. The suite passes locally (15/15).

This delta touches test code only — every production file in the updater / quit-guard / window / renderer surface is unchanged from the previously approved head 39ac2aa.

Pullfrog  | View workflow run | Using deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏

@OrcaWin
OrcaWin merged commit 8cd9751 into main Oct 3, 2026
35 checks passed
nwparker added a commit that referenced this pull request Oct 4, 2026
* fix: preserve registered account credentials after enrollment errors

* refactor(orchestration): one function for six agent-to-agent sends (#24901)

* refactor(orchestration): send every agent-to-agent message through one sendAgentTurn

The structured mail-pointer lane and the structured worker preamble each carried a copy of
"send, wait out a pending start, read the verdict", and four dispatch-preamble sites typed into
a terminal directly. They now share sendAgentTurn, built from host.send, the host's settlement
waiter and sendTerminalAgentPrompt. Every caller passes delivery 'now', so nothing sends
differently; a source-scan ratchet keeps new direct sends out.

* test(orchestration): the refusal fixture uses a real wire refusal code

* fix(orchestration): derive the send fingerprint inside sendAgentTurn and pair target with turn

A `queue` send was refused by a real host: callers supplied a fingerprint over the body alone
while the host digests body and delivery. sendAgentTurn now builds the envelope with the
composer's own builder (extracted to structured-agent-session-send-mutation), so the fingerprint
is always over exactly the fields sent; `now` sends keep the identical digest. The pointer lane
no longer carries a fingerprint it cannot get right.

sendAgentTurn takes one argument, a union on kind that carries its own target and turn, resolved
by an exhaustive switch; the terminal turn names its purpose (only the dispatch preamble today)
instead of every terminal send inheriting the task lead line. A queued outcome keeps the host's
draft receipt, and both structured callers read outcomes exhaustively with unchanged behaviour.

The boundary test now also fences direct structured host sends, catches optional, bracket and
bound member uses, has a planted-offender self-test, and pins the unmoved terminal mail pointer
and agent-teams tmux senders.

* fix(orchestration): keep federation.ts under max-lines and satisfy prefer-template in the send ratchet

* fix(orchestration): wait on the answered submission's id when a replayed queue turn was already handed off

* test(orchestration): pin that a replayed queue turn waits for its hand-off to settle

* test(orchestration): fence call-result and cast host sends, raw terminal writes and the launch-prompt helpers

* feat(native-chat): a Claude subagent waiting on a permission prompt reads as waiting (#22634)

* feat(native-chat): a Claude subagent waiting on a permission prompt reads as waiting

A subagent's permission request reaches the parent session's callback naming the
subagent that asked (agent_id) and the tool call it gates (tool_use_id). The
pending request is recorded with the asking agent. On every drain the child-work
producer re-derives which children a pending request blocks and hands that set
to the Claude child decoder, the one owner of each child's live edges: a blocked
child reads waiting on every live edge it reports, and a child that starts or
stops waiting is a live edge of its own. Answering, denying or cancelling the
request returns the child to its prior live state; nothing is stored beyond the
pending requests.

A live task_updated carrying an error now reaches the record as the child's last
message, without an ending or a new state.

The replay test drives a scrubbed capture of the real CLI (foreground allow,
deny, interrupt, background allow, and the main agent's own request) through the
real adapter into the host's child records.

* test(native-chat): a subagent's request names it before its tool call is read

* docs(agent-status): a subagent asking for approval waits in every lane; the parent row keeps the session's own attention

* test(native-chat): hand canUseTool the asking agent without widening the helper's cast

* test(native-chat): an interrupted Claude subagent settles cancelled, not failed

A captured interrupt shows the spawn call's error result ("The user doesn't want
to proceed…") arriving before the subagent's own `task_updated {status: killed}`.
The spawn result ends nothing (the child ends only on its own terminal frame), so
the child stays live until its `killed` status settles it cancelled. A genuine
failure, captured with the subagent on a model that does not exist, sends its
`failed` status before the error result and still ends failed. Both captures now
replay through the real adapter into the host's records.

* fix(native-chat): a Claude subagent's prompt makes the parent row wait, not block

A subagent's pending prompt made the whole session `attention`, which reads as
the main agent's own `blocked` and outranks the fold's waiting arm, so the
parent row read blocked where a CLI Claude parent reads waiting. The main
agent's state now reads only its own pending prompts.

- A Claude prompt row carries the linkage of the agent that raised it: the one
  the permission request names, or the owner of the tool call it gates. The
  same join decides which child reads waiting, so the two cannot disagree.
- The status summary projects the session's own status from root prompts only;
  every other reader (delivery gates, teardown, restart) still asks whether
  anyone is waiting on a human.
- An answer keeps the prompt row's linkage by the journal's own rule: a
  revision that names no producer keeps the row's existing one.
- The child-tool queries gain the prompt's producer, so a prompt row and a
  child record answer "which agent" from the same join.

* test(native-chat): say which ids the permission capture scrubs and which are its own

* fix(native-chat): the status clock dates attention by the session's own asks only

The session's status is now `attention` only for its own pending prompt, so the
clock's fallback to a subagent's ask could no longer be reached, and it read the
journal by a different rule than the status it dates. Both now read root prompts.

The journal also stamps a Codex subagent's prompt with its thread (#22532), so a
Codex child's approval is that child's wait in the Codex lane too. Two tests
written for the earlier rule are updated: a subagent's ask leaves a running
session `working` on its turn's clock, and a Codex child's answered approval
leaves the settled parent's Activity row done with nothing unread.

* fix(native-chat): a completion still says the user is asked when a subagent asks

The turn-completion feed marked a completion `awaitingUser` from the status
summary's `attention`. The status now means the session's own agent is waiting,
so a subagent's pending approval stopped reaching the completion. The projection
now also says whether anyone is waiting on the user, as the delivery gates,
teardown and restart ask it, and the completion reads that.

The waiting-subagent replay answers its prompt with the adapter's current
response shape.

* revert(native-chat): a live Claude task's error stays out of the child's last message

No capture shows a live task_updated carrying an error, and it is unrelated to
a subagent waiting on a permission request; it leaves this PR.

* test(native-chat): settle the Claude session's startup before replaying a subagent's request

A startup frame drained child work during the first await, so answering a
request freed the child even with the answer's own republish removed.

* fix(native-chat): a Claude subagent's prompt row names it as its other rows do

The prompt row stamped only the asking agent's id, so a nested subagent's
request lost the agent that spawned it, its spawn call and its run. It now takes
the linkage the asker's own rows take: the gated tool call's, when that names the
same agent, else the one resolved through the agent's spawn call. The provider's
agent id stays the asker's id.

* fix(native-chat): a subagent's request makes the parent row wait without a child record

The parent row learned that a subagent needed the user only from that
subagent's child record, so a request no record carried (a Codex child the host
never registered, a Claude task past the live cap) left the row working or done
while the approval card sat in the chat.

"Someone in this session must answer" is now one derived session fact. The
projection names two facts instead of a mode flag: the main agent's own status
(attention only for its own request) and structuredAgentSessionAwaitsUser (any
pending prompt). The status summary publishes the second as an optional
awaitsUser, and the shared fold reads it: the main agent's own ask is blocked,
otherwise awaitsUser or a waiting child record makes the row wait. Every caller
picks the fact it means: the completion edge's awaitingUser and the delivery
gate read awaitsUser; the quit snapshot folds the same two inputs the sidebar
does.

* fix(native-chat): a client that predates awaitsUser still reads a subagent's request as attention

A status summary's status is now the main agent's own, so a client built before
the split would read a subagent's request as working (or idle) and fold it with
code that has no awaitsUser input. Clients advertise
agent-session.status-awaits-user.v1; at agentSession.subscribeStatus the host
sends any client that does not the pre-split summary: attention whenever
awaitsUser is set, without the main agent's own tool line, verdict and clock.
The feed and every in-process reader keep the canonical summary. Transitional,
like the turn-item downgrade.

* test(native-chat): a Codex subagent's approval makes its settled parent's Activity row wait

The test pinned the parent row done while a Codex child asked, through a harness
that fed no child records, so it proved nothing about the ask. It now drives the
ask twice through the real host status store: with no child record (the
session's awaitsUser alone) and with the child's own record waiting from
thread/status/changed. Both read waiting with needsAttention while the ask is
open, then done with nothing unread.

* docs(agent-status): a subagent's request reaches the parent row through awaitsUser in every structured lane

The store reference said a Codex child's request still read as the main agent's
blocked and that only the Codex hook lane fed a waiting child. Both structured
lanes stamp the asking child and feed child records, and awaitsUser carries the
request when no record does. The liveness comment goes back to main's: a child's
blocked is a failed task on an older host's legacy rows.

* fix(native-chat): the restart dialog still headlines a subagent's pending approval

The quit snapshot now records the main agent's own state, so a subagent asking
while the main agent worked recorded `working` and the dialog said "Was
mid-reply" where it used to say "Waiting for your approval". The headline now
comes from the snapshot's pending prompt, whoever raised it, with the existing
copy; `state` stays the main agent's own.

* test(orchestration): a subagent's pending approval holds structured mail delivery

Scoping the delivery gate to the main agent's own request left every gate test
green; a subagent's request now has its own case.

* fix(native-chat): a subagent's request is dated by when it was raised, on every client

Since the summary's clock became the main agent's own, nothing dated a wait
that only a subagent's request held: a pre-split client was sent attention with
no clock, where the old host dated it by the subagent's prompt, and a new
client's waiting row fell back to the time it first saw it, so after a reload a
request the user had already read could read unread again.

The session fact is now when someone started being asked: awaitsUserSince, the
oldest pending prompt whoever raised it, and its presence is what awaitsUser
meant. A row waiting on someone else's request takes that as its clock; the
downgrade for a client without the capability dates its attention by it, which
is what the old host published. A cross-version test pinned to the last
pre-split release runs the same journals through that release's projection and
through this one plus the downgrade, and compares the whole summary. The Codex
end-to-end test also reads the host's own status row, and keeps a read ask read
through a later row and a reload.

* test(native-chat): the pre-split parity check compares only the fields the split owns

An additive summary field is safe for old clients, so comparing whole summaries
against the pinned release would redden on one. The wire comment now says how
the downgrade dates attention: the main agent's own oldest ask, else
awaitsUserSince.

* test(runtime): an aged host-held working summary states that nobody is asked

The test built its working summary by overriding the status of a published
approval summary, which still carried awaitsUserSince, so the row correctly
read waiting. It now drops the request as its scenario says.

* fix(native-chat): the chat's subagent block says waiting when the strip does

While a Claude subagent's request was open, the sidebar and the composer strip
read waiting but the subagent block in the chat history a few pixels above
still read "Kicked off 1 subagent working": it shows the journal's roster
state, and the journal records no wait.

The structured chat now hands its transcript the subagents the strip shows
waiting, read from the host's child records through the strip's own row model
and matched by the provider id the roster names each one by. A running entry
the host says is waiting reads waiting in the group row, its entry and its
section head, with the strip's word and the question colour; it reads the
journal's state again as soon as the host stops reporting the wait.

* fix(native-chat): a collapsed subagent group shows a wait beside a failed sibling

A failed sibling took the group row's one alert slot, so a group with a waiting,
a working and a failed child read "1 working +1 failed" and hid the wait; it
now reads "1 working +1 waiting +1 failed". The waiting set keeps its identity
while a child frame changes no wait, so the transcript's subagent rows do not
re-render on every frame, and the test of a wait ending now updates one mounted
row instead of remounting it.

* refactor(claude): one needs-input state on the parent; the asking subagent alone reads waiting

Drop the split of the main agent's own status from a session-wide "someone must
answer" fact: awaitsUserSince, the agent-session.status-awaits-user.v1
capability and its old-client downgrade, and every reader change that only
consumed them (fold, equality, ingest, delivery gate, turn-completion feed,
quit snapshot, resume headline, status clock, status bridge, attention
dispatch) go back to main. The parent row again reads one needs-input state
for a pending request whoever asked, dated as before.

Kept: a request's owner recorded once on its prompt row with full producer
linkage; the asking subagent's own record reads waiting, re-derived on every
update; the chat history's subagent block reads that same state; an answered
subagent request stays in its subagent's group.

A subagent now waits only on a request the user can still answer (its card
open, no answer underway), and the adapter frees it before the host records an
answer or dismissal. So a waiting child record always sits beside the pending
card, and main's fold never reads the parent as waiting on it: no window after
an answer, and no ~3 s wait after a card dismissed by Stop.

* fix(claude): a subagent waits only beside its committed card

A subagent's wait was pushed to the host as soon as its request arrived,
while the request's card row reached the journal at least a microtask later.
So every subagent request published the parent row as waiting before
blocked (the main agent's own fold reads a waiting child that way), and
Activity got an extra unread "waiting" event that main never shows.

The card is now the one record of an open request. The translator records
the asker on the card once (its row's linkage) and counts the card open only
after the sink confirms its rows landed, then publishes the wait; anything
that closes the card (an answer underway, a dismissal handed to the host,
Claude's own withdrawal, the session's end) frees the subagent first. So
every publish that shows a subagent waiting also shows its pending card, and
the parent reads one needs-input state, exactly as on main.

This retires the registry's view of pending requests (unclaimed(), the
asking-child join) and the translator's holdsOpen. The prompt row's linkage
takes one rule: the agent the provider names, else the gated call's owner.

The parent-row proof now runs through the real deferred sink, durable
journal and status feed, publishing as production does, and checks at every
publish that waiting subagents have pending cards and that the parent row
matches a host fed no waits.

* fix(native-chat): a closed sink's dropped writes never read as landed

The sink's written() resolved ok when the sink was closed with writes still
queued, so a subagent's prompt card could count as open with no row in the
journal. written() now reports a close that dropped writes admitted so far
as not landed; drained() and lifecycleBarrier() keep reading a closed sink as
settled.

Tests: a card never opens when its sink closes first; a card Claude withdraws
while the sink holds the cancelled row back closes at once; two subagents
asking at once, and the main agent asking beside a subagent, keep the parent
row as before with each waiting subagent beside its own card; a process that
dies mid-request leaves no subagent waiting.

* fix(claude): a withdrawn subagent request frees its child before its card closes

Main's sink now hands each write to the journal as it is submitted, and an idle journal commits it
and runs the publication at once. Claude's own withdrawal of a subagent's request therefore closed
the card and published the parent row before the child's wait was freed, so one publish showed the
subagent waiting beside no pending card (fg-interrupt replay). The child's wait now also requires the
request to still be open in the registry, and a withdrawal republishes child work before the
journal takes the close.

* refactor(claude): trim subagent request waiting to the common pattern and its essential tests

The chat history no longer marks a subagent block as waiting: the approval card itself carries the
request, and the asking subagent's row in the sidebar and composer strip reads waiting, as before.
NativeChatWaitingSubagentsProvider, native-chat-waiting-subagents.ts and their renderer changes go.

A subagent waits while its request is still open and unanswered in the prompt registry and its card
has landed in the journal. The registry check also covers a withdrawal under backpressure, so the
card list no longer filters pending cancellations itself.

Tests: one integration file replays the captured CLI frames through the real adapter, sink, journal
and status feed (renamed claude-subagent-permission-request.test.ts), with the asking subagent's
state timeline, attribution, nested linkage and a card write that waits for the journal. The
producer-harness waiting test, the redundant prompt-card cases, the harness reducer swap and three
unused captures (deny, interrupt, main agent, failed subagent) are removed.

* test(claude): pin the parent row's dating when a subagent asked first, and narrow the oracle's claim

* Turn desktop notifications on or off per machine (#24518)

* feat(notifications): turn desktop notifications on or off per machine

Settings > Notifications lists each machine (this computer, SSH targets,
paired Orca servers) with a switch. Muted machines are stored as an
opt-out list so a newly added machine still notifies. Both notification
senders now name the machine a workspace runs on, and main skips the
desktop banner for a muted one; phone push is unchanged.

* fix(notifications): preserve phone alerts and honor machine mutes

* fix(notifications): bind machine mutes to configured sources

* fix(notifications): preserve chat completion subscriptions on owner collisions

* fix(notifications): reduce machine settings clutter with a collapsed section

* fix(notifications): align machine disclosure with settings rows

* fix(notifications): clarify machine switches affect only this computer

* fix: distinguish unavailable account metadata from absence

* fix(accounts): resolve registered profile UUIDs consistently

* Replace agentArgsOverride with unified removeAgentArgs approach (#25091)

Consolidate override detection and removal into removeAgentArgs. Previously
catalogs used agentArgsOverride to detect conflicts and removeAgentArgs to
strip them; now removeAgentArgs handles both by returning stripped tokens.
This eliminates redundancy and makes the intent clearer.

Enhance removeAgentArgOption with optional value filtering to support
selective removal for complex cases like Codex config overrides.

* Reuse the ancestor path while building mobile agent rows (#24539)

Preserve traversal order and cycle guards using one call-local path Set rather than a copy at every depth.

* Release waiting terminal output when a mobile subscription fails to start (#24547)

Dispose the failed subscription record’s existing terminal backlog before rethrowing its original start error.

* Avoid cloning terminal agent owners twice in relay listings (#24713)

Capture the existing host-age expression at its original time, then use one call-local fresh owner clone for the length check and unchanged published owner field.

* Reuse prepared statements for internal worker checks (#24573)

* Reuse prepared statements across remaining Dispatch reads

Use the existing schema-pinned complete Dispatch column list in five remaining read modules, enabling the existing bounded statement cache without caching results.

* Reuse prepared statements for internal worker checks

Use the existing complete Dispatch projection only for named-field internal consumers; preserve original wildcard reads for every returned failure snapshot.

* Prepare the Activity search query once per filtered list (#24701)

Lazily reuse a call-local search predicate inside the existing filter, using unchanged byte gates and thread text cache.

* Avoid rescanning shared chunks in the plain Node build guard (#24717)

Reuse a successful unchanged chunk-code verdict within one synchronous writeBundle invocation, while preserving traversal and current-code reads.

* Select the latest stable release tag in one pass (#24786)

Replace filter/sort/last selection with one traversal using the unchanged stable-tag regex and numeric comparator; update on equality to preserve the original last spelling. Both actual callers own private plain arrays from Git stdout.

* Avoid Resource Manager renders when terminal removal leaves its inventory unchanged (#24806)

Reuse the private React state object only when the existing single/bulk removal helper returns its identical inventory; keep every lifecycle revision, tombstone, known-ID write and helper invocation in its original order.

* Cancel pending cursor updates when a terminal closes (#24566)

Reuse the existing pane frame tracker to cancel owned deferred focus-class updates during existing cleanup, with disposed guards against late or reentrant delivery.

* Cancel terminal preview fit frames when the preview closes (#24712)

Reuse the existing frame tracker inside the box-fit owner, suppress scheduling after disposal and cancel pending frames at the start of the existing effect cleanup.

* Skip new mobile toast work after feedback owner cleanup (#24759)

Reuse the existing mobile mounted-ref lifecycle pattern at toast presentation entry, preserving admitted clipboard outcomes and every live animation/sequence/timer operation.

* Release terminal side effects after they have been delivered (#24548)

Clear consumed queue slots after successful apply or overflow carry; preserve backing identity across reentrant callbacks and report actual retained slots.

* Release relay handshake timers when a host connection leaves (#24554)

Reuse the existing first-frame finish pattern to remove stage-owned timer/message/close callbacks on receipt, timeout or close; check OPEN after successful async assignment verification.

* Avoid restarting error timers on closed mobile relay links (#24567)

Check the existing irreversible closed flag before scheduling the existing missing-close fallback timer.

* Avoid restarting error timers after mobile relay pairing closes (#24568)

Check the existing pairing owner closed flag before allocating its missing-close fallback alarm.

* Delete unreturned clipboard cache files after a failed write (#24599)

Reuse existing provider-copy best-effort deletion for a newly created clipboard cache file whose write fails before its URI reaches the caller.

* Skip new legacy file inventories after mobile search cleanup (#24792)

Reuse the existing mobile mounted-ref pattern only at legacy fallback entry after completed passive cleanup; preserve admitted work and all live search/authority/cache paths. Correct only the strict fully-unmounted inventory scenario and its sole golden.

* Discard completed AI Vault cancellation IDs in the relay worker (#24820)

Use the relay child's existing pending Set to ignore cancellation IDs after completion, matching its desktop sibling; preserve admitted active/queued cancellation and the bundled private sender's complete replies, errors and ownership.

* Release completed updater setup timers and callbacks (#24920)

Cancel completed deferred updater fallbacks in finally, clear only their exact pending callback, and drop the captured timer before the original fallback guard runs; preserve destroyed admission, successor ownership and updater/quit callbacks.

* Check daemon idle state without building discarded terminal inventories (#24749)

* Check daemon idle state without building discarded terminal inventories

Replace the private idle predicate full public inventory with a host-local full pass that still reads every Session liveness getter in original order.

* Remove overwritten daemon test mock assignment

* Preserve the registered account ID when selecting UUID variants

* fix(updater): keep macOS Orca open when background instances block updates (#24952)

* fix(updater): guard macOS installs against running app instances

* fix(updater): match native app blockers and preserve quit lifecycle

* fix(updater): keep ordinary macOS quit on Squirrel's install-on-exit path

Converting every quit with a staged update into quitAndInstall made Cmd+Q
relaunch Orca, refused the quit when background instances existed, and
hijacked app.relaunch()+app.quit() restart flows (profile switch, admin
restart) into an update install racing the relaunched old app. Only
Update & Restart runs the running-instance preflight now; the
quit-without-install allowance is no longer reachable and is removed.

* fix(updater): preserve quit intent through macOS staging

* test(native-chat): explicitly model legacy published tab ownership

---------

Co-authored-by: OrcaWin <293788423+OrcaWin@users.noreply.github.com>
Co-authored-by: m4air <m4air@m4airs-Air.localdomain>

---------

Co-authored-by: Brennan Benson <79079362+brennanb2025@users.noreply.github.com>
Co-authored-by: Jinjing <6427696+AmethystLiang@users.noreply.github.com>
Co-authored-by: OrcaWin <alpha-eng@stably.ai>
Co-authored-by: OrcaWin <293788423+OrcaWin@users.noreply.github.com>
Co-authored-by: m4air <m4air@m4airs-Air.localdomain>
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