fix: pending_review store integrity (disk-backed queue + hygiene sweep) - #257
Merged
Merged
Conversation
…ygiene sweep
Bug 1: Confirm/Reject/List operated purely on in-memory state, so a running
serve process and a CLI process each served stale pending ids ("pending
review X not found"). The pending array is now disk-backed:
- List/Confirm/Reject re-read user_model.json under an advisory flock
(user_model.json.lock) before lookup/mutation
- applyDiff writes through immediately, keeping the on-disk array
authoritative; non-pending state (style/focus) is preserved per process
- read errors on List fail open to the last known snapshot
Bug 2: pending entries referencing consumed atom ids accumulated forever.
Load now runs a hygiene sweep: entries whose value text references atom ids
that are ALL missing from the atom store are dropped (only when an atom
checker is installed; transient read errors count as present — fail-open),
drops are logged with ids, and identical (field, value) duplicates
consolidate to the highest-confidence entry. ExtendedMemory.New wires the
checker to the live atom store.
Adversarial-review hardening: applyDiff write-through also runs under the
flock and syncs the queue from disk first (a serve inference cycle can no
longer resurrect a CLI-confirmed entry); mutate treats the full disk state
as authoritative (no stale style/focus clobber); the sweep probes only the
entry value and requires every referenced atom to be gone before dropping.
RED-first tests in pending_store_integrity_test.go cover cross-process
write-through, concurrent no-loss mutations, self-referential defect
entries, sweep drop/keep/dedup, and the list-vs-disk invariant.
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
odek | 31b3594 | Commit Preview URL Branch Preview URL |
Sep 19 2026, 03:22 PM |
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.
Fixes the extended-memory pending-review store desync between
odek serveand the CLI ("pending review X not found"), plus stale/duplicate entry hygiene.user_model.jsonunder an advisory flock;applyDiffwrites through under the lockRED-first tests: 13 new,
-racegreen, lint clean. Docs:docs/EXTENDED_MEMORY.md.