Repository navigation
Conversation
Co-authored-by: obviyus <[email protected]>
…s append-only Dropping a NO_REPLY row left two user turns adjacent. Chat Completions and Bedrock merge them, which rewrote an already-sent turn and broke the prompt cache. The row is now dropped only when another assistant turn follows (#99620). Co-authored-by: obviyus <[email protected]>
…s append-only OpenClaw-Publication: 0d81101e-150c-8ae4-acbb-e22613e64f78
|
🦞👀 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 changes before merge. What this changesPreserve silent assistant replies during replay to prevent adjacent user turns from changing an already-sent prompt prefix. Example: A user sends “Check deployment,” the agent returns NO_REPLY, and the user then sends “Any update?”
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Needs changes before merge - 2 items remain Keep open: this maintainer-authored PR addresses a current replay defect, but introduces quadratic history copying and leaves a consumer test failing. Priority: P2 Before merge
Findings
Tests
Agent review detailsHow this fits togetherThe embedded agent runner projects stored conversation rows into model history before provider adapters construct outgoing requests. flowchart LR
A[Stored conversation] --> B[Replay normalization]
B --> C[Prompt preparation]
C --> D[Provider adapter]
D --> E[Model request]
E --> F[Provider response]
Technical reviewBest possible solution: Keep the existing replay owner, replace suffix copying with indexed lookahead, and make the shrink-history fixture use a genuinely removable row. Do we have a high-confidence way to reproduce the issue? Current-main source removes the silent separator, and the preceding merged PR records the resulting Chat Completions prefix break; the supplied fake-provider journeys report base failures and head passes, but no target code was executed during this read-only review. Is this the best way to solve the issue? Retaining the separator at the shared replay boundary addresses the cause across transports without introducing another policy owner; the expanded wire-format fixture provides distinct transport coverage. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against e60207216d61. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceAcceptance criteria:
What I checked:
Likely related people:
PR surfaceSource +14, Tests +296. Total +310 across 7 files. Added test files: 4. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. LabelsLabel changes: No label changes. Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed November 13, 2026, 3:34 AM ET / 08:34 UTC. |
|
Converting to draft. This is held until the redesign work reproduces the prefix-cache causes end to end from captured request bytes and proves the fix on real traffic; it may be superseded by that design. |
Problem
A deliberate silent reply (
NO_REPLY) broke the prompt cache prefix on role-alternating transports.Fix
One invariant across five transports
New fake servers (
test/helpers/fake-model-transports.ts) speak the five wire formats:anthropic-messages,openai-responses,openai-completions,google-generative-aiandbedrock-converse-stream(Bedrock uses a hand-built AWS event stream). Each transport has its own e2e file that runs one Gateway scenario:first turn → background exec → subagent spawn and completion → inter-session send → skill install → workspace
AGENTS.mdedit → silent turn → next turn → compaction → turn after compaction.The test canonicalizes each request (cache markers removed) and asserts exactly one prefix break, at compaction.
mainDesign references
AGENTS.md:18-21), and asserts breaks withprefix_breaks(tests/e2e/core/history/_helpers.py:214). The e2e assertion here copies that shape: count breaks and allow exactly one, at compaction.packages/agent/src/agent.ts:78-87,packages/ai/src/types.ts). OpenClaw already sends in-history system updates and retained runtime context this way; the fake matrix shows that path holds on all five transports.collapseSystemMessagesrebuild (packages/ai/src/utils/transcript.ts). Rebuilding the system block on transports without mid-conversation system messages would change the prefix.Evidence
src/agents/embedded-agent-runner/replay-history.test.ts60/60.main, Chat Completions and Bedrock fail at the silent turn.cacheReadnumbers.Not in this PR
buildGoogleGeminiReplayPolicy). Removing that needs a live Gemini cache measurement.