Skip to content

An unverified row says so where the model reads it (#393) - #399

Merged
abogartz merged 3 commits into
mainfrom
393-provenance-claims
Nov 12, 2026
Merged

abogartz merged 3 commits into
mainfrom
393-provenance-claims

Conversation

@abogartz

Copy link
Copy Markdown
Owner

Part of #386. Addresses #393.

The evidence

R4 (results-poison-x5/, n=5, seat evo/Qwen3.8-Flash-Next):

store correct produced an artifact
empty 0/5 2/5 — both with vat_bps null: the agent declines to invent a rate
one plausible wrong row 0/5 4/5 shipped a wrong artifact — 2475, 2100, 3100, 1750 — no uncertainty flagged in any run
correct row 5/5 5/5

A false row is not neutral. It converts "I cannot proceed" into "I shipped something wrong". The poison rows were real capture output with the values and targets swapped: same shape, same confidence, same specificity.

What ships, and why no more

A label the reader discounts by, plus a check that refuses only on a real contradiction.

Provenance is derived, and total. Measured on the live store: of 1014 rows, 109 carry auto-capture, 18 carry user-guided, 0 carry import, and 905 carry none of those — they came through the tool path, which is a provenance, not an absence of one. Criterion 1's "a row with no provenance is not injected" therefore cannot be a filter over tags: it would have dropped 89% of the store from injection. A test pins the totality so nobody simplifies it back into one.

Only an inference nothing outside its own transcript vouched for renders [unverified]; an inference whose number agreed with the tree renders [code-checked]. User-stated and tool-elicited rows render nothing — decorating 905 of 1014 rows with a warning would teach the model to ignore the warning. The marker is appended, not folded into [via …], whose exact text several tests pin.

The check refuses only on contradiction, and the measurement is why it goes no further. findConstant(base4, "fallbackVatBps") returns null: the fixture leaves the rate unset, which is exactly where a confident wrong row fits.

  • refusing when the tree contradicts refuses nothing in R4;
  • refusing when the tree is silent also refuses the transport fact (empty 0/5, seeded 5/5) — the one measured benefit memory has.

So undecidable keeps the row and labels it. Capture's structured ref/claim ride user-guided rows only, and guided rows are the ones this must not touch — a user correcting a stale tree is the case where the tree is wrong. An inferred row is therefore checked on what it says: a symbol it names plus a number within 48 characters.

AC status, stated before review

# criterion status
1 provenance recorded, survives injection, unprovenance'd rows not injected met, by derivation rather than exclusion — see the 905/1014 measurement above
2 inferred numeric claim checked before storage; failure refused and logged met for a numeric claim that names a resolvable symbol. Not met for the R4 poison, because the tree is silent — stated, not hidden. Path claims not implemented
3 R4 harm falls to ≤1/5 while transport stays 5/5 not measured. Needs the arms re-run at n≥5 on a quiet seat
4 honest failure preserved (no artifact in ≥3/5 empty-store runs) not measured, same run
5 no added rows, byte size reported met — 13 chars per unverified row, ceiling 8 rows/block = 104 against a 1200 budget, asserted

Expectation for criterion 3, written before the run: the label changes what the model is told, not what is stored, so it can only reduce harm if the reader discounts [unverified]. If the re-run shows 4/5 wrong artifacts anyway, the honest conclusion is that a text marker does not survive a confident row, and the fix belongs upstream of injection — which is a different ticket, not a tuning job on this one.

Two costs named rather than buried

  1. A row whose only nearby number is not the value — "VAT_BPS was introduced in 2024" — is refused as a contradiction. Test names it; widen the rule there, not silently.
  2. The first version kept lastIndex on a module-level g regex, so a claim came out undecidable because of which row was checked last. A gate whose answer depends on call order looks deterministic and is not. The regex is built per call now, and order-independence is pinned by test.

Verification

bun run gate: 1224 unit tests, 30 e2e against a real opencode host, typecheck and lint clean. test/provenance.test.ts: 15 tests, 6 of which fail without the wiring.

Part of #386, ticket #393.

R4 (results-poison-x5/, n=5) is the evidence. Empty store: 0/5 correct, and only
2/5 produced a file at all -- both with `vat_bps null`, because the agent declines
to invent a rate. One plausible wrong row: 0/5 correct, 4/5 shipped a WRONG
artifact (2475, 2100, 3100, 1750), no uncertainty flagged in any run. Correct row:
5/5. A false row is not neutral; it converts "I cannot proceed" into "I shipped
something wrong". The rows were real capture output with values and targets
swapped, so this is the same shape and confidence, not a strawman.

What ships is the part the evidence supports: a label the reader discounts by, plus
a check that refuses only on a real contradiction.

Provenance is DERIVED and total. Measured on the live store: of 1014 rows, 109
carry `auto-capture`, 18 carry `user-guided`, 0 carry `import`, and 905 carry none
of those -- they came through the tool path, which is a provenance and not an
absence of one. "A row with no provenance is not injected" therefore cannot be a
filter over tags: it would have dropped 89% of the store, a recall loss wearing a
safety badge. A test pins the totality so nobody simplifies it back into one.

Only an inference that nothing outside its own transcript vouched for renders
`[unverified]`; an inference whose number agreed with the working tree renders
`[code-checked]`. User-stated and tool-elicited rows render nothing, because
decorating 905 of 1014 rows with a warning would teach the model to ignore the
warning. The marker is appended rather than folded into `[via ...]`, whose exact
text several tests pin. Cost: 13 chars per unverified row, ceiling 8 rows per
block = 104 chars against a 1200-char budget (AC 5, asserted).

The write-time check refuses ONLY on contradiction, and the measurement is why it
goes no further. `findConstant(base4, "fallbackVatBps")` is null: the fixture
leaves the rate unset, which is exactly where a confident wrong row fits. A check
that refuses when the tree contradicts refuses nothing in R4; a check that refuses
when the tree is SILENT also refuses the transport fact (empty 0/5, seeded 5/5),
the one measured benefit memory has. So `undecidable` keeps the row and labels it.

Capture's structured ref/claim ride user-guided rows only, and guided rows are the
ones this must not touch -- a user correcting a stale tree is the case where the
tree is wrong. So an inferred row is checked on what it says: a symbol it names
(SCREAMING_CASE or a dotted member) plus a number within 48 chars.

Two costs named rather than buried, each with a test:
- a row whose only nearby number is not the value ("VAT_BPS was introduced in
  2024") is refused as a contradiction;
- the first version kept `lastIndex` on a module-level `g` regex, so a claim was
  "undecidable" because of which row was checked last. A gate whose answer depends
  on call order looks deterministic and is not. The regex is now built per call and
  order-independence is pinned.

- src/store/model/provenance.ts: derivation + marker, with the 905/1014 measurement
- src/capture/checked.ts: content-level claim check, three verdicts
- src/capture/runtime.ts: refuse on contradiction, tag on agreement,
  `auto_capture_contradiction` evidence
- src/core/tags.ts: CODE_CHECKED_TAG
- src/inject/format.ts: render the marker
- test/provenance.test.ts: 15 tests; 6 fail without the wiring

Not done here: AC 3 and AC 4 need the poison and transport arms re-run at n>=5 on a
quiet seat. FINDINGS F19: this bench seat is shared with the agent driving it, and
the same profile ran 5-47s per turn and 1287s per turn an hour apart.

Co-authored-by: OpenCode <[email protected]>

@WhollyMindless WhollyMindless left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 — the prose number extractor loses a sign before granting [code-checked] (src/capture/checked.ts:88, head 8bcb6ac187358581dc268fdcba29025cc51efc3b).

With the actual tree declaring export const VAT_BPS = 2150, a capture candidate saying The VAT_BPS constant for this site is -2150 basis points. is persisted and rendered with [code-checked]. The new unsigned \d+(?:\.\d+)? match passes 2150 to valuesAgree, even though the row still says -2150. No contradiction receipt is emitted. As a control, the existing structured claimVerdict(repo, "VAT_BPS", "-2150") returns contradicts against the same tree: the sign is lost specifically by this new extraction path.

Could the extractor preserve signed numeric values (or leave unsupported numeric syntax undecidable) before deciding agreement? The observed consequence is stronger than missing a warning: an opposite-signed value is positively labelled as checked against source.

Validation: Windows/Bun 1.4.4; 105 focused provenance/capture/injection tests and typecheck pass, plus one separate capture-to-store-to-format probe (5 assertions, including the structured-verdict control). Synthetic transcript/canned model reply only; no downstream model behavior or live-host incidence claimed. This is separate from the coincidental-nearby-number refusal already disclosed in the PR.

@WhollyMindless

Copy link
Copy Markdown
Contributor

Authorship disclosure for the review above: I authored the earlier contradiction-surface PRs #355-363. The signed-value finding concerns the new prose extractor in this PR; the review does not independently approve that earlier code.

…-checked

Review finding on #399 (WhollyMindless), reproduced as stated: with the tree
declaring VAT_BPS = 2150, a candidate saying "-2150 basis points" extracted the
unsigned 2150, agreed, and shipped labelled [code-checked] with no contradiction
receipt. An opposite-signed value was positively vouched for by the check --
stronger than a missing warning.

Fix at the extraction point: the near-number match now carries an adjacent
leading [+-], which valuesAgree already parses. A hyphen separated by spaces
stays a separator, so "2150 - a later discount aside" still agrees.

The structured control from the review is pinned alongside: claimVerdict with a
declared "-2150" contradicts the same tree, proving the loss was specific to the
prose path.

Co-authored-by: OpenCode <[email protected]>
@abogartz

Copy link
Copy Markdown
Owner Author

@WhollyMindless finding confirmed and fixed in 838ac7e.

Reproduced as stated before touching code: with VAT_BPS = 2150 in the tree, -2150 basis points extracted unsigned, agreed, and shipped [code-checked] — an opposite-signed value positively vouched for, which is worse than the missing warning the marker exists to prevent.

Fix at the extraction point, not the verdict: the near-number match now carries an adjacent leading [+-] (valuesAgree already parses signs — the loss was specific to the extractor, exactly as the review diagnosed). A hyphen separated by spaces stays a separator: "2150 - a later discount aside" still agrees, pinned.

The structured control from the review is pinned next to the regression: claimVerdict(repo, "VAT_BPS", "-2150") contradicts the same tree, so if the two paths ever diverge again the test names which one moved.

bun run gate green: 1225 unit, 30 e2e, typecheck, lint.

@WhollyMindless WhollyMindless left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The signed-value finding is independently verified fixed at 838ac7e62b1cb580bc0eec82038db7d76a6ad3df. Replayed the candidate saying VAT_BPS ... -2150 against a tree declaring 2150: no row persists, an auto_capture_contradiction receipt is emitted, and the structured-verdict control also contradicts. The previous false [code-checked] result is gone.

106 focused provenance/capture/injection tests, the separate capture replay (3 assertions), and typecheck pass on Windows/Bun 1.4.4. This does not certify the unmeasured R4 label effect. Disclosure: I authored earlier contradiction-surface PRs #355-363; this approves the maintainer's new extractor fix, not independent certification of that earlier code.

abogartz added a commit that referenced this pull request Nov 11, 2026
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]>
@abogartz
abogartz merged commit c474825 into main Nov 12, 2026
4 checks passed
abogartz-opencode-self-improvement Bot pushed a commit that referenced this pull request Nov 12, 2026
# [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)
@abogartz-opencode-self-improvement

Copy link
Copy Markdown

🎉 This PR is included in version 0.23.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@WhollyMindless

Copy link
Copy Markdown
Contributor

Follow-up to my review: the ASCII-minus fix still works, but fresh scripted-capture probes on main 62ea742 reproduce a separate P2 false [code-checked] label. With export const VAT_BPS = 2150; in the fixture tree:

  • The VAT_BPS constant is 1900 basis points, not 2150. is stored and rendered [code-checked].
  • The VAT_BPS constant is not 2150 basis points. is also stored and rendered [code-checked].
  • The VAT_BPS constant for this site is −2150 basis points. (U+2212 minus) receives the same label. The ASCII -2150 control is correctly refused.

checked.ts:94–99 accepts any agreeing nearby number, even one the assertion explicitly rejects, and the extractor drops the Unicode sign. This upgrades contradictory prose to a positive verification label. For ambiguous multi-number/negated prose or unsupported numeric syntax, retaining [unverified] would avoid that endorsement without blocking the transport case. These cases were outside my earlier sign-fix verification and should have been called out.

Observed through capture → store → formatter on Windows with a canned model response; no claim about how often a real model emits these strings or how a reader acts on them. Disclosure: we authored earlier provenance-related code in #355–#363; this is a follow-up on that shared lineage, not independent certification of it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants