orca/src
Brennan Benson c75c04eaae
fix(runtime): reclaim orca-runtime.json when it stops describing this runtime (#10840)
* fix(runtime): reclaim orca-runtime.json when it stops describing this runtime

On macOS the Chromium single-instance lock is silently defeated whenever
`SingletonSocket`/`SingletonCookie` go missing from the profile — and the
socket they point at lives under `$TMPDIR` (`/var/folders/.../T`), which
macOS purges after 3 days (`com.apple.bsd.dirhelper`,
CLEAN_FILES_OLDER_THAN_DAYS=3). A launch that slips past the lock runs a
full startup, republishes `orca-runtime.json` with its own pid, and leaves
the CLI on a dead pid once it exits: `orca status` reports
`stale_bootstrap` and every terminal command fails `runtime_unavailable`
while the original app keeps serving.

The owner now watches its own discovery record and republishes once no live
runtime is described. Reclaiming only a dead pid is deliberate: two live
runtimes sharing a profile would otherwise fight over the file.

Reproduced on macOS with two real Orca main processes on one profile: the
second instance took the lock and clobbered the record, and killing it left
`stale_bootstrap` against the still-healthy first instance. With this
change the owner reclaimed the record in ~2s and the CLI returned to
`ready`.

Refs #7848

* test(runtime): assert stop() clears the metadata ownership timer

The republish guard alone kept the shutdown test green, so the watch teardown was unasserted. Also drop the doc claim of startup/activation callers that do not exist.

* test(runtime): stand in a real live pid for the sibling-runtime case

Windows never assigns pid 1, so the hardcoded sibling read as dead there and
the watch would reclaim the record. Own a synthetic pid instead and let
process.pid play the live sibling.
2026-07-27 17:32:55 -07:00
..
cli perf(cli): construct the runtime client only when a command needs it (#10919) 2026-07-27 17:16:01 -07:00
main fix(runtime): reclaim orca-runtime.json when it stops describing this runtime (#10840) 2026-07-27 17:32:55 -07:00
preload fix(resource-manager): never destroy a session Orca cannot prove is idle (#8459) (#10893) 2026-07-27 11:52:55 -07:00
relay perf(git): overlap getBranchCompare's head-of-chain reads (#10895) 2026-07-27 17:17:03 -07:00
renderer perf(editor): cut per-keystroke work on two rich-markdown paths (#10862) 2026-07-27 17:18:31 -07:00
shared fix(terminal): stop answering mode-2031 toggles that the same chunk withdrew (#10817) 2026-07-27 17:17:47 -07:00
types