Repository navigation
feat(hosts): every instance knows the fleet, and one join pairs it with every member - #466
Merged
Merged
Conversation
…amed by a key it holds
…say labelled as hearsay
…fleet it asks about
…ys which peer said so
…, and why the note was wrong
…which is what it is for
… hub and its leaf agree on the fleet The first version composed only the answers to the questions it asked, so a machine that is called and never calls learned nothing: on the documented hub the Studio showed two hosts, the laptop three, and the VM and Windows box zero. The driver now composes the reports it holds as well, and an answer's revision covers the hearsay, so a new caller is not invisible for as long as the caller keeps asking.
…fleet does not empty itself
…al wins and never comes back
…box it cannot open
…ot depend the pairing rows for
…pairing side is not wired
…r can talk us into is auditable
…rove a join reaches every pair
…eady run host code
…t a table it could not read
…ing instead of hiding it
…lve, and says what one machine cannot prove
…ical store and no granted desktop control
…minting records the row removal revokes, and a sync that learns a removal cuts the credential
… and allowed on purpose
…ill only promised
… is old, mints nothing for it, and joins each machine when it updates
The group needs a handful of hooks in upstream's tree. Each is now a single line behind a fork-owned helper, carries a local(hosts) marker, and has a line budget enforced by local/checks/host-mesh-upstream-seams.mjs. Deleted rather than moved: the mesh service is a configured singleton, so threading it through RpcContext touched four upstream files (core, the admission prologue, the mobile pairing subclass, the stream options) for a copy of a constant. The handler resolves it itself instead.
…above upstream code The fork's own ratchet measures fork comments in upstream-owned files: 162 of the 233 conflicts in the 2026-10-28 sync came from them. This feature had added eight, so all of them go, and the register moves to local/checks/host-mesh-upstream-seams.mjs plus LOCAL-PATCHES.md — forty-three lines across nine upstream files, budgeted.
…ces are declared with evidence
…nc probes, and declared helper rows
…ng size debt is named
…he store's row drops with the split
… helper, so orcad and the CLI keep working
…ile is a type guard rather than a cast
The lint gate was red on this PR for a step that passes locally: CI checks out the pull request's merge commit and fetches no branch ref, so the register's `origin/main` base did not exist and its `upstream/main` ownership ruler did not either. The first crashed the step inside `git merge-base`; the second would have made every touched file look fork-owned, which passes while checking nothing. The base is now the merge commit's first parent where there is one (the rule `check:code-quality:changed` already follows, reused from config/scripts/git/pr-diff-base), else `origin/HEAD`, `origin/main`, `main`. The ruler is `upstream/main` where the clone has it, else the upstream commit the sync baseline records — the fallback `check-upstream-file-comments` already makes. Neither resolving is exit 2 with the fetch that fixes it, not a stack trace whose last line is all the gate can quote. Qualified by local/checks/host-mesh-upstream-seams.test.mjs, which builds both shapes in a fixture repo: a merge commit with no branch ref, and a tree with no upstream remote.
nplez1
force-pushed
the
nplez1/host-graph-discovery
branch
from
November 25, 2026 20:10
577da51 to
008aa17
Compare
nplez1
added a commit
that referenced
this pull request
Nov 26, 2026
…er feature's PR (#484) #466 wired `check-host-mesh-upstream-seams` into the lint gate, where it runs on every pull request, and it failed on any upstream-owned file a diff touched. The first branch to run it after that merge was #471, a workspace state fix touching eight upstream renderer files and no host-group seam at all, so the gate went from green to red for a whole class of work. A register of one feature's surface cannot demand a declaration from features it does not describe. The budget of a declared seam still fails hard — that is the guarantee the file exists to keep — and an undeclared upstream file is reported as a note. `--strict` restores the red for the host group's own branches, where an undeclared hook is exactly the sprawl the check was built to catch. The same change fixes a latent crash the old exit-early path hid: the verbose listing read `seam.budget` for every touched file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this does
Every Orca instance now knows which machines you own, counts them honestly, and — with one action per
machine — becomes paired with all of them. Then the workspace list is identical on every host, because each
host reads every other member's projects and workspaces.
The user's requirement, verbatim: "The workspace list on EVERY host should look identical including
workspaces from all of the hosts in the group."
Why it needed two halves
Discovery. Pairing is directional — the caller holds the environment record — so a hub-and-spoke pairing
showed a different fleet on each machine: the hub counted one host, a leaf counted three, and a Windows host
counted none. Each host now reports the edges it owns, a client address, and what each peer reported, with
hearsay labelled as hearsay and aged out. The status bar counts the fleet it can actually see and names the
peer that said so.
The group. Discovery shows the fleet; it does not pair anything. A mesh group is what makes the
sidebar identical: joining one member pairs the newcomer with every existing member, so
nmachines neednactions instead of
n(n−1). Every member can then run work on every other (orca-np --environment <label>),and losing any one member leaves every other pair intact.
The decision that shapes it
pairing.createOfferispairing-admin, and that tier is owner-only — "paired clients and phones never holdpairing-admin". Minting on a peer's behalf would turn every pairing into a grant to widen that peer's access.
So no host mints an offer for another: each host mints its own with no grants, seals it to the one machine
allowed to redeem it (
nacl.boxstatic-static over a domain prefix), and the introducer is a courier for abox it can neither open nor alter.
Consent is off by default and is one action per machine: Allow this computer to be added to a group.
A paired desktop therefore cannot bootstrap this host into a group, mint offers on its behalf, or make it dial
out.
Upgrading an existing install
Nothing is rewritten. The group lives in its own
host-mesh.json, the pairing table is untouched, and a buildwithout the mesh ignores the file.
On the first launch of a build with the mesh, one migration runs and records that it did: it reads the pairing
table — the same edges discovery already reports — and groups this computer with every machine it is already
paired with. It mints and dials nothing, so every link starts awaiting its offer and an unrepaired fleet looks
unrepaired. A machine with no pairings records that it had nothing to group, which is why pairing a second
machine later does not silently create a group you never asked for; and because the file is written, leaving a
group is never undone by the next launch. The pane says where the group came from.
Two machines upgrading independently derive different group ids, because a leaf sees only the hub. So a host
takes on another's group when that group contains its own and every machine in it is either already paired here
or vouched for by a member that is. The id is derived from the members rather than random, so two machines that
saw the same fleet agree outright, and containment rather than overlap, so two fleets sharing one machine never
merge through it.
Two structural gaps surfaced here and are fixed: a host with no group at all was refused an introduction, so a
machine that had never joined could not be brought in by anyone — the opposite of one join pairing it with
everyone; and
syncanswered a member whose group id differed with an empty member list, which is preciselywhat kept an upgraded fleet split. Membership now decides that rather than the id, and a non-member learns
nothing.
Updating one machine at a time is handled explicitly, because that is the normal case — the machine
holding every pairing goes first. An old-build peer answers
method_not_found, which is recorded asNeeds update rather than an unreachable network, and no offer is minted for it: the repair would
otherwise hand out a live device row at a machine that cannot redeem it, on every sync. A successful sync
proves its link, which is what lets a migrated group start repairing itself, and migration carries each
peer's public key from the pairing record — without it nothing can be sealed to that member and the fleet
never completes. Three simulations cover the rollout: the hub updating first mints nothing and reports both
peers as needing an update; a leaf converges on the hub's group the moment it updates and learns the member
it had never met; and when the last machine updates, all three hold one group with every pair complete.
Proven by a three-host simulation of the upgrade itself: three machines that only ever knew the hub each migrate
to their own group, and after two syncs each they hold one group and know all three members.
Keeping the upstream sync cheap
The measured surface is 40 lines across 8 upstream-owned files; everything else is new files. The register
is
local/checks/host-mesh-upstream-seams.mjs, wired intolocal/gate-lint.mjs: it fails when anupstream-owned file is touched without being declared, or when a declared seam grows past its budget. Per-seam
resolution notes are in
local/design/host-mesh.md§ Upstream sync surface.status-bar/.../SshStatusSegment.tsxRelayedFleetStatusItems, one hook, two countscli/hosts/host-handler-groups.tsHOST_MESH_HANDLER_GROUPstartup/.../main-process-runtime-launch.tsinstallHostMeshRuntime(runtimeRpc)+ a lint directivesettings/.../RuntimeEnvironmentsPane.tsx<HostGroupSection />rpc-method-registry.ts,protocol-version.ts,cli/specs/index.tscli/dispatch/remote-selection-scope.tsThree decisions bought most of that:
so threading it through
RpcContextput this feature intocore.ts, the admission prologue, the mobilepairing subclass and the stream options — to copy a constant. The handler resolves it itself.
check-upstream-file-commentsratchet measured 162 of233 conflicts in a past sync coming from exactly that, so this patch adds zero fork comment lines to
upstream files; the register lives in the two fork-owned documents instead.
installHostMeshRuntime,FORK_RPC_METHODS,HOST_MESH_HANDLER_GROUP,notifyHostGraphOfConnectionChange,RelayedFleetStatusItems), so a conflict isresolved by keeping one line, not by re-reading an implementation.
The fork's ratchets also shaped the code: staleness now uses upstream's shared clock instead of a new interval,
the store has no direct sync-fs probes, the machine-identity ssh read is async, and the store is split at its
mailbox seam so it needs no
max-linesexemption. Two fork-owned files still carry one (declared inlocal/lint-known-red.jsonwith the split as named follow-up), plus upstream's launch script, which sitsexactly at its 300-line cap and cannot be split by a fork.
Verification
split, one upstream launch script at its line cap)
transport with the real reducer, admission rules and sealed boxes: a join reaches every pair; every host
renders the same fleet; a refused introduction shows as a gap rather than a false pairing and is repaired by
one sync; a removal cuts both directions and a tombstone refuses re-introduction; a host whose owner never
opted in refuses the join and mints nothing.
renderer via CDP, no focus stolen), and toggling writes
host-mesh.jsonbesideorca-e2ee-keypair.jsoninthe canonical user data directory.
Reviewed by Opus 5.5, high: R1 (3 blocking fixed), delta (1 new blocker fixed, not re-reviewed)
Known limits, also in
LOCAL-PATCHES.md: member lists arrive unauthenticated, which is the conceded costof auto-pairing — one member can name a machine it controls and every member will pair with it, bounded by the
opt-in, the attribution on every row, the 12-member cap, four introductions an hour and ejectability. Any
workspacecaller can drain another host's pending boxes (a denial of service: only the addressee can openone). The store has no lock, so two concurrent RPCs can lose an update.
Not verified on real machines: endpoint reachability across LAN and Tailscale (the likeliest cause of a
half-join) and removal while a member sleeps. Loopback is refused outside tests, so a real offer exchange needs
two real Electron main processes. Treat a group as proven on one network and unproven across two until a
Studio + laptop + VM run happens.