Repository navigation
Start a fresh terminal host after an update so chats keep running across restarts - #51160
Conversation
An app adopts any running daemon of its own protocol, so a v63 daemon from a bundle that predates providerRelayKeep kept every Claude and ACP chat on a direct launch. v64 guarantees keep and batched acks; the advertised relay capabilities now come from a pinned per-protocol table, and a launch that falls back for a missing capability traces it once per daemon start.
…d test it follows the bump Packaging says hello to the built daemon with the contract's version, so a stale contract fails every mac and AppImage packaging check.
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
Perf scan — FAILP1 · The v63 daemon stays connected and keeps polling after its last terminal or chat ends. The bump starts v64 at a new endpoint. Startup opens an authenticated control/stream pair to the surviving v63 daemon for its inventory. Terminal exit removes the session route and relay settlement releases the relay, but neither releases the legacy connection. The daemon cancels its initial adoption timer on authentication and its automatic idle exit waits for the final client disconnect or endpoint loss. The v64 endpoint leaves v63’s endpoint intact. An old daemon with zero work can therefore live until the app disconnects. Protocol bump · Legacy adoption · Exit routing · Relay removal · Idle lifecycle · Idle predicate
Work by trigger
Scan questions. Admission and payload construction, ownership and fanout, process/thread and storage placement, growth and retries, platform branches, and teardown were reviewed. The touched recurring classes are idle timers and obsolete owners (P1), startup work made reachable by a version change (one cold launch per transition), and repeated reads or process probes (spool probes now deduped by PID; host sampling is duplicated as described above). Missing-capability work exits before environment or RPC work. Scope covers desktop and local daemon use on managed hosts, including Windows/WSL terminal teardown; mobile and SSH clients add no local launch owner or timer here. Source comparison used |
|
Status: ready, Brennan merges (performance waiver). Problem: after an update, the app kept using a still-running terminal host from an older build of the same protocol. That host couldn't keep chat agents alive, so every Claude chat (and other agents that connect the same way) launched outside it and ended at the next quit. Change: the host protocol moves to 64, so an updated app starts a fresh host for new terminals and chats. The old host keeps its existing terminals until they end. A test-pinned table now ties each relay capability to a protocol version, and a launch that falls back records one trace per host start. Verified:
Deferred: two costs that every protocol bump already carries.
Perf waiver (Brennan): "/ref-oss up to you" (2026-11-27), delegated; the decision was to ship now, with retiring an emptied older host as the next PR and Windows staging as its own PR. #51160 (comment) |
|
QA (packaged Linux build of this PR): a Claude chat runs under the terminal host and survives the app quitting. Before quitting, the chat is asked to remember a word: After a quit and relaunch, the same chat answers from the earlier turn, with no restart. The agent process was the same one throughout (same pid, parented to the v64 host): |


ELI5
After an update, Orca keeps using the terminal host that the previous version started, so open terminals keep running. Some hosts from earlier builds of the same version could not keep a chat's agent alive across a restart. Orca picked one of those up, and every Claude chat and every chat with other agents that connect the same way then quietly started outside it and died on the next quit or crash. Now the updated app starts its own fresh host for new terminals and chats. The old host keeps the terminals it already runs until they end.
What Changed
PROTOCOL_VERSION63 → 64, and 63 joinsPREVIOUS_DAEMON_PROTOCOL_VERSIONS, so the v63 daemon is adopted as a previous generation (its terminals and kept relays stay reachable) and new sessions go to a fresh v64 daemon.PROVIDER_RELAY_PROTOCOL_VERSIONstays 63: a v63 daemon still serves the relay RPCs, and its kept relays must stay reattachable.local-build-compatibility-contract.json/.ts) moves to 64; a test now checks it againstPROTOCOL_VERSION, since packaging says hello to the built daemon with the contract's version.PROVIDER_RELAY_CAPABILITIES_BY_PROTOCOLpins the relay capabilities each protocol's daemon advertises (v63:providerRelay; v64: plusproviderRelayKeep,providerRelayAcks). The daemon's hello now derives its relay flags from this table, and a test pins its rows, so adding a capability means a new row with a protocol bump.launchRelayedProviderProcess: when a chat falls back to a direct launch because the daemon lacksproviderRelayorproviderRelayKeep, it records aprovider-relay.direct-fallbacktrace span (and a console warning) once per daemon start and capability, with the daemon'sappVersion.Other paths an older same-version daemon degrades silently
These v63 additions had no capability flag. On a v64 daemon they are all guaranteed; on an adopted v63 daemon they still degrade as listed:
relayAcks(gated byproviderRelayAcks): falls back to onerelayAckper relay. Costs only requests.daemonInstanceecho in spawn and list replies: placement falls back to the hellolaunchNonce, and the inventory accepts a listing without it.relaySpawn.policyandrelayDetach.policy(detached idle stop): ignored, so a detached agent runs until closed.relaySpawn.agent,relayAttach.kept, keep specrequests/replies/note: ignored.relayAck.cutKeyswithoutcut,savedThrough,held, and replyackedThrough/truncatedThrough: ignored or absent, so the app falls back to its older cut accounting.Why
Adopting a same-version daemon is how terminals survive updates, so any capability added without a protocol bump is invisible to the bundles that adopt an older daemon. Bumping is the existing versioned-hosts model. A per-protocol table makes the next capability addition force a bump instead of relying on memory.
Linked Issue
N/A
Visual Proof
N/A: no UI change.
Testing
daemon-protocol-bump.test.tspins the relay capability table and checks the build compatibility contract matchesPROTOCOL_VERSION.Packaged upgrade on Linux, from a build before the keep capability existed (protocol 63) to this PR's build, on the same user data:
I manually tested these changes locally
Automated tests added/updated, or explained why not below
Every added test fails without this change and avoids the test anti-patterns
Performance
None: one extra daemon starts after an update (the normal path for a protocol bump), and the trace runs at most once per daemon start and capability.
Risk
Level: Medium. After updating, users run two daemons until the old one's terminals end, as with every protocol bump. A revert or downgrade to a v63 build can't attach terminals or kept chats on a v64 daemon until that daemon exits, the same as every earlier bump.
Review
Agent skill upstream boundary
Notes
Windows doesn't relay chats (the route is macOS and Linux only), so it only sees the protocol bump. SSH and mobile are unaffected.
Checklist
N/Awith reason for visualspnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)