Repository navigation
A correction retires the row it corrects in the data (#390) - #400
Conversation
Addresses #390 (narrowed scope, see below). AC 2 live half recorded unmeasured — not closing. R3 (results-stale-x5/, 2150 -> 1900) showed the store keeping BOTH values: the correction won only because a language model happened to write "this supersedes the earlier 2150 bps figure" and retrieval happened to prefer it. GATE-3 rivalry cannot cover this class -- it competes only decision/preference rows, and corrections of remembered facts are context/learning. R3c narrowed the exposure honestly: with a 30-day gap the newer row wins 10/10 either write order, so this changes no outcome timestamp resolution had already settled. What it fixes is the same-instant tie (3/10) and any retrieval that would surface the stale row alone: the retirement is now an explicit superseded_by pointer written at gate time, and superseded rows fail isInjectable. AC 1's "superseded in the data, not only in the wording" is met by construction, and the test asserts the retired row cannot appear in a block without the correction. The retirement guard is threefold, because a retirement hides the row from every future session even though it destroys nothing: - anchor: both rows must name the SAME symbol token (SCREAMING_CASE or a dotted member). MAX_RETRIES 3 and TIMEOUT_MS 30000 in one scope share no anchor and coexist; - value: valuesAgree must be false, so "2150" restated as "2150, confirmed by finance" is one fact, not a conflict; - shape: with numbers stripped the rows must be the same sentence (jaccard >= the 0.3 CONFLICT floor GATE-3 already uses). "VAT_BPS was introduced in 2024" against "VAT_BPS ... is 2150 basis points" measures ~0.07 there and retires nothing -- the misfire class #393 accepted for a refusal is not accepted for a retirement. An inferred write never retires a user-guided row (the user is the stronger claim); a guided write may retire anything. Open planning rows and quarantined rows retire nothing. The plan is computed before the append and applied only after it lands, so a blocked or collapsed write cannot delete the old value with no successor behind it. Marking follows the drift/canonical contract: one batch publish, the caller's durable ledger updated before any audit line, and superseded_by evidence recorded only for rows THIS call retired (#208). AC 2's live half (hand-seeded both-rows store resolves 1900 in >=4/5 real sessions) needs a quiet seat and is recorded as unmeasured, same as #389 AC 3 and #393 AC 3/4: the bench seat is shared with the agent driving it (F19). The deterministic part AC 2 depends on -- only the newer row is injectable -- is pinned here. - src/gate/value-conflict.ts: symbol anchor + value + shape guard, per-call regex (the #393 lastIndex lesson) - src/gate/gate.ts: plan before append, apply after, numeric_conflict evidence - test/value-conflict.test.ts: 14 tests; 3 fail without the gate wiring Co-authored-by: OpenCode <[email protected]>
WhollyMindless
left a comment
There was a problem hiding this comment.
P2 — a different environment's value retires a still-valid fact (src/gate/value-conflict.ts, valueConflicts, head bcba2f4f589b216eec82183a3f9700540958e19a).
Independently wrote these two context rows through runWriteGate, both in site-config:
The MAX_RETRIES constant is 3 in production.The MAX_RETRIES constant is 5 in staging.
Both writes promote. The second marks the production row superseded_by=<staging ts>, reason=numeric_conflict; a subsequent production/MAX_RETRIES recall contains only 5 in staging and omits 3 in production. The rows describe different environments, so neither corrects the other. The shared symbol and sentence-overlap floor establish similar wording but cannot establish that the values refer to the same configuration context.
Could automatic retirement require an unambiguous correction/same-context signal, and preserve both rows when their environment or other qualifier differs? This matters more than a warning misclassification: a normal new fact hides a correct prior fact from later sessions. No data erasure is claimed; the superseded row remains recoverable.
Validation: 14 focused value-conflict tests and typecheck pass, plus a separate two-write/recall probe (6 assertions) reproduces the retirement. Windows/Bun 1.4.4, synthetic trusted gate context and throwaway store; no live model or user incidence claimed. Please feel free to defer automatic retirement rather than adopt the suggested direction.
Review finding on #400 (WhollyMindless), reproduced as stated: two `context` rows in one scope — "The MAX_RETRIES constant is 3 in production." then "...is 5 in staging." — both promote, and the second marked the production row superseded (reason=numeric_conflict), so a later MAX_RETRIES recall carried only the staging value. A normal new fact hid a correct prior fact. Guard 4, in the direction the review asked: automatic retirement now needs the environments to AGREE — both rows unscoped, or naming at least one environment in common. A mismatch, and one-sided scoping too ("is 3" may be the default; hiding it behind one environment's value is the same defect), retires nothing and both rows stay injectable. Closed vocabulary of deployment words; region/edition/tenant qualifiers are NOT detected, and every miss lands on the safe side — coexistence, the pre-#390 state, never a hidden fact. Found while testing the guard: tokens() keeps dots (they carry dotted members), so "staging." arrives as "staging." — the first implementation matched nothing and the reviewer's pair still retired. The qualifier check compares the bare word; the test pins the sentence-final period. Also fixed in the same extractor, same class as the #399 sign bug: the value window matched unsigned digits, so "-5" extracted as "5" and a sign flip read as agreement. The sign is now part of the value; "-5" corrects "5", "-5" restated is still one fact. - src/gate/value-conflict.ts: guard 4 + signed extraction - test/value-conflict.test.ts: the reviewer's pair both directions, one-sided scoping, same-environment still corrects (the cost), the two-write/recall probe, sign flip; the four fail on the pre-fix code Cost named: a genuine correction that ADDS an environment word ("actually in production it is 1900") no longer auto-retires the bare row — both inject, retrieval shows both, the model sees the scoping instead of a silent winner. Retirement is the destructive half; precision wins there. Co-authored-by: OpenCode <[email protected]>
|
@WhollyMindless confirmed and fixed in Guard 4 (environments). Retirement requires the environments to AGREE: both rows unscoped, or naming at least one environment in common. Your production/staging pair retires nothing in either direction; the two-write/recall probe is pinned as a test — both rows stay active and a MAX_RETRIES query carries both. One-sided scoping also coexists: "is 3" may be the default, and hiding a default behind one environment's value is the same defect as your pair. Two things your report indirectly bought:
Cost named: a genuine correction that ADDS an environment word ("actually in production it is 1900") no longer auto-retires the bare row — both inject, retrieval shows both. Retirement is the destructive half; precision wins there, per your own framing. Region/edition/tenant qualifiers are not detected; every miss lands on coexistence, never a hidden fact. Four new tests fail on the pre-fix code (verified by checkout). |
WhollyMindless
left a comment
There was a problem hiding this comment.
The original production/staging replay now keeps both rows on 64184c51a9f9f0fdcc7405589da49c6d7b439ffc. The same-context P2 remains for qualifiers outside the closed environment list, and the stated fail-open limitation is reversed in that case (src/gate/value-conflict.ts, sameEnvironment).
Independently wrote these two context/site-config rows through the gate:
The MAX_RETRIES constant is 3 for tenant Alpha.The MAX_RETRIES constant is 5 for tenant Beta.
Both promote, but Alpha is marked superseded_by=<Beta ts>, reason=numeric_conflict. Recall for MAX_RETRIES tenant Alpha retry constant returns only 5 for tenant Beta. Neither fact corrects the other. Both qualifier sets are empty, so sameEnvironment() returns true; an unrecognized tenant/region/edition distinction therefore causes retirement, rather than the coexistence promised in the new code comment and response.
Could retirement be limited to cases where same-context correction is established, leaving ambiguous qualified facts alongside one another? Expanding an environment dictionary alone cannot establish that arbitrary qualifiers refer to the same fact. Keeping the changes request for this remaining P2; the original environment-specific fix itself is verified.
19 focused value-conflict tests, two separate two-write/recall probes (12 assertions, original pair plus tenant counterexample), and typecheck pass on Windows/Bun 1.4.4. Synthetic trusted gate context and throwaway store only; no user incidence or physical data erasure claimed. Please feel free to defer the automatic-retirement rule if that is preferable.
Review round 2 on #400 (WhollyMindless), tenant counterexample reproduced: "MAX_RETRIES is 3 for tenant Alpha." then "...is 5 for tenant Beta." — both qualifier sets empty, guard 4 granted same-context, Alpha retired. The response to round 1 claimed every miss lands on coexistence; for any qualifier class outside the environment dictionary it landed on hiding. The claim was wrong; the guard is now the claim. Guards 3 (jaccard floor) and 4 (environment dictionary) merge into one residual rule: strip pure numbers and prose glue from both rows, and every word one row says that the other does not must be EDITORIAL — closed narration of the act of correcting ("corrected", "actually", "supersedes", "now") that names no dimension of the world. One unmatched content word — "production", "tenant", "alpha", "v2" — and nothing retires. Why this and not a bigger dictionary (the reviewer's own reasoning, adopted): qualifier vocabulary is open — tenants, regions, editions, customers, versions — so no list can establish same-context. What CAN be established mechanically is that the correction is the ONLY thing the two rows state differently. Unknown qualifier classes are then coexisting by construction, not by lookup. - src/gate/value-conflict.ts: residualWords + sameSentenceExceptValue replace SIM_FLOOR, ENV_WORDS, sameEnvironment; "v2" stays a word (not a pure number), copulas join the ignore list so "was 3" -> "is now 5" is still one correction, "should" stays out (desired-vs-actual is real) - test/value-conflict.test.ts: the tenant pair both directions, the editorial-narration correction still retires, v2/v3 coexist; the two new coexistence tests fail on the round-1 code Cost named, larger than round 1's: a genuine correction that RESTATES with new content words ("the queue retries, 5" correcting "MAX_RETRIES is 3") no longer retires — both rows inject and retrieval prefers the newer, the pre-#390 state for that narrower class. R3's measured harm (same-instant ties, stale-row-alone retrieval) stays structurally fixed for the word-for-word corrections capture actually produces. Co-authored-by: OpenCode <[email protected]>
|
@WhollyMindless tenant counterexample confirmed — and you were right on the point that mattered: my round-1 response promised every miss lands on coexistence, and for qualifier classes outside the dictionary it landed on hiding instead. Fixed in The environment dictionary and the jaccard floor are gone, merged into one residual rule: strip pure numbers and prose glue (copulas, the shared stopword set) from both rows; every word one row says that the other does not must be in a closed EDITORIAL set — words that narrate the act of correcting ( What survives retirement: the word-for-word correction (R3's shape) and corrections narrated with editorial words only ("Corrected: ... is now 4 in production." retires "... is 3 in production." — pinned both ways). Cost named, larger than round 1's: a genuine correction that RESTATES with new content words no longer retires — both rows inject, retrieval prefers the newer, the pre-#390 state for that narrower class. R3's measured harm stays structurally fixed for the corrections capture actually produces. The two new coexistence tests fail on the round-1 code (verified by checkout). |
WhollyMindless
left a comment
There was a problem hiding this comment.
Independently replayed 0d0afbef578f20dfca094bc37da660c3e84feb86: both the production/staging and tenant Alpha/Beta pairs now coexist and remain recallable. The stricter residual comparison fixes those reports.
A narrower same-context P2 remains for numeric qualifiers (src/gate/value-conflict.ts, residualWords discards every pure number, not only the compared value). Through the same two-write/recall path:
The MAX_RETRIES constant is 3 for tenant 101.The MAX_RETRIES constant is 5 for tenant 202.
Both promote, but the second retires tenant 101 with reason=numeric_conflict; recall for MAX_RETRIES tenant 101 retry constant returns only the tenant 202 value. The value matcher compares 3 against 5, while the residual matcher discards 101 and 202 too, so the distinguishing context is erased. This is a different tenant, not a correction.
Could numbers outside the value being corrected remain part of the context comparison, or could multi-number statements stay coexistent when the check cannot identify which numbers qualify the fact? The remaining issue does not require another qualifier dictionary: it is the loss of additional numeric context before sameness is decided. Keeping the changes request for this case; the earlier fixes themselves are verified. Deferring automatic retirement remains a reasonable option.
Validation: 22 focused value-conflict tests, three separate two-write/recall probes (18 assertions including the two passing earlier cases), and typecheck pass on Windows/Bun 1.4.4. Synthetic trusted gate context and throwaway store only; no live-user incidence or physical data erasure claimed.
Review round 3 on #400 (WhollyMindless), tenant-101/202 reproduced: residualWords discarded EVERY pure number, so "The MAX_RETRIES constant is 3 for tenant 101." and "...is 5 for tenant 202." looked like one sentence — the digits that proved they were different tenants were erased before sameness was decided. Alpha/Beta survived only because the qualifier words were letters. Numbers now stay in the residual. The two compared values are skipped at compare time, on BOTH sides (sameSentenceExceptValues): they are the change being sanctioned, and skipping the candidate's value against the target too keeps R3's correction shape working — "...is 1900 basis points, was 2150." still retires 2150, pinned. tokens() strips signs ("-5" arrives as "5"), so the skip set drops signs: a sign flip retires through the value guard, never through a residual mismatch. - src/gate/value-conflict.ts: residualWords keeps numbers; the pair rule takes both compared values and skips only those - test/value-conflict.test.ts: the tenant 101/202 pair both directions (fails on the round-2 code), the quoting correction still retires Cost named: a row whose only difference from the target is a DIFFERENT number that is not the compared value now coexists — correct by design (that number is context: a tenant, a version, a count); and a correction of two changed values at once ("VAT 1900, timeout 45") retires nothing, both rows injecting with retrieval preferring the newer. Co-authored-by: OpenCode <[email protected]>
|
@WhollyMindless round 3 confirmed — tenant 101 retired exactly as you described. Your diagnosis was the fix: the loss happened before sameness was decided, so the rule now keeps every digit in the residual and drops only the two compared values, skipped at compare time on both sides (
Cost named: a row differing from the target only by a non-compared number now coexists — that number is context (tenant, version, count), which is the point; and a correction of two changed values at once retires nothing, both rows injecting with retrieval preferring the newer. The tenant test fails on the round-2 code (verified by checkout). |
WhollyMindless
left a comment
There was a problem hiding this comment.
All three earlier pairs now coexist on d24744bfd57b6171b85d4682a5709683f3a152db: production/staging, Alpha/Beta, and numeric tenant 101/202, independently replayed.
One narrower P2 remains: value-based removal also removes a qualifier carrying the same literal (src/gate/value-conflict.ts, sameSentenceExceptValues). The skip set excludes every token equal to either compared value, rather than only the occurrences asserting that value.
Two gate writes in context/site-config:
The MAX_RETRIES constant is 3 for tenant 3.The MAX_RETRIES constant is 5 for tenant 5.
Both promote. Tenant 3 is then retired with reason=numeric_conflict, and its recall returns only tenant 5. The tenant identifiers disappear along with the compared values because both 3 and 5 are skipped globally. The prior 101/202 pair is a passing control; this remaining case requires the identifier/context number to coincide with a compared value, so the trigger is narrower than the previous report. Frequency in real stores is unknown.
Could removal identify the compared number's occurrence next to the symbol, retaining repeated occurrences in qualifiers, or preserve ambiguous statements instead? The current literal skip still cannot establish same context in this case. Keeping the changes request for the reproduced false retirement; please feel free to accept or defer this narrower residual if you judge it outside the intended automatic-retirement contract.
Windows/Bun 1.4.4: 24 focused tests, four separate two-write/recall probes (24 assertions; three fixed-case controls plus the remaining collision), and typecheck pass. Synthetic trusted gate context and throwaway stores only; no live-user incidence, general semantic guarantee, or physical erasure claimed.
Review round 4 on #400 (WhollyMindless), reproduced: "The MAX_RETRIES constant is 3 for tenant 3." then "...is 5 for tenant 5." — the skip set removed EVERY token equal to a compared value, so the tenant identifiers disappeared with the values and tenant 3 retired. Alpha/Beta and 101/202 survived only because their identifiers were letters or distinct digits. The corrected value is now excised POSITIONALLY: the span symbolValues actually reads (first number within WINDOW after the symbol, falling back to before) is cut from the content before tokenizing, and only that occurrence. "is 3 for tenant 3" keeps its "tenant 3". The citation case (a correction naming the number it replaces — "...is 1900 basis points, was 2150.") still retires: a unique number is excused when it equals the OTHER row's asserted value and its preceding raw token is not a content word. "was 2150" cites; "tenant 5" qualifies. Adjacency is read on the raw token stream — the IGNORE filter that serves the comparison would otherwise erase exactly the "was"/"tenant" distinction. Consequence, pinned: the swapped pair "is 3 for tenant 5" / "is 5 for tenant 3" coexists — each extra number follows a content word, so neither reads as a citation, and the rule refuses to retire on an ambiguous reading rather than guessing. - src/gate/value-conflict.ts: assertedValueSpan (mirrors symbolValues' search exactly), residualTokens with positional excision, sameSentenceExceptValue with the citation excuse - test/value-conflict.test.ts: the tenant 3/5 pair both directions and the swapped pair; both fail on the round-3 code Cost named: a citation whose preceding word is itself a content word ("(old value: 2150)") no longer retires — coexistence, the safe side. Co-authored-by: OpenCode <[email protected]>
|
@WhollyMindless round 4 confirmed — tenant 3 retired exactly as reported. Fixed in
Cost named: a citation preceded by a content word ("(old value: 2150)") no longer retires — coexistence, the safe side. Both new tests fail on the round-3 code (verified by checkout). |
WhollyMindless
left a comment
There was a problem hiding this comment.
Independently verified the reported false-retirement cases resolved on 8114cecf0478cdb9e952fe64f8784e067402de42. Replayed all four through two gate writes and recall: production/staging, Alpha/Beta, tenant 101/202, and tenant 3/value 3 versus tenant 5/value 5. Each now leaves both facts active and recallable; the last case no longer loses its qualifier when the asserted occurrence is removed.
The focused suite also preserves genuine correction retirement, including the old-value citation shape and the ambiguous swapped-qualifier coexistence control. Review of the positional excision and raw-token citation check found no further actionable defect in this revision.
26 focused value-conflict tests, four separate two-write/recall probes (24 assertions), and typecheck pass on Windows/Bun 1.4.4. This supersedes my earlier changes requests for the reproduced cases. Approval is for this pinned implementation and the tested boundaries, not a claim that arbitrary prose equivalence is decidable or that the pending live #390 benchmark has run. Synthetic gate contexts/stores only.
|
Thanks for five rounds of reproducible counterexamples — each one became a pinned test, and the final rule (positional excision + citation excuse with raw-token adjacency) is what your reports shaped. Recorded state: |
# [0.23.0](v0.22.2...v0.23.0) (2026-11-12) ### Bug Fixes * **capture:** redact attested args, and match a citation as a whole field ([15e764e](15e764e)), closes [#384](#384) [#132](#132) * **capture:** the prose extractor keeps the sign before granting code-checked ([838ac7e](838ac7e)), closes [#399](#399) * **gate:** different environments are two facts, never a correction ([64184c5](64184c5)), closes [#400](#400) [pre-#390](https://github.com/pre-/issues/390) [#399](#399) * **gate:** digits are context; only the corrected value may drop out ([d24744b](d24744b)), closes [#400](#400) * **gate:** excise the asserted value by position, not by literal ([8114cec](8114cec)), closes [#400](#400) * **gate:** same-context is established by the words, not looked up ([0d0afbe](0d0afbe)), closes [#400](#400) [pre-#390](https://github.com/pre-/issues/390) ### Features * **capture:** let a failed session leave a lesson, but only an attested one ([458b8ce](458b8ce)) * **gate:** a correction retires the row it corrects in the data ([bcba2f4](bcba2f4)), closes [#390](#390) [#393](#393) [#208](#208) [#389](#389) [#393](#393) [#393](#393) * **provenance:** an unverified row says so where the model reads it ([8bcb6ac](8bcb6ac)), closes [#386](#386)
|
🎉 This PR is included in version 0.23.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
|
Follow-up to my approval: its four regression cases still pass, but it missed another P2 false retirement. Reproduced on current main
The values agree; the stages differ. symbolValues reads the first nearby number as the asserted value, so it compares A possible follow-up is to require evidence that the number is the symbol's value before excising it, keeping both rows when that relationship is ambiguous. The old row remains recoverable on disk, but disappears from normal recall/injection. This is a deterministic storage observation, not a live-model result. My earlier approval was too broad; please weigh this follow-up in your prioritization. |
Part of #386. Addresses #390 (narrowed scope below; the live half of AC 2 is recorded unmeasured, so this does not close).
What changed and why the scope is narrow
R3 (
results-stale-x5/, 2150 → 1900) kept both values in the store: the correction won only because a language model happened to write "this supersedes the earlier 2150 bps figure" and retrieval happened to prefer it. GATE-3 rivalry cannot cover this class — it competes onlydecision/preferencerows, and corrections of remembered facts arecontext/learning.R3c narrowed the exposure honestly: with a 30-day gap the newer row wins 10/10 either write order. So this changes no outcome timestamp resolution had already settled. What it fixes is the same-instant tie (3/10) and any retrieval that would surface the stale row alone: the retirement is now an explicit
superseded_bypointer written at gate time, and superseded rows failisInjectable.The retirement guard is threefold
A retirement hides the row from every future session even though it destroys nothing, so the guard is stricter than #393's refusal guard:
MAX_RETRIES is 3vsTIMEOUT_MS is 30000in one scope coexistvaluesAgreemust be falseAn inferred write never retires a
user-guidedrow (the user is the stronger claim); a guided write may retire anything. Open planning rows and quarantined rows retire nothing. The plan is computed before the append and applied after it lands — a blocked or collapsed write cannot delete the old value with no successor behind it. Marking follows the drift/canonical contract: one batch publish, the caller's durable ledger updated before any audit line, evidence only for rows THIS call retired (#208).AC status, stated before review
superseded_by → new ts,reason=numeric_conflict, and a block for a VAT-rate prompt contains 1900 and not 2150; the retired row is still on disk, recoverableVerification
bun run gate: 1223 unit tests, 30 e2e against a real opencode host, typecheck and lint clean.test/value-conflict.test.ts: 14 tests, 3 of which fail without the gate wiring.