Skip to content

fix(agents): scope append-only runtime context to prefix-binding Claude models - #136990

Merged
steipete merged 3 commits into
mainfrom
steipete/carrier-prefix-gating
Sep 3, 2026
Merged

steipete merged 3 commits into
mainfrom
steipete/carrier-prefix-gating

Conversation

@steipete

@steipete steipete commented Sep 3, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

#136782 made Anthropic-family routes replay runtime context append-only: the hidden per-turn carrier is persisted right after its user turn, earlier carriers and inline inbound metadata stay in place, and consecutive user turns are no longer merged on the Messages API. That is required for Claude Fable 5.1, whose thinking blocks are bound to the exact request prefix. It was enabled for every Claude model, so Opus 5, Sonnet 5, Opus 4.8, Sonnet 4.6 and Haiku 4.5 sessions kept every historical carrier in context and paid the prompt-cache read rate for it on every later request, with nothing to protect (their thinking survives prefix changes, verified live in #136782). Each carrier also repeated a ~60-token preface explaining the markers, on every turn, for every provider.

Why This Change Was Made

  • Model-scoped policy. New llm-core predicate bindsClaudeThinkingPrefix (the Fable 5.1 identity, including Bedrock/Vertex ids and canonicalModelId deployment metadata; Mythos 5.1 stays out until it is registered and its binding is proven, as agreed in fix(anthropic): Fable 5.1 sessions lose reasoning after model switches and runtime events #136782) drives appendOnlyRuntimeContext in the core transport fallback and the shared Anthropic replay helpers. buildStrictAnthropicReplayPolicy takes an explicit option (default off) so GitHub Copilot, which strips thinking anyway, stays transient. Non-binding Claude models return to transient carriers and normal user-turn merging; Bedrock Converse keeps merging for every model as before.
  • Carrier slimming. Next-turn carriers now contain only the delimited context body. The instruction (runtime context for the user request it follows, not user-authored, keep internal details private, continue without waiting for another message) lives once in the stable system-prompt prefix, above the cache boundary, for every provider, so it is cached instead of re-sent per turn. Runtime-event prefaces are unchanged because those turns have no user message. Historical prefaced carriers are still detected and stripped from user-visible surfaces.
  • Cleanup that fell out. The now-unused next-turn preface constant is gone (its literal stays in the stripper table for persisted history), and the OPENCLAW_* name budget ratchets down by one.

Production delta: +50/-21 (predicate, option plumbing, the prompt section); tests +323/-90; docs +27/-15.

User Impact

  • Opus/Sonnet/Haiku sessions on Anthropic, Bedrock, Vertex, Foundry, MiniMax and other Anthropic-compatible routes no longer accumulate persisted runtime-context carriers; old carriers stop consuming context and cache-read tokens.
  • Fable 5.1 sessions keep the append-only replay from fix(anthropic): Fable 5.1 sessions lose reasoning after model switches and runtime events #136782 and now send a smaller carrier per turn.
  • Every provider gets one short "Runtime Context" section in the stable system prompt; the per-turn carrier preface disappears.

Docs: docs/providers/anthropic.md, docs/reference/transcript-hygiene.md, docs/concepts/system-prompt.md.

Evidence

Unit and contract coverage (all failing before the change for the intended reason): llm-core predicate table; transcript-policy scoping across anthropic-messages and bedrock-converse-stream for anthropic, amazon-bedrock and custom-proxy providers plus Foundry canonical deployment identity; replay-helper scoping for the by-model, native and hybrid helpers; provider plugin replay policies (anthropic, amazon-bedrock, anthropic-vertex, minimax, github-copilot); carrier rendering, detection and leak stripping; transient replay of a transcript that already holds persisted carriers; the system-prompt instruction present once, byte-identical across builds and above the cache boundary. Prompt snapshots regenerated with no committed diff. node scripts/check-changed.mjs green (typecheck, lint, assertion ratchet, dead-export scan, SDK surface, import cycles).

Live, on a recording proxy in front of api.anthropic.com with prefix_mismatch_behavior: drop_block injected so server-side drops would be visible:

  • Opus 5 session (/model … -s, /think max, two tool turns): the two command turns were merged into one user message, the model-switch carrier was sent only in its own turn (compact body, no preface) and was not persisted; the next turn's history had no carrier. input_transformations: [] on all three requests.
  • Fable 5.1 session (/think max, tool turn, switch to Opus 5, tool turn, switch back, three more turns incl. tool loops): the switch-back carrier was persisted immediately after its user turn as the delimited body only and stayed in place across all later requests; consecutive user turns stayed separate; thinking blocks accumulated 1 → 3; every response reported input_transformations: [] and no [anthropic] replayed thinking dropped line was logged. Transcript check: exactly one persisted openclaw.runtime-context entry in the Fable session, none in the Opus session.

Follow-ups: none required; the Fable-specific retention behaviour and the binding-controls telemetry are unchanged from #136782.

…de models

Append-only runtime-context replay (persisted carriers, retained inline
inbound metadata, no consecutive-user merge on the Messages API) exists
because Claude Fable 5.1 binds thinking to the exact request prefix. It was
enabled for every Anthropic-family route, so Opus 5, Sonnet 5, Opus 4.8,
Sonnet 4.6 and Haiku 4.5 sessions paid for persisted carriers on every later
request (cache-read billing plus context) without any prefix to protect.

- Add `bindsClaudeThinkingPrefix` to the llm-core Claude contracts (Fable 5.1
  and Mythos 5.1 identities, including cloud ids and canonical deployment
  metadata) and derive `appendOnlyRuntimeContext` from it in the core
  fallback and the shared Anthropic replay helpers; GitHub Copilot stays
  transient. Non-binding Claude models return to transient carriers and
  normal user-turn merging.
- Next-turn carriers now carry only the delimited context body. The shared
  instruction (runtime context for the user request it follows, not
  user-authored, keep internal details private, continue without waiting)
  moves once into the stable system prompt prefix for every provider, so it
  is cached instead of re-sent per turn. Runtime-event prefaces are
  unchanged; historical prefaced carriers are still stripped from
  user-visible surfaces.
- Docs: anthropic provider page, transcript hygiene, system prompt.

Live proof on a recording proxy with drop_block binding controls: an Opus 5
session merged consecutive user turns and kept its model-switch carrier
transient; a Fable 5.1 session switched to Opus 5 and back, then ran three
more turns with tool loops while the persisted compact carrier stayed in
place, thinking blocks accumulated (1 -> 3) and every response reported
input_transformations: [].
@clawsweeper

clawsweeper Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@steipete
steipete marked this pull request as ready for review September 3, 2026 04:32
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Sep 3, 2026
@clawsweeper

clawsweeper Bot commented Sep 3, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 3, 2026, 2:10 AM ET / 06:10 UTC.

ClawSweeper review

What this changes

The PR limits persistent runtime-context carriers to prefix-binding Claude Fable 5.1 models and makes other Anthropic-family replays transient again, with the carrier guidance moved into the stable system prompt.

Regression provenance

Possible regression — probable (reviewed change; known regression link). No predecessor PR is attributed.

Merge readiness

⛔ Blocked before merge - 1 item remains

No blocking correctness findings. This active member PR is still necessary: current main retains append-only runtime context for all Anthropic-family models, while this branch scopes it to the proven Fable 5.1 identity.

Priority: P2
Reviewed head: 55e9a1b73abc1971228547963340d7285aed0793

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, well-covered replay-policy correction with no concrete defect found in the exact introduced changes.
Proof confidence 🌊 off-meta tidepool Not applicable: This member-authored PR is exempt from the external-contributor proof gate; its body nevertheless describes an after-fix recording-proxy exercise of the real Anthropic request path for transient Opus and retained Fable sessions.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This member-authored PR is exempt from the external-contributor proof gate; its body nevertheless describes an after-fix recording-proxy exercise of the real Anthropic request path for transient Opus and retained Fable sessions.
Evidence reviewed 4 items Single model-scoped owner: The introduced predicate recognizes only normalized Fable 5.1 identities, including canonical deployment metadata; the shared provider helpers and unowned transport fallback both consume that predicate rather than carrying separate policy copies.
Runtime boundary and siblings: The runner passes the resolved policy into session preparation and turn validation; the Anthropic, Bedrock, Vertex, MiniMax, and ClawRouter provider registrations use the shared by-model or hybrid replay families, while Copilot deliberately strips replayed thinking and remains transient.
Focused coverage: The branch tests direct, Bedrock, unowned, and Foundry-style canonical identities, plus the shared helper paths and compact carrier rendering.
Findings None None.
Security None None.

How this fits together

The embedded agent runner assembles transcript history and a provider replay policy before every model request. The policy determines whether hidden runtime metadata remains in subsequent requests, affecting signed-thinking validity, context size, and prompt-cache use.

flowchart LR
  A[User turn or runtime event] --> B[Embedded agent runner]
  B --> C[Transcript replay policy]
  C --> D{Claude thinking prefix-bound?}
  D -->|Fable 5.1| E[Keep carrier in place]
  D -->|Other models| F[Use transient carrier]
  E --> G[Provider request]
  F --> G
Loading

Before merge

  • Resolve merge risk (P1) - Merging intentionally changes active non-Fable Claude sessions on main from retained to transient runtime-context carriers; this is a compatibility-sensitive replay transition even though the branch covers the shared paths.
Agent review details

Security

None.

PR surface

Source +29, Tests +228, Docs +12, Other +1. Total +270 across 29 files.

View PR surface stats
Area Files Added Removed Net
Source 8 49 20 +29
Tests 17 333 105 +228
Docs 3 27 15 +12
Config 0 0 0 0
Generated 0 0 0 0
Other 1 2 1 +1
Total 29 411 141 +270

Review metrics

Metric Value Why it matters
Production versus test delta production +49/-20; config +2/-1; tests +333/-105; docs +27/-15 The net production growth centralizes one model predicate and compact carrier instruction; most of the change is focused regression coverage.

Merge-risk options

Maintainer options:

  1. Accept the scoped replay transition (recommended)
    Merge the Fable-only policy after accepting that existing non-Fable sessions on main will resume transient carrier handling.

Technical review

Best possible solution:

Keep one Fable-only identity predicate as the replay-policy source of truth, retaining append-only history only where signed thinking requires it and transient carriers everywhere else.

Do we have a high-confidence way to reproduce the issue?

Yes: current main’s unconditional append-only policy and this branch’s Fable-only predicate make the affected replay selection directly traceable in source. This read-only review did not rerun the live provider scenario.

Is this the best way to solve the issue?

Yes: the change centralizes the decision in one normalized model predicate and routes both core fallback and provider families through it, avoiding divergent per-provider rules.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 53066564532e.

Labels

Label justifications:

  • P2: This is a bounded provider replay and context-efficiency correction without evidence of an urgent current outage.
  • merge-risk: 🚨 compatibility: The branch deliberately changes replay handling for existing non-Fable Anthropic-family sessions.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This member-authored PR is exempt from the external-contributor proof gate; its body nevertheless describes an after-fix recording-proxy exercise of the real Anthropic request path for transient Opus and retained Fable sessions.

Evidence

What I checked:

  • Single model-scoped owner: The introduced predicate recognizes only normalized Fable 5.1 identities, including canonical deployment metadata; the shared provider helpers and unowned transport fallback both consume that predicate rather than carrying separate policy copies. (packages/llm-core/src/model-contracts/anthropic.ts:86, 55e9a1b73abc)
  • Runtime boundary and siblings: The runner passes the resolved policy into session preparation and turn validation; the Anthropic, Bedrock, Vertex, MiniMax, and ClawRouter provider registrations use the shared by-model or hybrid replay families, while Copilot deliberately strips replayed thinking and remains transient. (src/agents/transcript-policy.ts:375, 55e9a1b73abc)
  • Focused coverage: The branch tests direct, Bedrock, unowned, and Foundry-style canonical identities, plus the shared helper paths and compact carrier rendering. (src/agents/transcript-policy.test.ts:645, 55e9a1b73abc)
  • Current-main and history provenance: Merged PR 136782 established the broader replay behavior now being narrowed; it is on current main but is not contained in stable v2026.8.2, and current main still has the unconditional helper behavior. (src/plugins/provider-replay-helpers.ts:95, 30837ae7035b)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (2 earlier review cycles)
  • reviewed 2026-09-03T04:42:15.959Z sha 5721ded :: blocked before merge. :: [P2] Gate append-only replay to a proven binding model
  • reviewed 2026-09-03T05:49:43.685Z sha c5d2433 :: blocked before merge. :: none

…ct carriers in e2e

`bindsClaudeThinkingPrefix` now covers only the Fable 5.1 identity. Mythos 5.1
is not registered in the bundled Anthropic catalog and has no live replay
proof, so it keeps transient carriers and normal user-turn merging like every
other non-Fable model; extending the predicate requires live proof for the
new model. Predicate, transcript-policy, replay-helper and provider plugin
tests assert the narrowed set.

The qa-lab gateway RPC chat e2e test still imported the removed next-turn
carrier preface; its carrier filter now matches the delimiter-only shape.
@steipete

steipete commented Sep 3, 2026

Copy link
Copy Markdown
Contributor Author

Rank-up move applied: bindsClaudeThinkingPrefix is now limited to the Fable 5.1 identity. Mythos 5.1 is not registered in the bundled Anthropic catalog and I have no live replay proof for it, so it keeps transient carriers and normal user-turn merging like every other non-Fable model; the predicate's doc comment states that extending it needs live proof for the new model. The predicate table, transcript-policy, replay-helper and provider plugin tests now assert false for Mythos 5.1 ids on every route.

Also fixed the check-test-types failure: test/e2e/qa-lab/runtime/gateway-rpc-chat.e2e.test.ts still imported the removed next-turn carrier preface constant; its carrier filter now matches the delimiter-only carrier shape.

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Sep 3, 2026
@clawsweeper clawsweeper Bot removed the proof: sufficient ClawSweeper judged the real behavior proof convincing. label Sep 3, 2026
@steipete

steipete commented Sep 3, 2026

Copy link
Copy Markdown
Contributor Author

On the compatibility note: the transition for existing non-Fable Claude sessions is intended, and it is the safe direction. Since #136782 landed (hours ago) those sessions have been persisting openclaw.runtime-context carriers; after this change the transient replay path strips the historical carriers on the next request and keeps only the current turn's carrier, which is exactly what those sessions did before #136782. That path is covered by attempt-session-boundary ("strips persisted carriers when a session switches to transient replay": persisted carriers removed, no duplicates, idempotent across replays). The resulting prefix change is harmless for these models because their thinking is not bound to the prefix (Opus 5 / Sonnet 5 / Opus 4.8 / Sonnet 4.6 replay survived prefix edits and cross-model replay in the #136782 live matrix); Fable 5.1 sessions are unaffected because they stay append-only. No operator action is needed.

@steipete
steipete merged commit de7518b into main Sep 3, 2026
369 of 371 checks passed
@steipete
steipete deleted the steipete/carrier-prefix-gating branch September 3, 2026 07:08
@steipete

steipete commented Sep 3, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 4, 2026
…de models (openclaw#136990)

* fix(agents): scope append-only runtime context to prefix-binding Claude models

Append-only runtime-context replay (persisted carriers, retained inline
inbound metadata, no consecutive-user merge on the Messages API) exists
because Claude Fable 5.1 binds thinking to the exact request prefix. It was
enabled for every Anthropic-family route, so Opus 5, Sonnet 5, Opus 4.8,
Sonnet 4.6 and Haiku 4.5 sessions paid for persisted carriers on every later
request (cache-read billing plus context) without any prefix to protect.

- Add `bindsClaudeThinkingPrefix` to the llm-core Claude contracts (Fable 5.1
  and Mythos 5.1 identities, including cloud ids and canonical deployment
  metadata) and derive `appendOnlyRuntimeContext` from it in the core
  fallback and the shared Anthropic replay helpers; GitHub Copilot stays
  transient. Non-binding Claude models return to transient carriers and
  normal user-turn merging.
- Next-turn carriers now carry only the delimited context body. The shared
  instruction (runtime context for the user request it follows, not
  user-authored, keep internal details private, continue without waiting)
  moves once into the stable system prompt prefix for every provider, so it
  is cached instead of re-sent per turn. Runtime-event prefaces are
  unchanged; historical prefaced carriers are still stripped from
  user-visible surfaces.
- Docs: anthropic provider page, transcript hygiene, system prompt.

Live proof on a recording proxy with drop_block binding controls: an Opus 5
session merged consecutive user turns and kept its model-switch carrier
transient; a Fable 5.1 session switched to Opus 5 and back, then ran three
more turns with tool loops while the persisted compact carrier stayed in
place, thinking blocks accumulated (1 -> 3) and every response reported
input_transformations: [].

* fix(agents): limit prefix-binding replay to Fable 5.1 and match compact carriers in e2e

`bindsClaudeThinkingPrefix` now covers only the Fable 5.1 identity. Mythos 5.1
is not registered in the bundled Anthropic catalog and has no live replay
proof, so it keeps transient carriers and normal user-turn merging like every
other non-Fable model; extending the predicate requires live proof for the
new model. Predicate, transcript-policy, replay-helper and provider plugin
tests assert the narrowed set.

The qa-lab gateway RPC chat e2e test still imported the removed next-turn
carrier preface; its carrier filter now matches the delimiter-only shape.

* test(agents): expect merged user turns for non-binding Claude replay
RomneyDa pushed a commit that referenced this pull request Sep 25, 2026
…de models (#136990)

* fix(agents): scope append-only runtime context to prefix-binding Claude models

Append-only runtime-context replay (persisted carriers, retained inline
inbound metadata, no consecutive-user merge on the Messages API) exists
because Claude Fable 5.1 binds thinking to the exact request prefix. It was
enabled for every Anthropic-family route, so Opus 5, Sonnet 5, Opus 4.8,
Sonnet 4.6 and Haiku 4.5 sessions paid for persisted carriers on every later
request (cache-read billing plus context) without any prefix to protect.

- Add `bindsClaudeThinkingPrefix` to the llm-core Claude contracts (Fable 5.1
  and Mythos 5.1 identities, including cloud ids and canonical deployment
  metadata) and derive `appendOnlyRuntimeContext` from it in the core
  fallback and the shared Anthropic replay helpers; GitHub Copilot stays
  transient. Non-binding Claude models return to transient carriers and
  normal user-turn merging.
- Next-turn carriers now carry only the delimited context body. The shared
  instruction (runtime context for the user request it follows, not
  user-authored, keep internal details private, continue without waiting)
  moves once into the stable system prompt prefix for every provider, so it
  is cached instead of re-sent per turn. Runtime-event prefaces are
  unchanged; historical prefaced carriers are still stripped from
  user-visible surfaces.
- Docs: anthropic provider page, transcript hygiene, system prompt.

Live proof on a recording proxy with drop_block binding controls: an Opus 5
session merged consecutive user turns and kept its model-switch carrier
transient; a Fable 5.1 session switched to Opus 5 and back, then ran three
more turns with tool loops while the persisted compact carrier stayed in
place, thinking blocks accumulated (1 -> 3) and every response reported
input_transformations: [].

* fix(agents): limit prefix-binding replay to Fable 5.1 and match compact carriers in e2e

`bindsClaudeThinkingPrefix` now covers only the Fable 5.1 identity. Mythos 5.1
is not registered in the bundled Anthropic catalog and has no live replay
proof, so it keeps transient carriers and normal user-turn merging like every
other non-Fable model; extending the predicate requires live proof for the
new model. Predicate, transcript-policy, replay-helper and provider plugin
tests assert the narrowed set.

The qa-lab gateway RPC chat e2e test still imported the removed next-turn
carrier preface; its carrier filter now matches the delimiter-only shape.

* test(agents): expect merged user turns for non-binding Claude replay

(cherry picked from commit de7518b)
RomneyDa added a commit that referenced this pull request Sep 25, 2026
* fix(agents): scope append-only runtime context to prefix-binding Claude models (#136990)

* fix(agents): scope append-only runtime context to prefix-binding Claude models

Append-only runtime-context replay (persisted carriers, retained inline
inbound metadata, no consecutive-user merge on the Messages API) exists
because Claude Fable 5.1 binds thinking to the exact request prefix. It was
enabled for every Anthropic-family route, so Opus 5, Sonnet 5, Opus 4.8,
Sonnet 4.6 and Haiku 4.5 sessions paid for persisted carriers on every later
request (cache-read billing plus context) without any prefix to protect.

- Add `bindsClaudeThinkingPrefix` to the llm-core Claude contracts (Fable 5.1
  and Mythos 5.1 identities, including cloud ids and canonical deployment
  metadata) and derive `appendOnlyRuntimeContext` from it in the core
  fallback and the shared Anthropic replay helpers; GitHub Copilot stays
  transient. Non-binding Claude models return to transient carriers and
  normal user-turn merging.
- Next-turn carriers now carry only the delimited context body. The shared
  instruction (runtime context for the user request it follows, not
  user-authored, keep internal details private, continue without waiting)
  moves once into the stable system prompt prefix for every provider, so it
  is cached instead of re-sent per turn. Runtime-event prefaces are
  unchanged; historical prefaced carriers are still stripped from
  user-visible surfaces.
- Docs: anthropic provider page, transcript hygiene, system prompt.

Live proof on a recording proxy with drop_block binding controls: an Opus 5
session merged consecutive user turns and kept its model-switch carrier
transient; a Fable 5.1 session switched to Opus 5 and back, then ran three
more turns with tool loops while the persisted compact carrier stayed in
place, thinking blocks accumulated (1 -> 3) and every response reported
input_transformations: [].

* fix(agents): limit prefix-binding replay to Fable 5.1 and match compact carriers in e2e

`bindsClaudeThinkingPrefix` now covers only the Fable 5.1 identity. Mythos 5.1
is not registered in the bundled Anthropic catalog and has no live replay
proof, so it keeps transient carriers and normal user-turn merging like every
other non-Fable model; extending the predicate requires live proof for the
new model. Predicate, transcript-policy, replay-helper and provider plugin
tests assert the narrowed set.

The qa-lab gateway RPC chat e2e test still imported the removed next-turn
carrier preface; its carrier filter now matches the delimiter-only shape.

* test(agents): expect merged user turns for non-binding Claude replay

(cherry picked from commit de7518b)

* fix(anthropic): preserve cache reuse across transient runtime context (#140621)

Anthropic tool loops could repeatedly write growing conversation history to the
prompt cache because a moving runtime-context carrier owned the checkpoint.
Use the existing replay lifecycle contract to exclude transient carriers from
both request builders while preserving retained anchors. Also omit empty beta
headers that caused direct API requests with thinking disabled to fail.

Add deterministic regression coverage and a packaged Docker test that verifies
real cache reads and incremental writes across two tool continuations and a new
user turn in both builders. Require that lane in stable/full release validation,
with explicit API-key preflight, no request retries, and a declared runtime entry
for dependency analysis.

Validation includes focused package/model/session and workflow tests, build and
package integrity checks, static checks, independent review, mock Docker, and
eight successful live Anthropic Docker requests. Hosted CI run 34379052492 passed
on the final PR head at attempt 2, after one unchanged browser-animation rerun.

Closes #140607

Thanks to @LightningWareLLC for reporting the regression and contributing the
lifecycle-aware cache repair.

Co-authored-by: LightningWareLLC <[email protected]>
Co-authored-by: Peter Steinberger <[email protected]>
(cherry picked from commit faaf4b0)

* fix(anthropic): bind cache carriers to replay policy

* fix(release): qualify prefix-bound anthropic replay

* fix(github-copilot): keep replay context transient

---------

Co-authored-by: Peter Steinberger <[email protected]>
Co-authored-by: LightningWare LLC <[email protected]>
Co-authored-by: LightningWareLLC <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling docs Improvements or additions to documentation extensions: amazon-bedrock extensions: anthropic extensions: anthropic-vertex extensions: github-copilot extensions: minimax maintainer Maintainer-authored PR merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: L status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant