Repository navigation
Description
Goal
Decide by measurement, not inference, two things:
- Do bytes appended to the per-request message list (
SessionRequest.messages) at request time reach the provider? - Does appending there keep the stable prefix ahead of them byte-identical across turns while the injected memory set changes?
Every other surface has been examined and closed. This is the only realistic in-band route left, and it is unprobed.
Why this is the only route
Citations are at 966bb7e.
SessionRequest.system: Array<SystemPart>(node_modules/@opencode/plugin/dist/promise/session.d.ts~:25; the plugin pushes onto it atsrc/events.ts:305-306) is always serialized ahead of the conversation. The system channel cannot hold a prompt-responsive tail without moving the cached prefix: a changing block inside it relocates the divergence point inside the system field, and everything serialized after that point re-bills under a prefix cache. That is why an accounting change alone cannot reach the goal of Stop the memory block busting the prompt cache: prompt_reveal invalidations to zero #388 — the block has to stop being delivered on that channel, not merely stop being counted differently.prompthook mutation is forbidden at the source: "Never mutate event.prompt.text — it is stored verbatim and rendered in the UI" (src/events.ts:316-317). It would also poison the transcript and auto-capture.http.request/experimental.ws.sendcan place bytes anywhere after the protocol boundary, but they are provider-specific and experimental.- Freezing the selection per session is the already-rejected epoch-freeze flaw, recorded in-code (
src/inject/epochs.ts:256).
The current delivery path, measured: deliver (src/inject/epochs.ts:370) pushes the epoch's stable core parts (:383) and then the prompt-dependent relevance block (:393-396) onto the same system channel. #552 splits the epoch byte key so the block is excluded from the key, but its deliver hunk is comment-only and delivery does not change. Measured on base and PR head alike: delivered OCSI bytes go 432 → 502 between two turns on both revisions, per-turn sha256 is identical across revisions, the counter is 1 on base and 0 on head, and recomputes = 2 on both. The split changed accounting, not delivery.
SessionRequest.messages (session.d.ts ~:26, mutable per request) sits behind the stable prefix. Appending there makes the divergence the tail — the tail already moves every turn. That is the property the system field can never have. SessionHooks is at session.d.ts ~:129-144.
The precedent
Conversation-tail delivery already works on this host. The pull block rides a mutated tool-result text part (src/inject/pull.ts, PULL_HEADER = "## Related durable memory (pull)" at :3), and its placement comment states the repo rule and cites a measured host probe:
WHICH field the host forwards is measured, not assumed. On opencode v2.3.0 (probed through e2e/support/harness.ts against the real host)
result.contentis an ARRAY of{type:"text",text}parts and mutating a text part changes the next request; mutatingresult.output— the file-attachment object{type,uri,name,content,encoding,mime}— does not. (src/inject/pull.ts:32-39)
The probe here follows the same method against SessionRequest.messages: mutate, capture the request the host actually sends, compare bytes.
What the probe must record
- Host version.
- The exact request as seen by a loopback or scripted provider — the wire bytes, not the plugin's view of what it sent.
- Per turn: the byte offset of the stable prefix and the byte offset of the appended block.
- Whether the provider-side cache read grew across turns.
- Behavior on a hosted provider with cache pricing, not only a local seat.
Currency warning: a local seat's cache miss costs prefill time; a hosted provider bills cache read and cache write at different rates. Those are not the same claim and must never be quoted for each other.
Pass and fail, stated before running
- Pass: the appended bytes reach the provider AND the prefix ahead of them is byte-identical across turns with a changing memory set.
- Fail: the host drops the mutation, reorders it, or the prefix still moves.
Both outcomes are results and both get recorded on this ticket. A fail closes the last in-band route and is as valuable as a pass.
Risks the probe must surface, not solve
- A trailing message changes what the model believes the user said, so role choice matters.
- The block's instruction framing has to move with it: framing that reads as harness context in the system field can read as user speech at the tail.
- A per-request surface means the delivered bytes are re-sent every turn rather than cached, so the delivery cost model changes even in the pass case.
Out of scope
Implementing anything. If the probe passes, implementation gets its own ticket.
Sibling record
#552 is being reframed as epoch accounting and reporting while this stays open: it changes what is counted and reported, this ticket asks whether any in-band surface can change what is delivered. The two records stand together and do not contradict each other.
Activity