Repository navigation
Description
Why this exists
Two non-blocking nits from my review of #158 (merged as 7bef31a, head 0a6999e). Neither is a defect today — both are load-bearing assumptions with nothing written down at the place that depends on them. Filed from the review so they stop living only in that thread.
1. The fold's survivor lookup has no visibility guard
In memory_update's collapse-completion path, the survivor is resolved with:
(await loadAll()).find((m) => m.ts === survivorTs && !m.superseded_by)There is no isVisibleTo filter on that row. It is safe right now for one reason only: outcome.collapsedWith originates in GATE-3's poll, which already filters through the reader's visibility — a fact held two files away in gates.ts, with nothing at the lookup stating the dependency.
The fold's own predicate does check visibility (the author added that in round 3, and it was a good catch: folding a global row into a repo-private survivor narrows visibility, the reverse leaks). So the guard exists one step later than the row is first trusted.
Two ways to close it, either is fine:
- add
&& isVisibleTo(m, reader)to thefind, or - leave the code and state the invariant in a comment where the lookup happens, so the next reader doesn't move or reuse the lookup without it.
I'd take the guard. A comment protects against forgetting; the guard protects against refactoring.
2. The predicate compares repo but not repoPath
The requested-state vs survivor predicate compares the repo stamp and stops there. That holds only while a repo key implies its path. isVisibleTo itself accepts either match:
return m.repo === reader.scope.key || (!!m.repoPath && m.repoPath === reader.scope.path);so the store's own notion of "same owner" is broader than the fold's. If a row ever carries a repoPath that disagrees with its repo key — a moved workspace, a worktree, a relocated checkout — the fold can call two differently-owned rows the same owner.
Worth either comparing both fields, or a comment recording why repo alone is sufficient.
What is already covered
Do not re-litigate these; #158 handles them and they are pinned:
- metadata fidelity on a prose update (P2: memory_update drops import provenance, issue and omitted retrieval keywords #154) — the fold judges requested state vs survivor, not target vs survivor, which is more correct than what I originally proposed
- never reporting "Nothing was written" over durable rows, including tombstones a thrown gate already pushed (
gateDurable) (P2: memory_update claims nothing was written after post-append audit failure; retry leaves two active rows #155) auditCaveaton all five writers: remember, update, import, capture,runInitsameStrListorder-sensitivity, with the reasoning in a comment
Verification already done on 0a6999e
- CI 4/4 green; full local suite 644 pass / 12 skip / 0 fail
- cache-injection pins (
epoch,status,injection-framing,gated-injection,frontier): 97 pass / 0 fail test/outcome-truth-audit.test.ts: 6 of 8 red onmain, green on the PR head
Activity
WhollyMindless commentedon Oct 29, 2026
Investigated against
d1d83145b8f5119bba23147f718d32d4326a9818on Windows / Bun 1.4.4. I recommend the executable guards for both points: the path concern has a sequential reproduction, and the survivor-visibility assumption can break when a session binding changes during the gate.1. Equal repository keys do not preserve the same set of readers.
I used two temporary Git repositories with the same
origin, and seeded both rows through the realmemory_remembertool. No hand-edited store rows, fake repository hashes, or mocked gate outcomes:contextrows in the same scope, with different prose and otherwise matching metadata. Their stamps are(K, pathA)and(K, pathB).(K2, pathA); B remains(K, pathB).memory_recallfinds T through the path fallback. S is invisible to A.memory_updatewithquery: T.tsandcontent: S.content.K === Kand retires T. A's recall changes fromFound 1 (1 total)toNo memories found.The update reports
was retired in its favor. Nothing new was written.There is no concurrent operation in this reproduction. The row is recoverable, but A has lost access to an active replacement. The existingisVisibleTosemantics give a private row the reader set “matching key OR matching path”; equal keys alone do not make those sets equal. Merely having different checkout paths does not immediately hide a row while both readers still have K—the origin change makes the discrepancy observable.2. GATE-3 need not use the reader captured by
memory_update.memory_updatecaptures its reader before awaiting the update lock. The gate awaitsgate_start, then resolvesreaderForSession(ctx.sessionID). Capturing the session ID does not freeze that session's repository binding.For a deterministic interleaving, I wrapped the real
evidence.recordatgate_start, pushed asession.movedevent through the harness's actual plugin listener, waited for the binding to update, then called the original recorder. I did not mockrunWriteGateor manufacture a collapsed result.With ordinary A/B repositories having different origins, T in A and S in B, the move lets GATE-3 select S even though
isVisibleTo(S, entryReader)is false. A differing issue field prevents retirement, but the response still prints S's issue value:PRIVATE-SURVIVOR-175is a fixture marker. This demonstrates metadata crossing the call's captured-reader boundary; it is not a claim that an unauthorized actor can move sessions. A related same-key/path-fallback case also retires T into a survivor invisible to the entry reader. The race is deterministically scheduled in the test, not a claim of having observed this timing in a live host.Suggested narrow scope
isVisibleTo(m, reader)to the survivor lookup, before reading its metadata or composing diagnostics.repoPathfor private rows. Normalize absent/empty paths consistently withisVisibleTo; do not normalize path spelling differently from the read predicate. Global/legacy-global rows ignore path for visibility, so they should not require equal paths.I tested those two guards independently: the reader guard alone leaves the sequential path-loss case; the path guard alone leaves the invisible-metadata diagnostic. Together, a throwaway prototype passes all five focused probes (three regressions and two controls), plus all 24 tests across
update-supersede-truth,update-partial-failure,update-provenance, andoutcome-truth-audit.This checks the collapse branch, not immutable identity across every gate operation. Pinning a full reader through the gate could be a separate design decision. No fix branch was pushed; the temporary source edits were restored byte-for-byte. These results give concrete regression cases for a small #175 fix if that scope fits your intent.
abogartz-opencode-self-improvement commentedon Oct 29, 2026
🎉 This issue has been resolved in version 0.14.21 🎉
The release is available on:
Your semantic-release bot 📦🚀