Repository navigation
fix(store): key rejections on the value so a forgotten fact stays rejected (#35) - #194
Conversation
…ected (#35) The blocklist keys on `ts` and prune deletes the row outright, so neither survives re-ingestion: replay the source (a transcript through auto-capture, an export through memory_import) and the rejected fact is stored again with a fresh `ts`, as if it had never been turned down. Something has to be keyed on the VALUE. Adds rejected.logfmt at the memory root, consulted by GATE-3 and enforced first in the GATE-4 chain -- a human decision outranks every heuristic below it. Two matching modes: exact sha1(content)[0:12], the same `ch` the gates already emit near a bottom-k sketch of the content's hashed token set, which supports rewording detection WITHOUT storing the prose The floor is calibrated, not guessed: rewordings of the same claim measured 0.500-0.615, same-topic/different-claim 0.059-0.235, unrelated 0.000, so 0.40 sits mid-gap. Short content can never near-match (a NEAR_MIN_SHARED token floor), because small token sets score high against almost anything and a false positive silently eats a legitimate write. Hashes only, never values (atlas step-10 inversion: a deletion log that reproduces what it deleted is a compliance problem). Not snapshotted, so undo can neither resurrect nor erase a rejection. Lifting is human-only by construction: the viewer lists rejections and exposes /api/unreject, and there is deliberately no plugin tool for it -- a session whose write was refused cannot clear its own refusal and re-submit. The block/unblock pair now tombstones and withdraws accordingly. Tokenizing moved to src/tokenize.ts so GATE-3 and the sketch cannot drift apart on what a "token" is; behavior there is byte-identical. Acceptance: the committed spec in negative-eval.test.ts that said "un-skip this test -- it must turn green without being edited" is un-skipped and passes, and the scenarios-scripted import case flipped to "row absent, tally blocked" as its own comment predicted. Suite: 738 pass / 11 skip / 0 fail. tsc clean; biome lint exit 0.
Found by mutating the mechanism and watching what survived, per #68's rule that a test nothing dies on is fiction. Three mutants run against the suite: 1. findRejection always undefined ....... 12 tests die (both acceptance specs) 2. forget stops recording the value ..... 5 tests die (both acceptance specs) 3. NEAR_FLOOR 0.4 -> 0.05 ............... 0 tests die <-- the gap Mutant 3 survived because the only over-blocking test used genuinely unrelated prose, which scores 0.0 against the rejected value: it stays green at any floor, so "we do not over-block" was claimed and unpinned. The guard that was actually doing the work is NEAR_MIN_SHARED, not the floor. Adds "a different claim in the same topic is NOT refused" over the calibrated 0.059-0.235 pairs -- same vocabulary, same subject, different claim. With the guard band collapsed (floor 0.05 + min-shared 2) it dies as it must; at the shipped settings it passes. Refusals are collected and asserted as an empty list so a failure names the vetoed claim and the hint that vetoed it. Also fixes the un-reject tool scan: invoking every registered tool included memory_init, which spawns the external indexer and timed out the test under the parallel workers. The scan now excludes it explicitly and asserts the tool-name shape separately.
Investigating the Windows CI failure (run 41112466339) landed a real bug in the
feature, plus a hot-path cost that should not have shipped.
ATTRIBUTION. test-windows failed twice on this branch and nowhere else: main was
green repeatedly today, and the sibling scenario that also failed ("the viewer
deleting and editing while another session writes") failed identically on
fix/gate-evidence, which carries none of my changes -- that one is the known
Windows load family. The prune scenario, however, failed 2/2 here and not once on
main, and it exercises the function I changed: "a prune sweep while another
session is appending", 4704 of 5700 untargeted rows vanished.
Mechanism, per src/lock.ts: the store lock gives up after 5s and PROCEEDS
unlocked ("strictly no worse than the alternative" -- unless another writer is
mid read-modify-write, which is exactly the case here). prune() was making that
window far more expensive to wait behind.
THE BUG THIS FOUND. tombstone() did a full read of rejected.logfmt plus a lock
create/unlink pair PER VALUE. memory_forget deletes by scope+type and routinely
removes hundreds of rows, so one forget issued hundreds of lock cycles while
other sessions were writing. Batching to one read / one lock / one append cut a
320-row forget from 154ms to 26ms locally, and removes ~99% of the file ops from
the scenario's critical path.
Batching then exposed a second bug, which is the one that actually mattered:
formatLine returns NO terminator, so joining the batch with "" published every
record as a single line, of which only the first parsed. A bulk forget of 40
values therefore recorded ONE rejection and silently dropped 39 -- the core
promise of #35, broken in its most common shape. Nothing caught it because no
test in the suite had ever forgotten more than one value at a time. Pinned by
"a bulk forget records EVERY value, not just the first" (40 rows -> 40 tombstones
-> 40 gate refusals -> 40 lines on disk); re-introducing the join kills it.
Also caches the tombstone read. findRejection runs on EVERY gated write, so the
mechanism this branch adds also added a full read of every rejection ever
recorded to every write. Cached on fileIdentity rather than a TTL, because a
human lifting a rejection in the viewer process must be seen by the next write in
this one -- a TTL would keep refusing a value for its duration after they said
otherwise. Reset hook added to the #149 isolation preload, since it is a module
global outliving a test file.
Local: bun run gate all green -- 751 pass / 0 fail unit, 11/0 e2e, tsc clean.
Windows verdict on this commit is the experiment that decides attribution.
Windows: what actually happenedInvestigated rather than re-run until green. Two distinct problems were tangled together, and only one was mine — but that one was real and it was not a timing flake. Not mine. Mine.
Mechanism, straight out of Batched to one read / one lock / one append: 154 ms → 26 ms on a 320-row forget, and the prune scenario has failed 0/3 since. The bug the flake was hidingBatching surfaced a genuine correctness bug that had nothing to do with Windows: Pinned by Also addressed: Where that leaves the reviewThe remaining Windows red is ambient and I have deliberately not bumped any test timeout to force green — that would paper over the family rather than fix it, and #190 plus
|
WhollyMindless
left a comment
There was a problem hiding this comment.
Review of 58ffced56fcc0de348889cfc316db09267bfc72c: two P2 findings to resolve before merge. The batch-forget regression test passes, and I see the latest CI is green. These are separate from the Windows timing failures described above.
[P2] Redact forget reasons at the new tombstone write boundary — src/tombstones.ts:220.
prune() passes its raw reason into tombstoneMany, which persists opts.reason directly. The existing deletion audit scrubs recognized credentials, but the new rejected.logfmt file does not; src/gates.ts:674 then copies that reason into the model-facing refusal hint. With a synthetic token ("ghp_" + "a".repeat(36), confirmed recognized by redactSecrets), forgetting a harmless fact leaves the deletion audit redacted but writes the token verbatim to the rejection file and returns it on replay. Please scrub metadata at the shared tombstone write boundary and ensure hints cannot return unsanitized reasons, with regression coverage for both destinations.
[P2] Near-match treats changed values and opposite instructions as the rejected fact — src/tombstones.ts:276.
The same-topic calibration misses high-overlap corrections. After storing and forgetting each first statement, these grounded replacements are both blocked as previously_rejected:
the production service retains audit records for 30 days before cleanup→ the same statement with 90 days: score 0.8.the service must enable anonymous access for production control endpoints→ the same statement with disable: score 0.7777777777777778.
Both are different facts, and both promote on the base. They score above the intended rewordings, so increasing the scalar threshold alone cannot preserve the documented 0.500–0.615 rewordings while allowing these corrections. Please include numeric-value and polarity changes in calibration and distinguish them before an authoritative near-match refusal. This is about the stated different-claim contract, not an objection to adding near matching. The current escape hatch requires lifting the rejection of the old, wrong fact to accept its correction.
Validation: Windows x64, Bun 1.4.4. At the reviewed head, bun test test/tombstones.test.ts test/review-194.test.ts gives 17 existing tests passing / 3 added probes failing, reproduced twice. The same three behavioral controls pass against production base 525ed89 (only adapting the new tombstone imports/file absence for the base). This was focused validation, not another full gate run. No changes pushed to your branch and no duplicate issues opened.
Additional test file: test/review-194.test.ts
import { beforeEach, afterEach, test, expect } from "bun:test";
import { mkdtempSync, readFileSync, rmSync } from "node:fs";
import { tmpdir } from "node:os";
import { join } from "node:path";
import { runWriteGate } from "../src/gates.ts";
import { prune, loadAll } from "../src/memory.ts";
import { resetSessionScopes, setRepoScope } from "../src/repokey.ts";
import { resetState } from "../src/state.ts";
import { resetTombstoneCache, rejectedFile } from "../src/tombstones.ts";
import { redactSecrets } from "../src/secrets.ts";
let root: string;
beforeEach(() => {
root = mkdtempSync(join(tmpdir(), "osi-review194-"));
process.env.OPENCODE_MEMORY_DIR = join(root, "memory");
process.env.OPENCODE_COMMANDS_DIR = join(root, "commands");
resetState(); resetSessionScopes(); setRepoScope(null); resetTombstoneCache();
});
afterEach(() => {
resetState(); resetSessionScopes(); setRepoScope(null); resetTombstoneCache();
delete process.env.OPENCODE_MEMORY_DIR; delete process.env.OPENCODE_COMMANDS_DIR;
rmSync(root, { recursive: true, force: true, maxRetries: 5, retryDelay: 20 });
});
const promote = (content: string) => runWriteGate({ type: "learning", scope: "review", content }, {
liveRoot: root, evidenceCalls: [], hasGateCheck: true, hasEngagement: true,
});
test("forget reasons remain redacted in the new tombstone and replay hint", async () => {
const token = "ghp_" + "a".repeat(36);
expect(redactSecrets(token)).toBe("[redacted]");
const content = "the production service records every completed deployment";
expect((await promote(content)).action).toBe("promoted");
await prune("review", "learning", `rotated ${token}`);
const deletion = readFileSync(join(root, "memory", "deletions.logfmt"), "utf8");
expect(deletion).not.toContain(token); // pre-existing boundary still scrubs it
const rejected = readFileSync(rejectedFile(), "utf8");
const replay = await promote(content);
console.log(JSON.stringify({ probe: "reason", tombstoneLeaks: rejected.includes(token), hintLeaks: replay.hint?.includes(token), replayAction: replay.action }));
expect(rejected).not.toContain(token);
expect(replay.hint).not.toContain(token);
});
test.each([
["numeric value", "the production service retains audit records for 30 days before cleanup", "the production service retains audit records for 90 days before cleanup"],
["opposite action", "the service must enable anonymous access for production control endpoints", "the service must disable anonymous access for production control endpoints"],
])("a different fact survives rejection of the old fact: %s", async (kind, rejected, corrected) => {
expect((await promote(rejected)).action).toBe("promoted");
await prune("review", "learning", "wrong policy");
const next = await promote(corrected);
console.log(JSON.stringify({ probe: kind, action: next.action, reason: next.reason, hint: next.hint }));
expect(next.action).toBe("promoted");
expect((await loadAll()).map((m) => m.content)).toContain(corrected);
});|
Residual filed as #196 (severity high): the underlying mechanism this PR tripped — |
dcf3387 to
03db0fd
Compare
Both P2s addressed —
|
| seam | why it is there |
|---|---|
tombstoneMany, before formatLine |
the boundary you named — one place, so no future caller has to remember. viewer/mutate.ts already scrubbed at its call site; it now scrubs twice, harmlessly |
tombstones(), on the way out |
the single read path behind both the refusal hint and the viewer's Rejections panel, and the only thing that covers rows already on disk from the pre-fix head |
gates.ts, where the hint is built |
the seam where the field becomes a model-facing sentence |
Pinned: a ghp_… token in a prune reason is absent from rejected.logfmt and from the replay hint (via a real forget, not a hand-written fixture), and a hand-written dirty row is clean by the time it leaves tombstones(). Mutants: remove the write-boundary scrub → the first spec dies; remove the read scrub → the second dies. Remove the hint-side scrub → nothing dies, because the two layers behind it are pinned. That third layer is deliberately redundant and its comment says so instead of pretending to be tested; the guarantee lives on the read path, where it also covers the viewer.
2. A changed value is not the rejected fact
The tombstone now records what the rejected statement asserted on the two dimensions overlap cannot see:
num— hashes of the numeric tokens (30,3.19,9ae0998),pol— the polarity signs, from a closed antonym table plus explicit negation.
differsIn vetoes the near-match when both sides assert a dimension and disagree. Still no prose in the file: num is a hash and pol is a label from a two-value vocabulary, which is also why recording it reveals nothing about the sentence.
Three judgement calls worth your eye:
- A dimension counts only when both sides assert it. If a value merely disappearing counted, deleting "30 days" from a rejected sentence would be enough to resubmit it. So
[](tracked, asserted nothing) never vetoes. - A row written before the fields existed (
undefined, distinct from[]) asserts nothing, so it decides exactly as shipped. Pinned explicitly so the degradation is a decision rather than an accident; every row from here on carries both. - Signs carry no word identity.
enable,allow,permitall reduce topos, so a synonym rewording is still caught (0.600 against the enable rejection, refused), whileenable↔disablecannot be. Cross-group synonymy was the reason for collapsing groups into signs:allowvsenableas separate groups would have created false vetoes.
Match selection falls through: the guard runs per candidate, so the strongest non-vetoed match wins even when a vetoed one scores higher. That case is real — "must not enable…" scores 0.889 against the rejection of ENABLE (a polarity flip, correctly not the rejected fact) and 0.700 against the rejection of DISABLE, which it does restate. The spec asserts which hash the hint names, not merely that it refused, so "strongest wins" dies.
Declined matches emit ev=rejection_vetoed … differs=numeric_value action=allow_different_fact, so "is the guard too eager?" becomes a query against the field instead of an argument.
Mutants (each applied alone, suite re-run, reverted)
| mutant | dies |
|---|---|
differsIn always undefined (guard removed) |
3 — both correction specs + the veto audit |
| veto whenever signatures differ, including where one side asserts nothing | 2 — the rewording guarantee (all four restatements leak) + the pre-tracking degradation |
| selection ignores the veto (strongest match wins) | 4 |
| negation stops composing | 2 |
| write-boundary scrub removed | 1 |
| read-path scrub removed | 1 |
| hint-side scrub removed | 0 — redundant by construction, see above |
What is still true after this, stated rather than buried
- The guard covers numbers and polarity, as scoped. A swapped non-numeric value stays caught by the sketch: "writes checkpoints to the prod bucket" → "staging" scores 0.778 with both signatures equal, so it is still refused and the human hatch is the answer. The table is closed-vocabulary on purpose; this is not an attempt to understand a claim.
- A sign that is merely absent leaves the sketch to decide. "more/less" and "on/off" are excluded for that reason — they live in ordinary prose, and a false veto releases a value a human rejected, which is the expensive direction.
memory_forgetremains a model-facing tool, so an aggressive prune still tombstones aggressively. Unchanged from the round-1 note.
Drive-by: dropped tombstone and type Rejection from gates.ts's import (biome noUnusedImports, pre-existing at your head, on a line I was already in).
bun run gate: 750 pass / 11 skip / 0 fail unit, 11 / 0 terminal e2e, tsc clean, biome exit 0 at the 409-warning baseline. No new files, locks, or I/O in the write path, so nothing here touches the #196 load family.
…iew) Addresses both P2 findings from review of 58ffced. 1. Scrub the reason at the tombstone boundary. `prune()` passed its raw `reason` straight into `tombstoneMany`, which persisted it verbatim, and gates.ts then copied it into the model-facing refusal hint — so a credential in a forget reason landed in `rejected.logfmt` and came back on replay, while the deletion audit beside it was correctly redacted. Now scrubbed on the way in (one boundary, so no future caller can forget), on the way out of `tombstones()` (the single read path feeding both the hint and the viewer, which also covers rows already on disk), and again where the hint is built, since that is the only place the string reaches a model. 2. A near-match no longer refuses a changed value. Overlap cannot separate a rewording from a correction because a correction scores HIGHER: against a rejected "retains audit records for 30 days", the same statement with 90 days scores 0.800 and "must disable" against "must enable" scores 0.778, while honest rewordings measure 0.500-0.615. So raising the floor was never the answer. The tombstone now records what the rejected statement ASSERTED on the two dimensions overlap cannot see — its numeric tokens (hashed) and its polarity signs (a two-value label, so nothing about the prose is recoverable) — and a disagreement on a dimension BOTH sides assert vetoes the near-match instead of refusing. A dimension counts only when both sides assert it: a value that went missing in a rewording is not evidence of a change, or dropping "30 days" from a rejected sentence would smuggle it back in. A row written before value tracking existed asserts nothing, so it decides as shipped. The guard runs per candidate, so the strongest non-vetoed match still wins when a vetoed one scores higher — the case that motivated this: "must not enable" scores 0.79 against a rejection of ENABLE (correctly not the same fact) and 0.70 against the rejection of DISABLE, which it does restate. A declined near-match is recorded as `rejection_vetoed` with the dimension that said "different fact", so whether the guard is too eager is a measured question rather than an assertion. Drive-by: dropped the unused `tombstone`/`Rejection` imports from gates.ts. Verification: the reviewer's three probes (reproduced verbatim, run locally) pass; the two must-not-regress specs — the rewording guarantee and the pre-tracking degradation — were green before this commit and stay green; `bun run gate`: 750 pass / 11 skip / 0 fail unit, 11/0 e2e, tsc clean, biome exit 0 at the 409-warning baseline.
03db0fd to
846ad03
Compare
WhollyMindless
left a comment
There was a problem hiding this comment.
Re-review at 846ad036bb447d4de120519739844c02ac765b2e (current head): the original credential-reason leak and both original correction probes are resolved. I independently ran the three original probes plus the expanded committed tombstone suite: 30 pass / 0 fail, Windows x64, Bun 1.4.4. The read-path scrub also covers the legacy dirty-row case as intended. All four hosted checks are green.
Two P2 regressions remain in the new veto logic. Both violate its stated restatement guarantee: my additional tests pass at the previous head 58ffced (blocked) and fail at this head (promoted and stored).
[P2] Additional numeric metadata is treated as a changed existing value — src/tombstones.ts:220.
Forget the production service retains audit records for 30 days before cleanup, then submit that exact statement with (policy revision 2) appended. The retention claim still says 30 days, the sketch score is 0.75 with 9 shared tokens, but the new write is promoted. differsIn sees {30} versus {30,2} as disagreement even though the rejected numeric value remains intact. The same numeric token set with extra metadata is not evidence that the rejected value was corrected. Please distinguish a changed assertion from added/removed numeric metadata before granting the veto, and pin this counterexample alongside 30→90.
[P2] never contributes a standalone sign as well as negating the following verb — src/tokenize.ts:176–180.
Forget the service must enable anonymous access for production control endpoints, then submit the service must never disable anonymous access for production control endpoints. This restatement scores 0.70 with 7 shared tokens but is promoted. polaritySigns("not disable") returns ["pos"], while polaritySigns("never disable") returns ["neg","pos"]: never adds neg immediately, then negates disable to add pos. The unequal-set veto releases the restatement. Please compose a negator with its predicate without also retaining the standalone negator sign for that construction; pin the end-to-end refusal as well as the signature.
These are regressions introduced by the new guard. The explicitly documented non-numeric prod/staging limitation is a separate scope decision. No changes pushed to your branch. Keeping the review at changes requested for these two cases; the original findings should not be counted as still open.
Additional reproducer: test/review-194-veto.test.ts
import { beforeEach, afterEach, test, expect } from "bun:test";
import { mkdtempSync, readFileSync, rmSync } from "node:fs";
import { tmpdir } from "node:os";
import { join } from "node:path";
import { runWriteGate } from "../src/gates.ts";
import { prune, loadAll } from "../src/memory.ts";
import { resetSessionScopes, setRepoScope } from "../src/repokey.ts";
import { resetState } from "../src/state.ts";
import { resetTombstoneCache, rejectedFile } from "../src/tombstones.ts";
import { redactSecrets } from "../src/secrets.ts";
let root: string;
beforeEach(() => {
root = mkdtempSync(join(tmpdir(), "osi-review194-"));
process.env.OPENCODE_MEMORY_DIR = join(root, "memory");
process.env.OPENCODE_COMMANDS_DIR = join(root, "commands");
resetState(); resetSessionScopes(); setRepoScope(null); resetTombstoneCache();
});
afterEach(() => {
resetState(); resetSessionScopes(); setRepoScope(null); resetTombstoneCache();
delete process.env.OPENCODE_MEMORY_DIR; delete process.env.OPENCODE_COMMANDS_DIR;
rmSync(root, { recursive: true, force: true, maxRetries: 5, retryDelay: 20 });
});
const promote = (content: string) => runWriteGate({ type: "learning", scope: "review", content }, {
liveRoot: root, evidenceCalls: [], hasGateCheck: true, hasEngagement: true,
});
test.each([
["additional numeric metadata", "the production service retains audit records for 30 days before cleanup", "the production service retains audit records for 30 days before cleanup (policy revision 2)"],
["equivalent never-negation", "the service must enable anonymous access for production control endpoints", "the service must never disable anonymous access for production control endpoints"],
])("a restatement must stay rejected: %s", async (kind, rejected, repeated) => {
expect((await promote(rejected)).action).toBe("promoted");
await prune("review", "learning", "wrong policy");
const replay = await promote(repeated);
console.log(JSON.stringify({ kind, action: replay.action, reason: replay.reason }));
expect(replay.reason).toBe("previously_rejected");
expect((await loadAll()).map(row => row.content)).not.toContain(repeated);
});…d 3)
Both findings are regressions in the veto added in the previous commit, and both
came from the same shortcut: treating "the signatures differ" as "the assertion
changed".
1. Added numeric metadata. "{30}" vs "{30, 2}" — the rejected claim still says
30 days, with a revision number appended — vetoed the near-match and stored
the restatement. A dimension has moved only when EACH side asserts something
the other does not, so extension (a note, a revision, a count appended to the
sentence) is refused, omission stays refused (that is the path where dropping
"30 days" would release the claim), and 30→90 stays released — as does
"30 days with 5 copies" → "90 days with 5 copies", which is the pair that
rules out a "no numbers in common" rule satisfying the same cases by accident.
2. `never` counted twice. It is both a term in the antonym table and a word that
negates what follows, so "must never disable" contributed `neg` for itself and
`pos` for the flipped verb — both signs, no match, restatement stored. A
dual-role negator now holds its own sign back and lets the flipped predicate be
its contribution; standalone, with nothing in its span ("the job never runs"),
its own ban is still all there is and still counts.
Pinned: both reproducers (run verbatim, 2/2 green), the signature-level pins for
the composition, and the shared-number correction pair.
Verification: `bun run gate` 752 pass / 11 skip / 0 fail unit, 11/0 e2e, tsc
clean, biome exit 0 at the 409-warning baseline. Mutants, each alone: round-2
set-inequality rule restored → the restatement spec dies; disjointness in place
of each-side-moves → the shared-number spec dies; a held negator never released
→ the standalone `never` pins die.
Both regressions fixed —
|
| rejected nums | incoming nums | reading | now |
|---|---|---|---|
{30} |
{90} |
each names a number the other does not → moved | veto, stored |
{30} |
{30, 2} |
the rejected 30 is still asserted; 2 is appended metadata |
refused |
{30, 90} |
{30} |
something was only dropped — the path where deleting "30 days" releases the claim | refused |
{30, 5} |
{90, 5} |
5 is shared metadata, 30 → 90 moved | veto, stored |
That last row is why I did not implement it as "no numbers in common": a disjointness rule passes the 30→90 case by accident and silently refuses a correction that keeps any number in place. It is pinned (a value change vetoes even when both statements share another number, 0.833 / shared 10), so the rule can't quietly slide back.
2. src/tokenize.ts — a dual-role negator no longer counts twice.
never is both a table term (it asserts a prohibition) and a word that negates what follows, so "never disable" contributed neg for itself and pos for the flipped verb: two signs, no match, restatement stored. A negator that is also a table term now holds its own sign back; if something in its span consumes the negation, that flipped predicate is its entire contribution. If nothing does, the word's own ban is all there is and still counts:
polaritySigns("must never disable anonymous access") = ["pos"] // restates "enable"
polaritySigns("must never enable anonymous access") = ["neg"] // still a reversal
polaritySigns("the job never runs") = ["neg"] // standalone
polaritySigns("we never allow it and never log it") = ["neg"]
Your reproducer ran verbatim: 2/2 pass, both previously_rejected, neither stored. Both cases are also committed — in the restatement list (so they are refused end-to-end and the hint must name the right rejection) and at the signature level.
Mutants at e5b74ae (each applied alone, suite re-run, reverted)
| mutant | dies |
|---|---|
| round-2 rule restored: veto on any signature difference | 1 — the restatement spec |
| disjointness instead of each-side-moves | 1 — the shared-number spec |
| a held negator is never released as its own sign | 1 — the composition spec |
guard removed (differsIn → undefined) |
5 |
| selection ignores the veto | 5 |
| negators disabled | 3 |
| write-boundary / read-path scrub removed | 1 each |
| hint-side scrub removed | 0 — the layer is redundant behind two pinned ones, as before |
Where the line now sits, stated plainly
A correction that names both the old and the new value — "retained for 90 days, up from 30" — is a superset of the rejected numbers, so it reads as extension and stays refused. That is not an oversight of the fix, it is the cost of the rule the finding asks for: from a token set, "the value was corrected to 90 and the 30 mentioned for context" and "the rejected claim plus a revision number" are the same shape. I took the side that refuses, because the escape hatch is a human click while a wrong veto silently discards a write; ev=rejection_vetoed still counts the ones that are released. The prod/staging limitation you scoped out is unchanged.
bun run gate: 752 pass / 11 skip / 0 fail unit, 11 / 0 e2e, tsc clean, biome exit 0 at the 409-warning baseline.
WhollyMindless
left a comment
There was a problem hiding this comment.
Approved at e5b74ae07e6b986cd668a34075f416095c6413b7. This supersedes my two earlier CHANGES_REQUESTED reviews: all four reported findings are resolved at this head.
Independently verified on Windows x64 / Bun 1.4.4:
- Re-ran both original reproducer files verbatim, alongside the committed tombstone suite:
bun test test/tombstones.test.ts test/review-194.test.ts test/review-194-veto.test.ts— 34 pass / 0 fail. - The credential reason is scrubbed on disk and in the replay hint; the committed dirty-row test covers the read path for existing files.
- The 30→90 and enable→disable corrections still promote.
- The unchanged 30-day rule plus revision metadata and the enable→never-disable restatement are now refused and remain absent from the store. Those same two tests failed at
846ad03during the prior review. - Inspected the delta: the bidirectional set-difference check rejects extension/omission as evidence of replacement, while the shared-number correction test keeps it from degenerating into a disjointness rule. The held-sign logic composes
neverwith its predicate and retains its standalone sign when unconsumed.
All four hosted checks are green on this exact head. My local validation was the focused re-review above, not a repeat of the full gate.
The documented heuristic limits remain: a correction mentioning both old and new values can still be refused, non-numeric substitutions can still require the human escape hatch, and tombstones predating value signatures retain the earlier matching behavior. Those are explicit scope decisions, not unresolved instances of my four findings. This approval does not claim general semantic equivalence detection.
No further changes requested from this review. Merge timing remains yours; #196 is separately covered by #197.
|
🎉 This PR is included in version 0.14.25 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Closes #35.
The gap
Nothing was keyed on a rejected value. The blocklist keys on
ts;memory_forget/prune deletes the row outright. So re-ingesting the original source — the same transcript through auto-capture, the same export throughmemory_import— stored the rejected fact again with a freshts, as if it had never been turned down. Step 6 of the Atlas deletion-durability sequence, and the most-repeated gap in the field.grep -rn "rejected.logfmt|previously_rejected" src/was zero hits before this branch.What ships
rejected.logfmtat the memory root, consulted at GATE-3 and enforced first in the GATE-4 block chain — a human decision outranks every heuristic below it. Both untrusted write paths (memory_import, auto-capture) already route throughrunWriteGate, so they inherit the check for free.Two matching modes:
sha1(content)[0:12]— the samechthe gates already emit ongate_start/write_promotedHashes only, never values (Atlas step-10 inversion: a deletion log that reproduces the deleted secret is a compliance problem). The sketch is one-way per token and carries no ordering, so the file cannot be read back as prose — strictly less revealing than
deletions.logfmt, which stores forgotten prose verbatim by design.Not snapshotted:
snapshotFiles()walksmemoryFiles(), which excludesRESERVEDnames — somemory_undocan neither resurrect nor erase a rejection.Near-match is calibrated, not guessed
You said include near-match, and the reason to be careful is false positives: a wrong near-match silently eats a legitimate write. So I measured instead of picking a number.
0.40 sits mid-gap with ~0.17 margin on both sides. It is also in family with the existing calibration — GATE-3 uses 0.9 for "reworded duplicate of a live row" and 0.3 for a decision/preference conflict, so this is the conflict-style band applied to a rejection. My first guess was 0.8; measurement showed a genuine rewording scores 0.47, i.e. the mechanism would never have fired. Worth saying out loud: the number came from the calibration, not from me.
NEAR_MIN_SHAREDstops short content near-matching at all — small token sets score high against almost anything, so short content is refused only on an exact match.Lifting is human-only
The viewer lists rejections and
POST /api/unrejectlifts one. There is deliberately no plugin tool for it: a session whose write was refused could otherwise clear its own refusal and re-submit the rejected value in the same turn, which would make the whole mechanism advisory. Same shape as the blocklist, which likewise has no unblock tool. The block hint carries the hash and says this explicitly.blocknow tombstones the value;unblockwithdraws it.Red-first, and what I found by mutating it
The committed spec in
negative-eval.test.tssaid "un-skip this test — it must turn green without being edited." Un-skipped, unedited, green.scenarios-scripted.test.tsflipped torow absent, tally blocked— the exact outcome its own comment predicted.Then I broke the mechanism three ways to check the suite actually bites:
findRejectionalwaysundefinedforgetstops recordingNEAR_FLOOR0.4 → 0.05Mutant 3 surviving is the interesting one. My only over-blocking test used genuinely unrelated prose, which scores 0.0 against anything — so it stays green at any floor. "We do not over-block" was claimed and unpinned, and the guard actually doing the work was
NEAR_MIN_SHARED, not the floor. Fixed in the second commit by pinning the calibrated 0.059–0.235 pairs ("same topic, different claim"); with the guard band collapsed it dies as it must, at shipped settings it passes.A test bug surfaced the same way: the exact-match hint originally shipped without the escape-hatch text, so the common case was a reported dead end.
Two things worth your eye
memory_forgetis a model-facing tool, so a model that prunes aggressively tombstones aggressively. Consequence is bounded (identical prose refused with an explicit hint, nothing destroyed) and it is what the ticket specified, but the honest mitigation is the viewer hatch rather than a design guarantee.src/tokenize.tsholds the tokenizer moved verbatim out ofgates.tsso the sketch and GATE-3 cannot drift on what a "token" is. Behavior there is byte-identical.Gate
bun run gate: 739 pass / 11 skip / 0 fail unit, 11 pass / 0 fail terminal e2e, tsc clean, biome lint exit 0.