Repository navigation
fix(heartbeat): detect HEARTBEAT_OK through reasoning/thinking blocks - #96356
moguangyu5-design wants to merge 1 commit into
Conversation
isHeartbeatOkResponse previously rejected any assistant message with non-text content, so a HEARTBEAT_OK ack paired with a reasoning or thinking block was preserved as a normal turn. Treat thinking and redacted_thinking blocks as silent internal content so the text ack can still be recognized and the heartbeat span stripped. Fixes openclaw#95796
|
Thanks for the context here. I swept through the related work, and this is now duplicate or superseded. Close: this PR targets a real heartbeat transcript-filter bug, but it is superseded by the open proof-positive candidate at #95798, which covers the reported Canonical path: Close this branch and keep the landing discussion on #95798 as the canonical narrow heartbeat-filter fix. So I’m closing this here and keeping the remaining discussion on #95798. Review detailsBest possible solution: Close this branch and keep the landing discussion on #95798 as the canonical narrow heartbeat-filter fix. Do we have a high-confidence way to reproduce the issue? Yes. Source inspection shows an assistant content array with a Is this the best way to solve the issue? No. The classifier layer is the right fix location, but this branch is not the best landing path because #95798 covers Security review: Security review cleared: Cleared: the diff only changes deterministic heartbeat message classification and colocated tests, with no dependency, workflow, secret, or code-execution surface changes. AGENTS.md: found and applied where relevant. What I checked:
Likely related people:
Codex review notes: model internal, reasoning high; reviewed against c6ade83a5ccb. |
What Problem This Solves
Fixes #95796. When the assistant's heartbeat acknowledgement contains silent reasoning/thinking content blocks alongside
HEARTBEAT_OK,isHeartbeatOkResponserejected the whole message as non-text and the heartbeat span was not stripped from the transcript. This inflated context and could confuse the model on the next turn.Why This Change Was Made
resolveMessageTextflagged any block other thantext/input_text/output_textas non-text. Reasoning/thinking blocks are internal model output, not meaningful user-visible content, so they should not prevent a plainHEARTBEAT_OKack from being recognized.User Impact
Heartbeat prompts/acks are now correctly pruned when the model emits reasoning/thinking blocks, keeping the transcript clean and reducing context noise.
Evidence
src/auto-reply/heartbeat-filter.test.tscoveringthinking,redacted_thinking, and mixed tool-use cases.pnpm exec vitest run src/auto-reply/heartbeat-filter.test.tspasses (35/35).pnpm exec oxfmt --check src/auto-reply/heartbeat-filter.ts src/auto-reply/heartbeat-filter.test.tspasses.pnpm exec oxlint --tsconfig config/tsconfig/oxlint.core.json src/auto-reply/heartbeat-filter.ts src/auto-reply/heartbeat-filter.test.tspasses.🤖 This PR includes code generated by an AI assistant.