Repository navigation
feat(computers): relay explicitly shared linked computers - #36
Merged
Merged
Conversation
nixuuu
force-pushed
the
feat/linked-computers-7
branch
from
November 3, 2026 22:29
79f02d0 to
d057c8c
Compare
nixuuu
marked this pull request as ready for review
November 4, 2026 05:58
nixuuu
added a commit
that referenced
this pull request
Nov 5, 2026
`computer-relay.test.ts` ("explicit reciprocal sharing … without a
routing loop") failed on CI in #146 and #147 (attempt 1), on line 258.
After the reciprocal share was turned off, W's mirror state existed
again as `{ cursor: "", overview: null }`.
**Cause:** a race on P2.
1. P1 revokes the grant and cancels the relayed `WatchThreadMirror`
stream before the new catalog reaches P2.
2. P2 still has W as `both`, so the next emit starts a new mirror task.
3. The new catalog then deletes W's `both` row, with its mirror, and
inserts W as `origin`.
4. The late `INSERT INTO computer_mirror_state` lands after that. The
new `origin` row satisfies the foreign key, so the empty state comes
back.
Before #36, a removed peer stayed removed and the late insert failed on
the foreign key.
**Fix**
- `mirror.ts` creates mirror state only for a direct peer or a relay
`home`/`both`. The check runs in the same statement, with the peer row
locked. Otherwise `consume` ends as superseded.
- `bot-mirror.ts` checkpoints use the same role check.
- The test adds a check that does not depend on timing: a late `consume`
for the revoked home is rejected and leaves no state. No assertion is
changed; no sleeps, retries or longer timeouts.
**Evidence**
- The new check fails on the old code (1/1) and passes with the fix:
15/15 runs under load.
- The other mirror suites pass: `thread-mirrors.test.ts` and
`linked-agents.test.ts`, 32/32.
Fixes: #36
This was referenced Nov 13, 2026
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.
Stage 7 of linked computers (stack #22, based on stage 6; the whole stack merges into
devtogether).Directional, off-by-default "Share onward": on P1, per partner, choose which of its other partners it shares. W then uses P2's things through P1, keeping the real home's
uuid~node16ids: threads (read/write/steer/approvals), mirrors, bots and the agent bus. P2 shows the source "W via P1" (read-only). Unticking revokes immediately: in-flight calls fail, W's mirrors and listings of P2 are purged; with P1 unreachable W gets a clear reason and nothing is queued. Shared configuration and secrets are never relayed. Direct W↔P2 after an introduction is documented as a later optimisation.Additive protocol with capability
relay, hop limit 1, loop prevention; migration 0053. Tests: three real gateways with separate databases (10 scenarios: default off, share onward end to end, P2 transparency, revocation and purge, P1 offline, hop/loop refusal, capability fallback, unlink, restart); check:tmp 747 pass / 0 fail. Docs: "Konkretny protokół etapu 7".