Skip to content

feat(computers): relay explicitly shared linked computers - #36

Merged
nixuuu merged 1 commit into
feat/linked-computers-6from
feat/linked-computers-7
Nov 4, 2026
Merged

nixuuu merged 1 commit into
feat/linked-computers-6from
feat/linked-computers-7

Conversation

@nixuuu

@nixuuu nixuuu commented Nov 3, 2026

Copy link
Copy Markdown
Member

Stage 7 of linked computers (stack #22, based on stage 6; the whole stack merges into dev together).

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~node16 ids: 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".

@nixuuu
nixuuu added this pull request to stack #22 November 3, 2026 20:33
@nixuuu
nixuuu force-pushed the feat/linked-computers-7 branch from 79f02d0 to d057c8c Compare November 3, 2026 22:29
@nixuuu
nixuuu marked this pull request as ready for review November 4, 2026 05:58
@nixuuu
nixuuu merged commit c2499bb into dev Nov 4, 2026
3 checks passed
@nixuuu
nixuuu deleted the feat/linked-computers-7 branch 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant