Repository navigation
Description
Goal
A session never pays a prompt-cache bust for its own correction to a row it is already riding, when both the old text and the new text are already in that session's transcript.
Problem
#165 established the riding-bytes rule: a pure addition this session authored costs zero busts. It deliberately carved out corrections:
A correction is not "already known." If a riding row is superseded (
memory_update,memory_forget, consolidation, decay), the model knows the old fact. Freezing makes the store silently vouch for something it has already retired.
That premise does not hold for a self-authored memory_update. The old row was in the injected prefix; the replacement text is in the tool arguments and assistant reasoning. Both versions are in the conversation. Re-rendering the prefix to show the replacement adds no information and re-bills the whole history.
Live dogfood shows this at src/inject/epochs.ts:274-299:
- A frozen epoch records
ownRowsfor the rows that rendered. memory_updateappends a new row and marks the ridden rowsuperseded_bythe newts.isInjectabledrops the superseded row.- The counterfactual
backrender removes the session's new row viaextra, but does not restore the superseded predecessor. back.prefixtherefore lacks both versions, cannot equalcached.prefix, and the epoch adopts new bytes with reasonstore_changed.
The existing test at test/inject/epoch.test.ts:667 ("correcting a row the session is riding still busts, even its own") pins the carve-out. This ticket proposes reversing it only for the self-authored case.
Evidence
In session ses_dea8575b1ffeqPPPuUHSQrpLOP, a context/tickets row tagged next-planned was written at 02:21:01Z and then rewritten by the same session at 03:13:45Z, 03:52:51Z, 03:52:57Z, and later milestones. Each rewrite superseded the previous row and rode in the next request's system prefix.
One measured chain: at 2026-11-26T16:24:49.700Z memory_update rewrote tickets/next-planned; the next gufo request started 16:24:50Z and completed 16:28:32Z with:
cache=miss cached_tokens=0
cache_miss_reason=no_compatible_boundary
common_prefix_tokens=17473
prefill_tokens=203935
duration_ms=222283.6
The same write-then-miss pattern appeared at 16:52:36Z and 18:05:48Z. This is a prefix change, not an idle TTL eviction.
What to do
In refreshEpoch's riding-bytes check, when a new row was authored by this session and superseded a row that was part of the frozen render, restore the predecessor in the counterfactual back render with superseded_by cleared. Compare that render to cached.prefix. If they match, adopt the new store version silently and keep the frozen bytes.
The durable store still supersedes normally. Only this session's rendered prefix stays frozen.
Add an explicit no-cache-freeze tag as an opt-out: a self-authored correction to a tagged row still busts on the next request. Do not infer this from prose.
Constraints
- This is a narrow reversal of one
#165acceptance criterion, not a removal of the riding-bytes rule. - Foreign writes, viewer edits, hand-redaction, blocklist,
memory_import,memory_undo, and another session's consolidation or decay must still bust. - Frontier displacement, budget eviction, and moved convergence lines must still bust.
- A row that was not riding when frozen does not qualify.
- A new session must see only the corrected row; the frozen old bytes are session-local overlay, not durable stale state.
#390stays intact: corrections must supersede in the data, not only in the wording.#388remains the ticket forprompt_revealrow-set changes. This ticket is forstore_changedfrom self-authored supersession.
Acceptance
- Scripted session: seed a riding row, have that same session call
memory_updateon it, then assert zeroepoch_recompute, unchangedinvalidations, and delivered system bytes byte-identical to the frozen prefix. - A fresh session on the same store injects only the replacement row; the predecessor is not injectable.
- Negative controls each still produce one
store_changedrecompute: another session'smemory_update, viewer redaction, hand-redaction, blocklist, import, undo, non-riding predecessor, frontier displacement, andno-cache-freeze-tagged row. prompt_revealbehavior is unchanged; this path fires only on the store-change branch.- Gate green:
bun run gate.
Related
#162— rendered-byte epoch versioning.#165— riding-bytes rule and the carve-out this ticket narrows.#388— prompt-cache stability from prompt-dependent row selection.#390— corrections must supersede in data.
Activity
WhollyMindless commentedon Nov 26, 2026
Note
🤖 GPT-6.2 Sol responding on behalf of WhollyMindless
I’ll pick up #550. I’ll start by reproducing the cache invalidation and checking how the epoch can identify a same-session
memory_update. The regression tests will cover exact prefix bytes, fresh-session visibility, and the cases that still need to invalidate.abogartz-opencode-self-improvement commentedon Nov 27, 2026
🎉 This issue has been resolved in version 0.37.4 🎉
The release is available on:
Your semantic-release bot 📦🚀
ocsi-architect commentedon Nov 27, 2026
Closed as completed. Merged in a7d0c8a.
The goal holds on the surface it is about. Measured on the delivered system section, with the same driver on both revisions: a session riding a row, then two chained self-authored corrections, plus intervening repeats, a tool loop and a rephrase, renders the same sha256 across every turn, where the pre-change revision busts from the first correction onward. A set change that genuinely adds a row still busts, a fresh session renders only the current row, and after compaction the hold is gone and the corrected row is what the session is shown.
Requirements met, each against a named test or measurement: the self-authored carve-out reversal, the opt-out tag honored on both predecessor and successor, the non-self-authored case still busting, durable store semantics unchanged, and the fail-closed behavior when the recorded chain has been edited, revoked, hidden from this reader, or duplicated.
Recorded as verified-but-not-closed-against, for whoever picks up cost work later: provider-side billing was never observed for this change, and the real-store validator backstop did not run in the reviewing seat. The delivery evidence is the byte identity of the request, which is the honest claim to make about it.