Repository navigation
fix(computers): keep a revoked relay home's mirror purged - #152
Merged
Merged
Conversation
Revoking one side of a reciprocal Share onward makes the newer catalog delete the relay entry (cascading its thread and bot mirrors) and re-insert it as a callback-only origin in the same transaction. A mirror subscription restarted from the still-current older catalog could then create its state row against the new origin row, leaving an empty mirror generation behind. Mirror state and bot mirror checkpoints are now created only for a direct peer or a relay home, with the peer row locked in the same statement. 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.
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.
WatchThreadMirrorstream before the new catalog reaches P2.both, so the next emit starts a new mirror task.bothrow, with its mirror, and inserts W asorigin.INSERT INTO computer_mirror_statelands after that. The neworiginrow 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.tscreates mirror state only for a direct peer or a relayhome/both. The check runs in the same statement, with the peer row locked. Otherwiseconsumeends as superseded.bot-mirror.tscheckpoints use the same role check.consumefor the revoked home is rejected and leaves no state. No assertion is changed; no sleeps, retries or longer timeouts.Evidence
thread-mirrors.test.tsandlinked-agents.test.ts, 32/32.Fixes: #36