Repository navigation
fix(agents): drop orphaned thinking blocks when NO_REPLY text leaves an assistant message with only thinking content (#99620) - #99772
Conversation
|
Codex review: needs maintainer review before merge. Reviewed July 17, 2026, 2:18 AM ET / 06:18 UTC. Summary PR surface: Source +32, Tests +121. Total +153 across 2 files. Reproducibility: yes. at high confidence from source and payload construction: current behavior leaves an adjacent thinking-only assistant turn after NO_REPLY cleanup, and the linked production report demonstrates Anthropic rejecting the resulting merged shape. A fresh live Anthropic run was not performed on this head. Review metrics: 2 noteworthy metrics.
Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Risk before merge
Maintainer options:
Next step before merge
Maintainer decision needed
Security Review detailsBest possible solution: Have the replay-policy owner explicitly confirm that a silent assistant turn retaining only thinking-family blocks has no cross-provider replay value, then land this narrow guard and tests; if that invariant is rejected, move equivalent cleanup behind the Anthropic-family replay policy without adding configuration. Do we have a high-confidence way to reproduce the issue? Yes at high confidence from source and payload construction: current behavior leaves an adjacent thinking-only assistant turn after NO_REPLY cleanup, and the linked production report demonstrates Anthropic rejecting the resulting merged shape. A fresh live Anthropic run was not performed on this head. Is this the best way to solve the issue? Unclear pending one ownership decision: the predicate and preservation tests are narrow, but maintainers must confirm that generic deletion is preferable to an Anthropic-family policy rule. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 03d287d11138. Label changesLabel justifications:
Evidence reviewedPR surface: Source +32, Tests +121. Total +153 across 2 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
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. How this review workflow works
Review history (15 earlier review cycles; latest 8 shown)
|
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
Please don’t spam-ping multiple maintainers at once. Be patient, or join our community Discord for help: https://discord.gg/clawd |
|
@clawsweeper re-review |
|
Thank you for the thorough review. I've updated the PR body with a detailed request-builder payload comparison showing the before-fix vs after-fix message structure using OpenClaw's own normalization pipeline. On the live Anthropic round-trip proof: I do not have a thinking-enabled Anthropic API key to run the live verification. The script The payload-structure evidence in the PR body demonstrates the fix at the request-builder level using the same code paths that the Anthropic provider serializer uses in production. The before-fix payload shape ( @clawsweeper re-review |
72ef76b to
309f2a0
Compare
|
Rebased on latest Test results after rebase:
Let's see if the QA Smoke CI passes now. |
|
Fixed the metadata-stripped silent-text gap found by ClawSweeper review (P2). When Changes:
Test results: 33 passed (29 original + 3 from PR + 1 new) ✓ @clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
P3 finding fixed: transcript-hygiene rule documented at replay-history.ts:267-283. Rebased on latest main, 40 tests passing. @clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
P2 finding fixed: unknown/primitive content blocks now return @clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
Prevent NO_REPLY cleanup from leaving signed reasoning that merges into the next assistant tool-use turn and bricks strict-provider sessions. Related: openclaw#99620 Co-authored-by: SunnyShu <[email protected]>
9e01c85 to
d66b0ad
Compare
|
ClawSweeper status: review started. I am starting a fresh review of this pull request: fix(agents): drop orphaned thinking blocks when NO_REPLY text leaves an assistant message with only thinking content (#99620) This is item 1/1 in the current shard. Shard 0/1. This placeholder means the worker is alive and reading the current context. I will edit this same comment with the actual review when the claws are done clicking. Crustacean status: shell secured, claws on keyboard, evidence pebbles being sorted. |
Regenerate the docs map after documenting silent reasoning-only replay cleanup. Co-authored-by: SunnyShu <[email protected]>
|
ClawSweeper status: review started. I am starting a fresh review of this pull request: fix(agents): drop orphaned thinking blocks when NO_REPLY text leaves an assistant message with only thinking content (#99620) This is item 1/1 in the current shard. Shard 0/1. This placeholder means the worker is alive and reading the current context. I will edit this same comment with the actual review when the claws are done clicking. Crustacean status: shell secured, claws on keyboard, evidence pebbles being sorted. |
|
Maintainer pre-merge verification for
Known proof gap: a fresh live Anthropic rerun was attempted, but the Testbox Actions key was unavailable and no provider call ran. The linked issue provides direct production/API evidence that the merged shape returns HTTP 400 and the separated shape returns HTTP 200. Reviewed source head: 68b1966 |
|
Merged via squash.
|
…an assistant message with only thinking content (openclaw#99620) (openclaw#99772) * fix(agents): drop silent reasoning-only replay turns Prevent NO_REPLY cleanup from leaving signed reasoning that merges into the next assistant tool-use turn and bricks strict-provider sessions. Related: openclaw#99620 Co-authored-by: SunnyShu <[email protected]> * docs: refresh transcript hygiene map Regenerate the docs map after documenting silent reasoning-only replay cleanup. Co-authored-by: SunnyShu <[email protected]> --------- Co-authored-by: Peter Steinberger <[email protected]>
Closes #99620
What Problem This Solves
Fixes an issue where a silent
NO_REPLYassistant turn could retain only signed thinking after replay cleanup. When the next turn used a tool, Anthropic turn validation merged both assistant rows into one[thinking, thinking, tool_use]message and the provider rejected every subsequent request, leaving the session stuck until reset.Why This Change Was Made
Replay normalization now records when it removes silent text and drops the assistant row only when the remaining content is exclusively thinking or redacted-thinking blocks. It reuses the existing reasoning-only classifier; visible text, tool calls, primitive blocks, and unknown blocks remain unchanged. The global transcript-hygiene reference documents the new boundary.
This is the generic boundary because
NO_REPLYis an OpenClaw-wide silent-turn contract. No provider config, compatibility shim, or second replay path is added.User Impact
Affected sessions can rebuild context after a silent yield and continue normally instead of entering a permanent Anthropic HTTP 400 loop. Ordinary replies and silent turns that carry tool or unknown content are unchanged.
Evidence
node scripts/run-vitest.mjs src/agents/embedded-agent-runner/replay-history.test.ts— 42 passed.node scripts/run-vitest.mjs src/agents/embedded-agent-helpers.validate-turns.test.ts src/agents/embedded-agent-runner/thinking.test.ts— 33 + 47 passed.tbx_01ky1rcvtmq5k0j5jkvtj78dj0: https://github.com/openclaw/openclaw/actions/runs/29809708167Credit
Maintainer rewrite of the fix contributed by SunnyShu (@SunnyShu0925). The landed commit preserves
Co-authored-by: SunnyShu <[email protected]>.AI-assisted: yes; the human maintainer reviewed the full replay, validation, provider, test, and documentation surfaces.