Repository navigation
feat(hosts): servers publish a host descriptor - #27193
Conversation
A paired server now reports a stable installation id, created once per profile, plus an optional machine binding (HMAC keyed by that id over the machine id and profile path) in status.get and in runtime pairing offers. Optional fields only: older clients ignore them and older hosts omit them. Clients start using it in the follow-up.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Priority: ➖ Normal Merge Risk: ⚪ Minimal · up to No identified descriptor issue blocks merging after normal checks. Pre-merge checks |
|
ELI5
Each Orca server now has a name tag that stays the same for as long as its profile exists. It shows that tag when you pair with it and whenever a client asks for its status. Nothing reads the tag yet. The next PR uses it so that re-pairing the same server keeps its sessions.
What Changed
Before: a client could recognise a paired server only by its encryption key. That key can't tell "the same server, paired again", "a server whose profile was moved to a new machine" and "a copy of a server" apart.
After: for users nothing changes yet. On the wire,
status.getand runtime pairing offers carry a new optionalhostDescriptor:installationId: a random id the server creates once and stores in its profile (host-installation.json). The file is created under a cross-process file lock (the existingwithFileTransactionLock). The server reads it again after getting the lock and then writes it with an atomic rename, so two processes starting at the same moment, or repairing a corrupt file at the same moment, end up with one id. If the server can't read an existing file, it publishes no descriptor rather than making a new id, which would silently split its identity.machineBinding(optional): HMAC-SHA256 with the installation id as the key, over the machine id plus the profile path. The machine id is WindowsMachineGuid, Linux/etc/machine-idor macOSkern.hostuuid, read through the existingprofileStateAccessMachineIdentity. Because the installation id is the key, the binding can't serve as a machine identifier across apps. If no machine id is readable (common in containers), the binding is left out. It is only a hint that the profile moved or was copied, never an identity by itself.How it works: the RPC server loads the descriptor next to the pairing keypair, since it owns the profile. It adds the descriptor to runtime-scope offers and publishes it under its runtime id.
status.getreads it from there. Mobile-scope offers leave it out: the phone never pins it, and extra bytes make the QR code denser.Why
This is step one of the host-descriptor plan (host publishes; the client pins it in the follow-up). The design considered the encryption key alone and found it can't separate a re-pair from a moved profile or a copy.
Wire compatibility:
.catch(undefined)) instead of failing the whole offer, so a future format change can never block pairing.Two changes from the design, with reasons:
host-descriptor.v1capability. With no new method, the capability would only repeat what the field's presence already says.orca serve --reset-identitymoves to the follow-up (I2b-2). Its only use is deliberately cloning a server so that clone detection treats the copies as different, and clone detection lands with I2b-2. It also has to rotate the pairing keypair, which un-pairs every device. That should ship together with the client rules that explain it.Linked Issue
None. This is groundwork for #11574, which the client-side follow-up closes.
Visual Proof
N/A: wire and persistence change only, nothing visible.
Testing
host-descriptor.test.ts: the id is created once and reused. Concurrent creators, and concurrent repairs of a malformed file, all return the one stored id. A file that exists but can't be read publishes nothing and writes nothing. Moving the profile to another machine changes only the binding. A copied profile path gives a different binding. Different installations on one machine get different bindings. No machine id means no binding.runtime-rpc-pairing-offer.test.ts:status.getand a runtime offer carry the same descriptor. The mobile offer has none. The descriptor stays the same across a server restart on the same profile. It is withdrawn on stop.tests/e2e/cross-version-wire/cross-version-host-descriptor.unit.test.tsruns against the real v1.4.224 release. The old release parses an offer from the new host and drops the descriptor. The new build parses an offer from an old host. A descriptor in a shape this build can't read never blocks pairing.pnpm tc, oxlint andcheck:code-quality:changedpass. The runtime RPC suites pass. Tested on macOS; Linux and Windows are covered by CI.Review
Agent skill upstream boundary
Notes
orcadoffers re-encode the parsed offer, so they keep the descriptor.status.getto mobile gains one optional field that older apps ignore.Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)