Repository navigation
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. Reviewed September 9, 2026, 12:56 PM ET / 16:56 UTC (Revision 7). ClawSweeper reviewWhat this changesThe PR preserves Anthropic conversation-cache reuse around temporary runtime context, omits empty beta headers, and adds packaged regression coverage to release verification. Merge readiness✅ Ready for maintainer review This remains a useful repair: current main still permits transient context to receive cache checkpoints, and no merged replacement resolves it. The revised patch addresses the earlier lifecycle concern, has convincing live API evidence, and introduces no identified blocking defect. Priority: P2 Review scores
Verification
How this fits togetherOpenClaw’s Anthropic request builders turn conversation history, tool results, and runtime context into provider requests. Cache checkpoints determine which stable portions Anthropic can reuse on subsequent requests. flowchart TD
A[Conversation and tool results] --> C[Anthropic request builders]
B[Runtime context] --> C
C --> D{Context retained by model policy?}
D -->|Yes| E[Allow context checkpoint]
D -->|No| F[Checkpoint stable conversation]
E --> G[Anthropic API and cache usage]
F --> G
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +24, Tests +225, Docs +11, Config +7, Other +397. Total +664 across 19 files. View PR surface stats
Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Technical reviewBest possible solution: Keep cache eligibility tied to the existing context-retention contract in shared conversion, with packaged live regression coverage protecting reuse. Do we have a high-confidence way to reproduce the issue? Yes, from source: with transient context and available cache-marker capacity, current main can checkpoint the carrier after it moves behind tool results. This review did not execute a failing current-main run. Is this the best way to solve the issue? Yes. Reusing the existing model lifecycle predicate and cache allocator repairs both builders without changing context roles, persisted history, or user cache settings. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 577492132500. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (6 earlier review cycles)
|
|
@clawsweeper re-review Added after-fix Anthropic Messages proof to the PR body:
Also clarified model-dependent retained vs transient carrier lifecycle in Why This Change Was Made. |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
Keep append-only carriers eligible as cache anchors (parity/CI), but exclude carriers that trail assistant/tool turns after relocate so the stable prefix keeps the deepest cache_control breakpoint.
|
@clawsweeper re-review Updated head with relocate-aware carrier opt-out (not blanket):
|
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
@clawsweeper re-review Updated head: 3b3c5b4. Carrier cache eligibility now uses the canonical replay lifecycle policy, preserving retained anchors after an earlier completed turn and excluding transient carriers from the initial request. The PR Evidence section now connects both production builders' emitted markers to live one-hour cache usage through two tool rounds and a subsequent user turn, for transient and retained models. All 16 live calls passed (estimated $0.211 total); 380 focused tests passed and independent review found no actionable P0–P2 findings. Updated-head CI is running. |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
Keep Anthropic cache checkpoints on retained conversation prefixes while excluding transient runtime context from both request builders. Preserve cache anchors for lifecycle-retained context. Add regression coverage and a packaged live Docker cache test to stable/full release verification, with explicit API-key preflight and no request retries. Also omit empty Anthropic beta headers exposed by the live test. Closes #140607 Co-authored-by: LightningWareLLC <[email protected]>
Declare the module launched by the Docker wrapper so dependency analysis follows its static mock-provider import. Keep the unused-file guard intact without ignores or baseline changes.
|
Merged via squash.
|
Real Gateway baseline: transient-carrier cache failure reproducedAdding complementary pre-fix Gateway lifecycle evidence, not post-fix validation of this PR's merge On September 9, 2026, one Run: https://github.com/openclaw/openclaw/actions/runs/34381314585/attempts/1, job All six Anthropic cells completed the real persisted Gateway path with exact two-request text or four-request read A -> read B -> final -> next-user flows. They had HTTP 200 successful SSE terminals, the expected runtime/model, exact raw-to-persisted usage parity, and zero transport-error rows. Ordered dependent reads and visible replies passed before the cache assertion.
Both Sonnet/Opus text cells also failed the transient-cache-breakpoint assertion, moving the carrier 1 -> 3; warm read/write was 9463/12670 and 9397/12642 respectively. Both Fable cells passed. The transient carrier stayed byte-identical while moving: content SHA256 The four OpenAI failures are separate, not evidence for this Anthropic defect. Three completed cells expose a QA full-history-versus-Responses-continuation contract gap, with exact live lineage not retained. The expanded read case stopped on an assistant/capture count mismatch; a separate source-confirmed QA gap conflates projected display rows with provider completions, but its exact live cause is unproven. An additional daily-read cache-floor deficit remains unresolved. None is treated as passed. Limits: projected message history was stable; full system/tool byte equality was not reached because the carrier assertion throws first. No raw DB/persisted-history export was retained. This is hashed structure/usage evidence plus inspected producer proof, not repaired-candidate validation, TLS attestation, or billing/savings proof. Report SHA256: Thanks to @LightningWareLLC for the original report and repair. Sharing this baseline to complement the landed runtime work; no branch or assignment change is intended. The test stack remains held for its OpenAI harness gaps and live-result policy disposition, and no post-fix Gateway pass is claimed. |
…openclaw#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 openclaw#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]>
…#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(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]>
Closes #140607
What Problem This Solves
Fixes an issue where Anthropic users running tool loops would repeatedly write growing conversation history to the prompt cache when temporary runtime context moved between requests. It also fixes requests with thinking disabled being rejected for an empty
anthropic-betaheader, found while exercising the cache repair against the live API.Why This Change Was Made
Both Anthropic request builders now use the existing replay lifecycle contract to exclude transient runtime-context carriers from cache checkpoints from the initial request onward. Retained carriers remain valid checkpoints. Emitted message indexes account for filtered messages and grouped tool results, and empty beta headers are omitted without changing thinking-binding eligibility.
A packaged Docker regression exercises both builders through an initial request, two real tool continuations, and a subsequent user turn. Stable/full release verification requires this lane, validates its API-key credential specifically, and does not retry failed cache assertions. Executable workflow tests cover both the planning and run steps.
User Impact
Anthropic sessions reuse the growing stable conversation prefix while still receiving temporary runtime context. Sessions requiring retained context preserve their anchors. Release verification now catches this cache-cost regression through provider-reported cache reads and writes, in addition to deterministic payload tests.
Evidence
The new transient string/block cases failed before the cache fix. Disabled-thinking and hook-disabled-thinking cases failed before the empty-header repair. The corrected candidate passed 332 focused tests across the package, model contract, session boundary, Docker scheduler, and actual release-workflow selection/preflight. Typechecks, lint, workflow validation, package build/integrity checks, and independent review passed.
Both mock Docker and eight live Docker requests passed using the installed candidate package and
claude-sonnet-4-6, short cache retention, 512 maximum output tokens, fixed system/tools per sequence, and a fresh synthetic conversation prefix for each builder. Requests have 90-second deadlines and no retries.The harness observes emitted checkpoints and unchanged cached prefixes without rewriting requests. Histories are synthetic and constructed by the harness: this is installed-builder/API proof; real Gateway lifecycle placement is covered by the session-boundary tests. The integration retains identical production, test, harness, and lockfile blobs from the live-validated candidate. Current main's Docker compatibility additions and split release documentation are preserved. Hosted CI on the updated PR head is the landing gate; the earlier ACP spawn failure is not counted as a pass.
The first integrated CI run identified a missing unused-file scanner entry for the shell-launched Docker runner. Declaring that entry made both unused-file scans pass with zero entries; the imported mock helper is discovered automatically, without an ignore or baseline change. That run also failed an unchanged terminal UI assertion and an unchanged Discord reset test timeout. Their complete focused files passed locally (29 and 16 tests respectively); updated-head Linux CI remains authoritative.
Final-head CI run 34379052492, attempt 2 passed on
18434a73af52a34720ea51d008ef19c2be61976b. An unchanged browser E2E animation-sampling assertion needed one accepted failed-jobs rerun together with its aggregate gate; no assertion, timeout, or product code was changed for that rerun.Thanks to @LightningWareLLC for reporting the regression and contributing the lifecycle-aware cache fix.