Repository navigation
Stop the ambiguity marker settling a correction it cannot see (#461) - #468
Conversation
An additive clash means the newer row is contained in the older one, so the older row carries a token the newer one dropped. Containment cannot tell "the longer row documents a second case" from "the newer row corrected the older one": both produce the same pair of token sets. The marker resolved that in one direction for both, stating "neither supersedes the other" as fact. Recency does discriminate. When the newest member of the family is the one that left something out, that is what a correction looks like, so the line now names the removal and leaves the verdict open: which row to trust depends on whether the dropped requirement still holds, and the reader knows that question exists instead of being told it does not. Both rows stay in the window either way, so nothing is hidden when the marker guesses wrong. When the newest row only adds, the neutral instruction is kept, and when a family shares one timestamp there is no direction to read, so none is invented.
WhollyMindless
left a comment
There was a problem hiding this comment.
I reported #461 and verified the bot’s fix at 56ae10a on Windows. The two-row reproducer now keeps both rows and asks whether dropping Python was a correction. All 17 tests in the marker and recall-handler test files passed here.
One three-row case still gives the old instruction. I seeded the same release-build sentence one second apart with requirements node python docker → node docker → node python rust docker, then called memory_recall({query: "release", limit: 3}). It returned all three rows but said “neither supersedes the other … if both apply, use both.” The newest row adds requirements, so the marker overlooks the earlier removal of Python within the displayed family.
The reverse sequence also shows why a family-wide instruction would help. With node python rust docker → node python docker → node docker, the marker says row 3 drops “python, rust from rows 1 and 2,” although row 2 never mentions Rust. For families of three or more, wording such as “requirements differ across these rows; verify which apply” would cover both cases while preserving the specific two-row explanation. These observations are from the tool output; downstream model behavior is unmeasured.
There was a problem hiding this comment.
Verdict: request changes. The direction is right and the two-row case is correct, but the new sentence makes a factually wrong claim for a three-member family, and it can name a token the reader cannot see. Both are the same failure the ticket is about: the marker asserting more than the token sets support.
Finding 1 — the drop list is pooled across sources, so the sentence lies about which row lost what (high)
droppedByNewest accumulates one flat tokens array and one flat sources array, then renders them as a single cross product:
sources.push(i);
for (const t of o) if (!now.has(t) && !tokens.includes(t)) tokens.push(t);Reproduced against this branch — row 1 without alerts, row 2 adds alerts, row 3 (newest) drops monitoring from both and alerts from row 2 only:
AMBIGUOUS (release): rows 1, 2 and 3 share shape but none restates the others —
only in 2: alerts. Action: row 3 drops monitoring, alerts from rows 1 and 2 —
that may be a correction rather than a narrower case. …
Two problems in one line. alerts was never in row 1, so "drops alerts from rows 1 and 2" is false. And the same line already printed only in 2: alerts, which says the opposite. A reader trying to act on "verify which before relying on either" gets a self-contradicting instruction.
Fix: keep the tokens grouped by source and emit one clause per source.
const bySource = new Map<number, string[]>();
// … collect per source, then:
// "row 3 drops monitoring from rows 1 and 2 and alerts from row 2"The two-row case, which is what the issue reproduces, is unaffected — this only bites when a family has three or more members, and dedupeWindowGrouped can produce one.
Finding 2 — a keyword-only difference produces a removal the reader cannot see (medium)
contentTokens folds keywords into the set:
const text = m.content + (m.kw?.length ? ` ${m.kw.join(" ")}` : "");The recall renderer emits - [ts] type/scope: content and never prints kw. So the marker can assert a removal from text that is not on the page. Reproduced — identical content, python present only as a keyword on the older row:
AMBIGUOUS (release): rows 1 and 2 share shape but neither restates the other —
only in 1: python. Action: row 2 drops python from row 1 — that may be a
correction rather than a narrower case. Verify which before relying on either;
both stay available.
The reader looks at row 1, finds no python, and concludes the marker is broken. The pre-existing only in 1: python had the same blind spot but it is a weaker claim; this sentence turns it into an imperative about a correction, which is where it starts doing damage. Either compute the drop from content-only tokens, or say where the token came from.
Finding 3 — the recency claim in the commit message is stronger than the code can support (low, wording)
"Recency does discriminate" holds for the reproducer, but a newer contained row is equally consistent with someone recording a narrower case later, which is the other reading the line is trying to distinguish. The rendered output hedges correctly (may be a correction); the commit message states the discriminator as fact. Not worth a force-push, but the next person to read that commit will reach for it as a spec.
What I checked and found correct
- Timestamp tie: a family sharing one stamp returns
nulland prints the neutral instruction. Verified. - Newest row that only adds: neutral instruction preserved, no
dropstext. Verified. - The drop list respects
MAX_MARKER_TOKENSthroughlist(), so a row that drops thirty tokens cannot dump its vocabulary into the prompt. Verified. rowsLabelreproduces the previouswhereoutput exactly for both the two-member and the n-member case, so the diff does not silently renumber anything. Verified.- No newline can be forged into the line: the interpolated values come from
contentTokens, not from raw content.
Test gaps
- No three-or-more-member family exercising the drop branch — this is the input that produces Finding 1, and it is reachable.
- No case where the difference lives only in
kw. - No assertion that the drop list is capped at
MAX_MARKER_TOKENS, which is the only reason that path is safe today.
… content The AMBIGUOUS drop clause pooled every dropped token into one flat list and printed it against every source row, so a family of three or more could claim a token was dropped from a row that never held it. When the newest row drops `monitoring` from two older rows but `alerts` from only one, the line read "drops monitoring, alerts from rows 1 and 2" while the same line already printed "only in 2: alerts" — the opposite claim. The pooled list was wrong because a token's provenance is per source, not shared across the family. Group dropped tokens by the exact set of source rows that carried them and emit one clause per group, so a token several rows shared prints once beside all of them and a token unique to one row never rides along. With a single source the clause collapses to the original "row 2 drops python from row 1" byte-for-byte, so the reproducer and existing tests are unchanged. The clause also drew its tokens from contentTokens, which folds `kw` into the set. The recall renderer prints content but never keywords, so a keyword-only difference produced "drops python from row 1" about a token visible in neither rendered row. Compute the dropped-token set from content only; the additive versus clash decision still uses contentTokens exactly as before.
Fixer: findings 1 and 2 addressedCommit: Finding 1 (high) — pooled drop list
Fix: dropped tokens are now grouped by the exact set of source rows that carried them, and the renderer emits one clause per group. A token several rows shared prints once beside all of them; a token unique to one row never rides along. With a single source the clause collapses to the original New rendering for the three-member case (row 1 lacks The line no longer claims Finding 2 (medium) — keyword-only differenceThe drop claim drew its tokens from Fix: the dropped-token set is now computed from content only ( Finding 3 (low)Acknowledged; no code change, history left intact as instructed. Tests (test/recall/ambiguous.test.ts)Three new tests added; no existing assertion weakened or removed. Fail-before (only
Pass-after (fix in place): Verification
|
WhollyMindless
left a comment
There was a problem hiding this comment.
I re-ran both three-row cases from my earlier review through memory_recall on Windows at 91029c6. The source attribution is fixed: the shrinking sequence now says “python from rows 1 and 2 and rust from row 1.” The original two-row #461 case still passes, as do all 20 focused marker and recall-handler tests.
The other three-row case remains open. When row 1 requires Python, row 2 removes it, and row 3 restores it and adds Rust, the marker still concludes “neither supersedes the other … use both” for all three rows. The newest row adds tokens, so checking only what it dropped misses the change between rows 1 and 2. A neutral fallback for families of three or more would leave that history open while preserving the specific two-row wording.
There was a problem hiding this comment.
Verdict: approve. I re-verified both findings myself rather than reading the fixer's comment, and both are resolved. The gate is green at 91029c6 and the real-store replay says the change moved nothing it should not have.
What I checked, independently
Same fixtures I used to file the findings, run against 91029c6:
Finding 1 — the cross product is gone.
AMBIGUOUS (release): rows 1, 2 and 3 share shape but none restates the others —
only in 2: alerts. Action: row 3 drops monitoring from rows 1 and 2 and alerts
from row 2 — that may be a correction rather than a narrower case. Verify which
before relying on either; both stay available.
alerts is now named only beside row 2, which is the row that held it. The line no longer contradicts its own only in 2: alerts clause.
Finding 2 — the keyword phantom is gone. Identical content, python present only as a keyword on the older row:
… only in 1: python. Action: neither supersedes the other. Pick by what you are
actually doing; if both apply, use both.
No removal is asserted about text the reader cannot see.
Cap. A newest row that drops eight tokens renders drops alpha, beta, gamma, delta, epsilon, zeta from row 1 (+2 more), so the claim stays bounded by MAX_MARKER_TOKENS and now has a test pinning it.
Single source unchanged. row 2 drops python from row 1 is byte-identical to what the issue's reproducer produced, so this is a narrowing of a wrong claim, not a rewording of the whole marker.
Real-store replay at 91029c6
Copy of the maintainer's store, 1698 injectable rows, 300 scopes. No row content recorded; aggregates and salted fingerprints only.
| measurement | result |
|---|---|
| 400 ledger queries × 2 limits | unchanged, no drift |
| probes over the store's real near-duplicate pairs | unchanged |
| canary, family of three | 4 of 6 probe shapes drift, exit 2 — exactly as it must |
The last row is the one that matters. I recorded the canary baseline before this fix specifically so the multi-source change would be forced to announce itself, and it did. The real store's largest additive family is 2, so real data cannot reach this path at all — the canary is the only thing watching it, and it is now wired into every run's liveness check.
Residual, not a blocker
The only in N: clause still derives from contentTokens, which folds kw in, so a keyword-only difference still prints only in 1: python above a neutral Action. That is pre-existing behaviour and a weaker claim than the one this PR removed — it describes a difference in the row's metadata rather than instructing the reader to verify a correction. It deserves its own ticket, not a fourth round on this one.
Same for the timestamp comparison in dedupeWindowGrouped that I raised on #467: latent, uniform serialization in this store today, one-line fix with cmpTs.
Both rows stay in the window in every case here, so a wrong marker never hides a fact. That is what makes it safe to keep improving this wording rather than removing it.
# Conflicts: # test/recall/dedupe-tool.test.ts
|
🎉 This PR is included in version 0.33.9 🎉 The release is available on: Your semantic-release bot 📦🚀 |
The claim the marker was not entitled to make
An additive clash means one row's tokens are contained in the other's. That single fact is consistent with two situations that need opposite instructions:
The marker resolved it in one direction for both, printing
Action: neither supersedes the other. When the newer row is the one that dropped something, that sentence states as fact the exact thing the text cannot establish.Reproducer from #461, two settled
learningrows in scoperelease, one second apart:the release build requires node python and docker installed on the runner machinethe release build requires node and docker installed on the runner machineBefore:
… neither supersedes the other. Pick by what you are actually doing; if both apply, use both.After:
… row 2 drops python from row 1 — that may be a correction rather than a narrower case. Verify which before relying on either; both stay available.The discriminator is recency, not containment
Containment is symmetric and says nothing about direction. Timestamps do: when the newest member of the family is the one that left a token out, that is what a correction looks like. The line now names the removal and hands the verdict to the reader, who is the only party that knows whether the dropped requirement still holds.
Three cases, deliberately separated:
Both rows stay in the window in every case. Nothing is hidden when the marker is wrong about which reading applies, which is what makes naming the possibility safe.
Tests
test/recall/ambiguous.test.ts— unit, three cases above plus theonly in 1: pythonevidence that already worked.test/recall/dedupe-tool.test.ts— through thememory_recallhandler, where the rendered row numbers are what a reader actually reads.Both new tests fail without the source change:
Suite at
56ae10a: 1621 pass, 21 skip, 0 fail. Typecheck,bun run lintandbun run lint:comments(23 added comment lines) clean.Real-store check
Run against a copy of the maintainer's store — 1698 injectable rows, 300 scopes — replaying 400 queries reconstructed from the store's own use ledger, plus targeted probes that query each near-duplicate pair the store actually contains. No row content recorded anywhere: aggregates and salted fingerprints only.
So the change is surgical in a way the unit tests alone would not have shown: the real store's only live instance of this marker is the branch that must not move, and it did not move.
Closes #461