Skip to content

[Feature]: Keep the Anthropic prompt cache across mid-conversation reasoning effort changes (per-message effort) #6895

Closed

Description

@thisisjun786

Area

Provider adapters

What are you trying to accomplish?

A Codex conversation routed to an adaptive-thinking Claude model (Haiku 5.5, Sonnet 5.5, Opus 5.5, Fable 5.1) through the Anthropic adapter changes its reasoning effort between turns, for example to raise effort after a failed attempt. The goal is to change effort mid-conversation without paying a cache write for the whole conversation history again.

What prevents this today?

On OpenCodex 2.81.0 (/v1/responses → Anthropic Messages), an effort change only changes the top-level output_config.effort. Thinking stays {type: adaptive, display: summarized}, and tools, system, message order and cache_control placement do not depend on effort. So OpenCodex does not change the prefix itself. The miss comes from the upstream rule that a change of the top-level effort invalidates the messages cache.

Measured through the proxy (direct /v1/responses calls, fixed instructions and prompt_cache_key, same account, single send each):

Case Result
Single turn, about 12k-token prefix, effort high → xhigh → max → high → medium → low (Haiku 5.5 and Sonnet 5.5) Every call after the first reads the whole prefix from cache; cache creation 0
Multi-turn, replayed reasoning items, effort constant Cache grows normally turn by turn
Multi-turn, replayed reasoning items, effort changes between turns Cache reads stop at the first user message (about 11.6k tokens); everything after it is written again on each effort change
Multi-turn, reasoning items stripped from the replay, effort changes Cache keeps growing (not a fix: dropping thinking costs quality)

A second, smaller effect: with multi-agent guidance enabled and the v1 spawn_agent tool surface, reaching effort max/ultra injects a <multi_agent_mode> developer message into the message prefix (src/server/responses/collaboration.ts, the effort !== 'max' && effort !== 'ultra' early return). Crossing into or out of max therefore changes the prefix as well.

What should OpenCodex do?

Keep the cached prefix across mid-conversation effort changes on models that support Anthropic's per-message effort (beta header mid-conversation-output-config-2026-07-01, adaptive thinking required):

  1. Per conversation key (conversation id or prompt_cache_key), remember the effort of the first request and keep the top-level output_config.effort at that value for the rest of the conversation.
  2. When a request's effort differs, insert {role: "system", content: [], output_config: {effort}} into messages right before that turn's user message. Re-insert every earlier change point at the same position on later requests so the prefix stays byte-identical (Codex history carries no per-turn effort, so OpenCodex needs a per-conversation list of change points).
  3. Send the beta header only for api.anthropic.com, supported models and adaptive thinking (a request with thinking disabled is refused). Fall back to today's behaviour when the account or route does not accept the beta.
  4. Make the v1 multi-agent guidance independent of the per-request effort, or inject it once per conversation, so a max turn does not change the prefix.

Example usage or interface

No new user-facing option is required. An opt-out config flag (for example anthropic.perMessageEffort: false) would help while the beta is new.

Alternatives or workarounds

  • Keep effort fixed for the whole conversation (what we do for now).
  • Start a new thread on escalation (loses context and writes the whole prompt again).
  • Strip replayed reasoning (keeps the cache but drops thinking continuity).

Additional context

Not yet measured: when the cache grows again after one effort change with constant effort afterwards, tool-use loops, and whether the tools/system blocks stay cached on the effort-changing turn (the experiment had no tools). The wire bodies were not retained, so the exact upstream cause was not proven by byte comparison. Whether OAuth accounts accept the beta header also needs a check.

Checks

  • I searched existing issues and documentation.
  • This request describes a concrete OpenCodex workflow rather than merely naming a desired technology.
  • I removed secrets and personal data.

Activity

  1. added
    enhancement
    provider
    on Oct 10, 2026
  2. Ingwannu commented on Oct 10, 2026

    @Ingwannu
    Owner

    The API capability is real, but this should remain a design item rather than a default-on adapter tweak. Anthropic's current per-message effort contract documents the dated beta value, model/platform eligibility, and empty-content system messages. A change takes effect for the applicable user turn with new input; tool-result-only turns do not start a new effort boundary. The mid-conversation message contract also distinguishes effort-only messages from content-bearing system messages and their placement rules. These docs do not establish acceptance by the OAuth subscription route or an arbitrary Anthropic-compatible gateway.

    Two pieces need separate owner decisions:

    1. Bounded immutable effort history. A prompt_cache_key alone is not a sufficient history identity: retries, forks, concurrent requests, compaction, model/provider/account changes and truncated/replaced histories can share a key but require different change points. Specify request ownership, prefix matching, commit/rollback timing, TTL/byte/entry bounds, and behavior when continuity cannot be established. Earlier accepted change points must replay identically; never guess a missing historical effort from the latest global setting.
    2. Guidance policy. Making V1 guidance effort-independent or inserting it permanently changes the existing Max/Ultra delegation policy. Keep that separate from cache optimization; do not enable proactive guidance at lower effort or keep stale guidance after operator disable just to preserve cache bytes.

    For a focused proposal, reuse the current adapter/continuation owners and add synthetic wire-prefix tests for effort changes, tool loops, retries, concurrent branches, compaction, route/account replacement and unsupported beta responses. Define fallback before sending; a beta rejection is not blanket permission to replay a possibly processed request. Default-on rollout and live cache/quota acceptance are not approved here. Your observations are useful, but without retained comparable wire prefixes they do not isolate every cache miss. I have not made live calls, copied credentials, changed settings, or run a scan.

  3. added
    needs-design
    on Oct 10, 2026
  4. rkb32 commented on Oct 11, 2026

    @rkb32
    Contributor

    I'd like to take this on. I'll post a design proposal here before writing any code. It will cover:

    • A bounded, immutable per-conversation effort history, including ownership, rollback, and fallback.
    • Guidance policy kept separate from cache optimization.
    • A synthetic wire-prefix test plan for retries, forks, and compaction.
    • Opt-in and default-off only, with no default-on rollout.
  5. Ingwannu commented on Oct 12, 2026

    @Ingwannu
    Owner

    Thanks — please post that design proposal before implementing. The proposed scope matches the earlier review: bounded immutable effort history, explicit ownership/rollback/fallback, guidance policy kept separate, synthetic branch/retry/compaction coverage, and default-off opt-in.

    Please base the proposal on the current dev and identify the existing adapter/continuation owners it reuses. Include a failure table for missing or replaced history, concurrent forks, account/provider changes and unsupported upstream capability. This is agreement to review a proposal, not approval of a new history store, default rollout, live subscription calls or changing the V1 delegation policy. No need to post private prompts, credentials or full request captures.

  6. rkb32 commented on Oct 13, 2026

    @rkb32
    Contributor

    Here's the plan, based on the current dev branch (1edd55a). Opt-in, off by default. @Ingwannu

    Files I'd change: src/adapters/anthropic.ts, src/adapters/anthropic/beta-allowlist.ts, src/claude/inbound.ts

    The idea: when a chat changes effort partway through, add a small note at that point instead of changing the setting for the whole chat. The earlier part of the chat stays the same, so the cache still works.

    Limits: only for Anthropic's direct API and the models that support this. It waits for #7042 to be fixed first.

    If this happens What the code does
    No saved history for the chat Starts fresh with the current effort
    Chat history was cut short or replaced Ignores notes that no longer match
    Two branches of the same chat Keeps each branch separate
    Account, provider, or model changes Starts fresh
    Anthropic rejects the feature Falls back to today's behavior

    Measurement: log cache read and creation token counts per request, with and without an effort change, before turning it on by default.

    Tests: synthetic only, no live calls.

    Open question: should saved history live in memory with an expiry, or in the existing storage? What expiry and size limits do you want?

  7. rkb32 commented on Oct 13, 2026

    @rkb32
    Contributor

    Correction to my last comment: #7042 is fixed (#7067), so it’s no longer a blocker. @Ingwannu @lidge-jun

    The change I still need to make is adding the per-message effort beta (mid-conversation-output-config-2026-07-01) to the allowlist in src/adapters/anthropic/beta-allowlist.ts. It isn’t in the list on dev yet. I’d add it as part of this work, limited to the models that support it.

  8. rkb32 commented on Oct 19, 2026

    @rkb32
    Contributor

    @Ingwannu @lidge-jun Update on #6895.

    #7042 is fixed (#7067), so it no longer blocks this. #7341 (merged Oct 19) changes src/adapters/anthropic.ts, src/adapters/anthropic/passthrough.ts, and adds src/adapters/anthropic/cache-retention.ts. I'll rebase on it before any change.

    Proposed next step, once the design is confirmed: add mid-conversation-output-config-2026-07-01 to src/adapters/anthropic/beta-allowlist.ts, sent only for Fable 5.1, Mythos 5.1, Opus 5.5, Opus 5, Sonnet 5.5, and Haiku 5.5 (not Fable 5, per Anthropic's effort docs), with a test.

    The history design from my Oct 13 comment is still the open part. Question: can you confirm that design, including the failure table, before I write the allowlist change?

  9. github-actions commented on Oct 19, 2026

    @github-actions
    Contributor

    Automated translation bookkeeping — detected language: English.

  10. Ingwannu commented on Oct 19, 2026

    @Ingwannu
    Owner

    Rechecked against dev d11f067 and the current official effort contract on 2026-10-19. Your six-model API eligibility list and Fable 5 exclusion match that contract; tool-result-only user turns still must not create a new-input effort boundary. The system-message contract also distinguishes empty effort-only entries from content-bearing system messages.

    The Oct 13 failure table is directionally useful but is not yet sufficient to approve the history design. Please make its actions precise before implementation:

    • Name the existing request/continuation owner, identity tuple and immutable prefix/branch discriminator; prompt_cache_key alone cannot own this state. Specify concurrent update fencing and commit/rollback timing.
    • Separate a genuinely new conversation from missing/expired/replaced history midway through one. For the latter, disable this optimization rather than reconstructing earlier efforts from the current setting or silently discarding unmatched historical change points.
    • Name the exact existing memory owner and its entry/byte/TTL bounds; prefer reusing bounded process-local state over adding durable credential-adjacent history. Account/provider/model replacement must end the old scope.
    • Replace “Anthropic rejects -> falls back” with a pre-send capability decision and an explicit ambiguous/post-send failure row. A rejected or uncertain request is not automatic permission for another billable send.

    Rebase over #7341, keep guidance/Max delegation unchanged, and retain opt-in/default-off behavior. A narrowly tested allowlist change can be proposed separately, but it does not approve a history store, OAuth/gateway acceptance or live quota experiments. The overall design remains needs-design pending those details and owner disposition.

  11. rkb32 commented on Oct 19, 2026

    @rkb32
    Contributor

    @Ingwannu Proposal for #6895, following your latest points.

    1. Owner: no existing store holds effort history, so I propose a new in-memory store in src/adapters/anthropic.ts.
    2. Identity: the existing reasoning-replay tuple (src/responses/reasoning-replay-cache.ts, L125–142): provider name, destination identity, adapter name, model ID, and process-local credential identity. Plus the cohort from src/codex/lineage.ts. The credential identity is a hash of the key or account slot, never the raw key or token. It resets on restart, which matches a memory-only store.
    3. Branch: a hash of the message list up to the last change point. Claude Code compacts history on its side, so the list can change. That starts a new entry, and the upstream prefix misses anyway. The exact compaction rewrite is still unchecked.
    4. Concurrency: an in-flight marker is set before sending and cleared on message_stop or error. Requests arriving while it's set skip the optimization.
    5. Commit and rollback: a change point is recorded only after message_stop. A stream without it is a failure.
    6. New vs. missing history: a cohort with no record starts fresh, which costs one cache miss. You asked for disabling instead. Do you accept this change?
    7. Unmatched change points: the optimization is turned off for that cohort, and the event is logged.
    8. Bounds: in memory only, 64 entries, 512 KB total, 1-hour expiry.
    9. Account, provider, or model change: ends the old entry.
    10. Pre-send decision: the listed models only (Fable 5.1, Mythos 5.1, Opus 5.5, Opus 5, Sonnet 5.5, Haiku 5.5), on api.anthropic.com, for non-OAuth accounts.
    11. Failures:
      • Failed before sending: error returned, no change point.
      • Sent, no message_stop: error returned, no automatic resend, optimization off for that cohort until the next clean turn.
      • Sent, message_stop received: change point recorded.
    12. Kill switch: claudeCode.perMessageEffort, default false.
    13. Scope: opt-in and off by default. Rebased over feat(anthropic): default prompt-cache TTL to 1h on first-party Anthropic #7341. Guidance and Max delegation unchanged.

    The allowlist change would be a separate proposal. This doesn't ask for approval of a history store, OAuth or gateway acceptance, or live quota tests.

  12. Ingwannu commented on Oct 19, 2026

    @Ingwannu
    Owner

    The new proposal makes ownership/bounds and commit timing more concrete. I do not accept treating an arbitrary missing record as a fresh history: restart, TTL/LRU eviction, truncation/compaction and a genuinely new conversation can all have no record, and the current adapter cannot reconstruct earlier effort breakpoints from that absence. An in-flight marker avoids overlap but does not establish branch/attempt identity or successful rollback after an ambiguous partial turn.

    For a reviewable design, distinguish a provably new transcript from missing/evicted prior state using captured request lineage plus an immutable matched-prefix receipt; disable the optimization when that evidence is absent or a change point cannot be placed exactly. Keep a sent-without-message_stop outcome disabled until a subsequent baseline round trip has re-established a complete matched prefix, rather than silently starting a new optimized history. Specify how concurrent/replayed branches and credential-generation changes fence that receipt. The proposed 64-entry/512 KB/1-hour limits are useful bounds, not reconstruction evidence. Please keep the shared routing/credential identity owner outside a monolithic adapter implementation and submit this as the design contract first. This comment does not approve a new history store, model allowlist expansion, OAuth/gateway acceptance or live quota tests.

  13. rkb32 commented on Oct 19, 2026

    @rkb32
    Contributor

    @Ingwannu Design contract for review: https://gist.github.com/rkb32/69ee9faf767de6aae0369244aaa0d654 — It answers your Oct 19 points: a named owner and identity, fixed transcript and frame hashes, fencing for concurrent and replayed requests, commit after message_stop, no restart after an uncertain send, a pre-send check for the beta, and a failure table. Open items are in section 13. For this design, the proxy sets the beta through mergeAnthropicBetaHeader (defined in src/providers/anthropic-fast.ts L68, called at src/adapters/anthropic.ts L1229), so it needs no change to the allowed-beta list. An OAuth token refresh marks the history unconfirmed, so the next request is off until a baseline round trip. One decision for you: we keep the OAuth generation out of the scope key (per #1926). If you want it in, every refresh turns the history off.

  14. Ingwannu commented on Oct 20, 2026

    @Ingwannu
    Owner

    I read the linked design contract against current dev 12025981e5a304cdb6b1b54f525ba8554f623977. Separating the owner and proxy-set beta path is useful; this does not need a caller passthrough allowlist change merely to add a proxy-owned header. The design is not yet approved:

    1. Section 7 rule 4 treats one user message plus a missing record as provably new, while sections 12/13 admit restart, eviction and compaction. Message count is not captured lineage. A compacted/restored/retried transcript can have exactly that shape. Require a positively owned new-transcript receipt; otherwise stay off, including the single-message-after-eviction test.
    2. Same cohort, frame and first-message hashes do not distinguish sequential forks sharing an initial prompt. The committed prefix must bind the actual accepted/generated assistant/tool-call continuation, not only the client request before generation. Specify a versioned branch/attempt receipt and CAS-style commit so a later branch cannot overwrite or borrow another branch's effort points.
    3. Sections 7 replay-off and 9 baseline/rebuild must specify exactly what invalidates the old receipt when an unoptimized resend or failed/ambiguous baseline has actually sent. "Writes nothing" must not leave an earlier optimized prefix eligible after a divergent send. Include failed-before-send, terminal failure, client disconnect after a send and credential change during baseline controls.

    Keep the durable credential scope key aligned with the existing shared identity owner; do not add rotating OAuth tokens to that global key. Capture generation on each physical attempt and fence the local receipt/commit through the existing owner instead. Identifying that concrete propagation seam (your open item 7) is required. Bounds and cache-read counters do not establish transcript equality. Please revise the contract and synthetic failure table first; this is not approval of a new store, OAuth capability, billing assumption or live probe.

  15. 8 remaining items

  16. rkb32 commented on Oct 28, 2026

    @rkb32
    Contributor

    @Ingwannu @lidge-jun Thanks for the triage. Agreed, we'll finish the isolated state machine and fixture work first, with activation off. Integration waits until the ownership contract is accepted.

    Here's what we're going with, unless you object:

    1. The receipt covers both chat/new-transcript and compaction, tied to the assistant and tool output the client echoes. Raw metadata is out.
    2. Only an emitted thinking.budget_tokens counts as a thinking change. The adaptive branch's internal budget doesn't, so that branch stays eligible.
    3. Pending-slot expiry is 10 minutes, and the buffer cap is 128 KB.

    Next up is an offline fixture on current Bun, with a real serializer-to-next-request check. I'll cover compaction, concurrent forks, ambiguous sends, stale credential generations, and retained transcript bytes.

    Could you assign this issue to me? I'll take the isolated work from here.

    No live capture until someone approves it.

  17. Ingwannu commented on Oct 29, 2026

    @Ingwannu
    Owner

    The isolated/off-by-default fixture work can stay with you, within the owner-review boundary already recorded above. This is ownership of the offline investigation, not approval of the activation/integration contract or a live account capture. Please preserve the emitted thinking.budget_tokens distinction and exercise the receipt across real serializer-to-next-request fixtures, compaction, forks, ambiguous sends and stale credential generations. Keep the 10-minute / 128-KB limits explicit as proposed fixture policy until the owner accepts them.

    I checked GitHub assignment eligibility for rkb32; the repository assignee endpoint currently returns 404, so I cannot record you as an actual GitHub assignee with the current repository eligibility. I have not sent an invitation or changed access. This comment records your volunteered ownership; formal assignment remains pending repository eligibility. No live capture was authorized or executed.

  18. rkb32 commented on Oct 29, 2026

    @rkb32
    Contributor

    @Ingwannu Update on the offline work. Activation is still off, and there's no live capture.

    I ported the slice to Bun fixtures on dev at fdc6dd82. Every body and output item comes from the real Anthropic adapter, Responses parser, and bridge. That's 21 fixtures plus 95 slice tests, covering the positive control, the emitted budget_tokens rule, compaction, forks, ambiguous sends, stale credential generations, and retained bytes. Files are in the gist: https://gist.github.com/rkb32/69ee9faf767de6aae0369244aaa0d654

    Two fixes came out of it. A pending slot now keeps only hashes, never transcript text. Effort none is now off: on Opus 5.5 it keeps the same thinking field, so the thinking rule alone missed it.

    One question. Codex never sends max_output_tokens, so the adapter derives max_tokens from effort (Opus 5.5: low 12288 up to max 40192). Under the output-limit rule, every effort change is off, so the feature never fires for default Codex users. A fixture shows an alternative: send each turn's max_tokens exactly as today and compare only the caller's cap. No cap is raised or lowered, and max_tokens isn't in Anthropic's cache-invalidation list. Does the rule cover only caller or configured caps, or this derived default too?

  19. Ingwannu commented on Oct 29, 2026

    @Ingwannu
    Owner

    The current rule includes the derived effective body.max_tokens, not only an explicit caller/configured cap. That was the meaning of my Oct 25 comparison against the current request's adapter output, and @lidge-jun retained differing-effective-limit => optimization-off in the Oct 28 proposal.

    I checked the current adaptive branch in src/adapters/anthropic.ts at dev 9b78a16f4fe0c300527e6b183052407269bb941d: it preserves an explicit cap and otherwise derives max_tokens from the current effort and configured default. Your conclusion about the default omitted-cap sequence is therefore a real eligibility limitation, not a reason to substitute a caller-only comparison silently. Comparing only the caller cap while retaining each turn's ordinary emitted cap is a distinct compatibility proposal; leaving wire limits unchanged is useful evidence, but absence from a cache-invalidation list does not settle the accepted history/eligibility contract. That relaxation needs @lidge-jun's explicit decision.

    For the offline slice, retain a negative control for omitted-cap effort changes whose derived effective caps differ, plus a serializer-based positive control where the same explicit cap naturally produces equal effective limits. Do not change defaults or recommend increasing a cap merely to obtain eligibility. Compare emitted thinking.budget_tokens separately from an adaptive branch's internal calculation; effort none must stay off even when its emitted thinking object happens to match.

    I read the updated contract's cap and bounds sections and the corresponding adapter path; I have not independently executed the reported 21 fixtures/95 slice tests or validated real client echo. Pending-slot hashes and proposed TTL/buffer numbers remain offline evidence/proposals. Activation, integration and live capture remain unapproved; no need to reopen the previously resolved ordering/invalidation objections.

  20. rkb32 commented on Oct 31, 2026

    @rkb32
    Contributor

    @Ingwannu @lidge-jun thanks for the review. Some replies, a couple of corrections, and a test run.

    Derived max_tokens: yep, you're right, the derived limit counts. The slice checks the limit the adapter actually sends, derived one included.

    • No explicit cap, effort goes high to low, max_tokens goes 24576 to 12288. Turns off.
    • Explicit cap 32000 through the real serializer, effort high to low. Limit stays the same, so the change point is allowed.
    • Emitted thinking.budget_tokens is checked on its own. Adaptive mode doesn't emit one. The fixed-budget branch's budget changes with effort, so that counts as a thinking change.
    • Effort none stays off, even if the emitted thinking looks the same.
    • Comparing only the caller cap would be a separate proposal. That's lidge-jun's call.

    Corrections:

    • On Oct 28 I said "Raw metadata is out." That's wrong. The slice still takes a new chat from the raw history_initialization "New" header. The positive receipt isn't built yet, so activation condition 1 is still open.
    • The Oct 29 numbers (21 fixtures, 95 slice tests on fdc6dd8) are old. Current: 29 fixtures and 111 slice tests on base 9b78a16.

    Test run today: 29/29 fixtures pass (Bun 1.4.4, on Linux) and 111/111 slice tests pass. The fixtures ran on Linux because the Windows test lock refuses on my machine. Contract and tests are in the gist: https://gist.github.com/rkb32/69ee9faf767de6aae0369244aaa0d654

    Not done yet: real client wire behavior, the positive receipt, and real-serializer resume/restart cases. Activation, integration, and live capture are still off.

    @lidge-jun quick question: can we accept 10-minute / 128 KB as fixture-only policy, with activation still off? I'd say yes, since it keeps everything offline and easy to undo.

  21. rkb32 commented on Nov 4, 2026

    @rkb32
    Contributor

    @lidge-jun @Ingwannu bump on this, plus an update. I'm doing this part alone right now, so I need one of you to pick up the owner-side decisions.

    Done since Oct 31:

    Not done yet:

    • Positive receipt for a new chat or new transcript, and compaction (activation condition 1). Not built.
    • Lifecycle receipt propagation for ordinary and WebSocket turns. Not wired; needs the owner's call on the seam.
    • Credential seam (Ingwannu's item 7). Identified by reading, not wired.
    • Real client echo, beta/cache behavior, and developer-role live behavior. Needs a live test, which isn't approved.
    • Restore on failed send, and re-enable after an uncertain send (contract 13.4). Needs the owner's flag.
    • Caller-cap relaxation and the 10-minute / 128 KB values. Owner decision.
    • Fixtures ran under WSL, not on Windows (the Windows test lock refuses on my machine).

    Open question for lidge-jun: can I keep 10-minute / 128 KB as fixture-only values for now, with activation still off? If you want different numbers, tell me which and I'll change the fixtures.

  22. Ingwannu commented on Nov 7, 2026

    @Ingwannu
    Owner

    Thanks for the update. On your question about fixture-only values: as I said on Oct 29, 10 minutes / 128 KB can stay as explicit fixture policy while activation is off. That doesn't need an owner decision now. It only becomes one if activation is proposed.

    The other items on your list are still unapproved owner decisions, and this comment doesn't approve any of them:

    • the positive new-transcript and compaction receipt
    • where the lifecycle receipt is propagated
    • the credential seam
    • relaxing the rule to compare only the caller's cap
    • restoring and re-enabling after an uncertain send
    • live capture

    The next useful step that doesn't need an owner decision is a concrete proposal for the receipt seam:

    • which existing turn/lifecycle owner emits the receipt, for both HTTP and WebSocket turns
    • a negative fixture showing that raw history_initialization metadata alone never enables the feature

    The owner can then decide on one specific seam instead of an open question.

  23. rkb32 commented on Nov 9, 2026

    @rkb32
    Contributor

    @Ingwannu thanks, Full files are in the gist: https://gist.github.com/rkb32/69ee9faf767de6aae0369244aaa0d654

    • 10 min / 128 KB: fine. We'll keep those as fixture-only values with activation off.
    • A raw header no longer starts a chat by itself. Tests cover HTTP, WebSocket, and compaction. My Oct 31 note said otherwise. That was wrong.
    • Proposed marker: {"v":1,"kind":"new-transcript"}. Not accepted yet. Malformed, wrong-version, or wrong-kind values count as off.
    • Codex already has history_initialization (New, ColdResume, and so on), and in the code a brand-new thread maps to New. Could New be the receipt, with the rest off? I haven't checked real traffic, and I'm not asking for a live capture.
    • Receipt owners (your Nov 7 question): HTTP is the /v1/responses route in serve-options.ts (~L1488). WebSocket is the frame path in websocket-handler.ts (~L345), reading per-frame client_metadata. Compaction is handleResponsesCompact in compact.ts. Earlier I named shadow-call.ts; that was wrong, since it only handles helper provenance.
    • Credential seam: replayOAuthCredentialSnapshot in request-transport.ts, with the generation from oauthCredentialSnapshot. Details in §13.9 of the gist.
    • The 400 rule (no resend, clear criteria) is in the contract.
    • Production bytes are identical with and without the metadata on HTTP, WebSocket, and compact. That's an offline check. Nothing is wired in yet.

    Still open for you: receipt acceptance, lifecycle propagation, credential seam, caller-cap relaxation, restore after an uncertain send, live capture, real client echo, developer-role behavior, Fable 5.1 on the Mythos rule, committed-output canonicalization, compaction-marker identification, chat-lineage source, and whether a failed pre-send restores or deletes. Real-turn compaction and normalization checks are still offline only.

    No live calls or config changes. Activation stays off.

    Quick note on testing: the 46 Bun fixtures pass under WSL with Bun 1.4.4, and also on Windows with Bun 1.4.4. The Windows run worked from a plain terminal; the first try from my tooling hit the repo's test-run lock. The 113 Node slice tests pass on Windows.

  24. lidge-jun commented on Nov 16, 2026

    @lidge-jun
    Owner

    Owner decision (lidge-jun, 2026-11-16): run a small live capture first to confirm per-message effort keeps the Anthropic cache, then ship the change as a default-off experimental option.

  25. rkb32 commented on Nov 17, 2026

    @rkb32
    Contributor

    @lidge-jun @Ingwannu thanks for #8787. I re-ran the case in this issue's table through the OpenCodex proxy (dev at c36793a): ~12k-token prefix, replayed reasoning items, a prompt_cache_key per arm, 2 reps per arm, 3 turns.

    Results (cached_tokens as reported by the proxy):

    • claude-haiku-5-5, effort low → high → low: turn 3 read 11,950 tokens, consistent with the first user message (turn 1 input was 11,954 tokens), in both reps. With constant low effort, turn 3 read 12,408 and 12,549.
    • claude-sonnet-5-5, same pattern: turn 3 read 12,363 and 12,504, close to constant effort (12,401 and 12,465). Not reproduced in 2 reps.
    • Turn 2 read 11,950 in every arm, so that part is not tied to effort.

    Direct API (no proxy), ~8k-token prefix, same effort pattern, 3 reps: Haiku and Opus read only the turn-1 prefix on turn 3 (8,023 and 8,006) in 3/3 reps. Sonnet and Fable read past the turn-1 prefix.

    Not tested through the proxy: the experimental perMessageEffort option; Opus and Fable; more than 2 reps. I have not identified the cause. One possibility, unverified: on Haiku and Opus, entries written at high effort are not readable at low.

    I'd like to open a PR for the Haiku/Opus turn-3 shortfall. Is that welcome, or should it start as a new issue first?

    Raw usage is available if useful.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementneeds-designprovider

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions