Repository navigation
Conversation
…/thinking blocks The `isHeartbeatOkResponse` function was incorrectly rejecting assistant messages that contained non-text content blocks like "reasoning" or "thinking", even when the text content was a valid HEARTBEAT_OK acknowledgement. This caused heartbeat transcript filtering to fail, leaving stale heartbeat prompts and acknowledgements in the model context, leading to: - Major context size inflation - Model confusion from tool call artifacts that should have been filtered - 100% reproduction rate when heartbeat ACK contains reasoning blocks The fix removes the overly broad `hasNonTextContent` check, allowing messages with reasoning/thinking blocks to be properly evaluated for HEARTBEAT_OK content. Fixes issue openclaw#95796 ## Evidence ### Before Fix ```ts const message = { role: "assistant", content: [ { type: "reasoning", text: "Let me check..." }, { type: "text", text: "HEARTBEAT_OK" }, ], }; isHeartbeatOkResponse(message); // → false ❌ (should be true) ``` ### After Fix ```ts isHeartbeatOkResponse(message); // → true ✅ ``` ## Test Coverage Added test case verifying HEARTBEAT_OK detection works correctly with: - reasoning blocks - thinking blocks - output_text blocks (existing behavior preserved)
|
Thanks for the context here. I swept through the related work, and this is now duplicate or superseded. Close: the underlying heartbeat bug is real, but this branch removes the non-text safety guard too broadly and is superseded by the proof-positive, narrower candidate at #95798. Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Canonical path: Land one canonical narrow fix such as #95798 that ignores only model-internal reasoning blocks while preserving tool/media guards, then close the remaining duplicate candidate PRs after the linked issue is fixed. So I’m closing this here and keeping the remaining discussion on #95798. Review detailsBest possible solution: Land one canonical narrow fix such as #95798 that ignores only model-internal reasoning blocks while preserving tool/media guards, then close the remaining duplicate candidate PRs after the linked issue is fixed. Do we have a high-confidence way to reproduce the issue? Yes. Source inspection of current main shows a reasoning/thinking block sets Is this the best way to solve the issue? No. The bug should be fixed in Security review: Security review cleared: The diff only changes deterministic heartbeat message classification and colocated tests; no dependency, workflow, secret, permission, or code-execution surface changes were found. AGENTS.md: found and applied where relevant. What I checked:
Likely related people:
Codex review notes: model internal, reasoning high; reviewed against d1b917120a47. |
What Problem This Solves
Fixes a bug where heartbeat transcript filtering incorrectly preserved heartbeat prompt/ack pairs when the assistant's HEARTBEAT_OK response contained non-text content blocks like
reasoningorthinking.This caused context inflation as heartbeat artifacts were not being pruned, leading to:
Why This Change Was Made
The
isHeartbeatOkResponsefunction insrc/auto-reply/heartbeat-filter.tswas checkinghasNonTextContentand rejecting any message with non-text blocks, even if the text content was a valid HEARTBEAT_OK acknowledgment.The issue was in lines 339-342:
This check was overly broad - it should only reject messages where the non-text content is meaningful (like tool calls), not auxiliary blocks like reasoning that don't affect the semantic meaning of the HEARTBEAT_OK acknowledgment.
User Impact
hasNonTextContentcheck, allowing HEARTBEAT_OK detection to focus on the actual text contentEvidence
Before Fix
After Fix
Test Coverage
Added test case in
src/auto-reply/heartbeat-filter.test.tsverifying:reasoning+textblocks containing HEARTBEAT_OK are detectedthinking+textblocks containing HEARTBEAT_OK are detectedoutput_textblocks is preservedAll 35 tests pass.
Files Changed
src/auto-reply/heartbeat-filter.ts- Removed overly broadhasNonTextContentcheck fromisHeartbeatOkResponsesrc/auto-reply/heartbeat-filter.test.ts- Added regression tests for reasoning/thinking block scenariosCloses #95796