Skip to content

fix(heartbeat): recognize HEARTBEAT_OK through reasoning blocks (fixes #95796) - #95965

Closed
ztexydt-cqh wants to merge 1 commit into
openclaw:mainfrom
ztexydt-cqh:fix/issue-95796-heartbeat-ok-reasoning-blocks
Closed

ztexydt-cqh wants to merge 1 commit into
openclaw:mainfrom
ztexydt-cqh:fix/issue-95796-heartbeat-ok-reasoning-blocks

Conversation

@ztexydt-cqh

Copy link
Copy Markdown
Contributor

What Problem This Solves

isHeartbeatOkResponse rejected heartbeat acknowledgements whenever the assistant message contained a non-text block such as reasoning or thinking, even when the visible text was just HEARTBEAT_OK. This caused filterHeartbeatTranscriptArtifacts to leave heartbeat prompt/ack pairs in the transcript, inflating context and confusing the model.

Why This Change Was Made

resolveMessageText treated every block other than text/input_text/output_text as non-text content and made isHeartbeatOkResponse bail out. Reasoning/thinking blocks are internal model artifacts, not user-visible content, so they should not prevent pruning a short HEARTBEAT_OK ack.

User Impact

Users with models that emit reasoning/thinking blocks during heartbeat responses will no longer see those transient turns accumulate in the conversation context.

Evidence

  • Added unit tests in src/auto-reply/heartbeat-filter.test.ts covering reasoning and thinking blocks paired with HEARTBEAT_OK.
  • Existing tests continue to reject tool-call-only and meaningful non-heartbeat responses.
  • pnpm test src/auto-reply/heartbeat-filter.test.ts --run passes locally.

@ztexydt-cqh
ztexydt-cqh force-pushed the fix/issue-95796-heartbeat-ok-reasoning-blocks branch from 8a72730 to 468bfc2 Compare June 23, 2026 07:14
@ztexydt-cqh ztexydt-cqh changed the title fix(auto-reply): recognize HEARTBEAT_OK through reasoning blocks (fixes #95796) fix(heartbeat): recognize HEARTBEAT_OK through reasoning blocks (fixes #95796) Jun 23, 2026
@clawsweeper

clawsweeper Bot commented Jun 23, 2026 •

Copy link
Copy Markdown
Contributor

Thanks for the context here. I swept through the related work, and this is now duplicate or superseded.

Close as superseded: the bug is real, but this branch is a narrower duplicate of #95798, which is open, mergeable, proof-positive, and covers the same heartbeat ACK path plus the redacted_thinking block shape this PR misses.

Root-cause cluster
Relationship: superseded
Canonical: #95798
Summary: This PR is one of several candidate fixes for the same heartbeat reasoning-block ACK pruning bug; the open candidate at #95798 is the stronger proof-positive canonical landing path.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Canonical path: Close this duplicate and land one canonical heartbeat-filter fix via #95798, then close the linked bug report and remaining duplicate candidates after the fix lands.

So I’m closing this here and keeping the remaining discussion on #95798.

Review details

Best possible solution:

Close this duplicate and land one canonical heartbeat-filter fix via #95798, then close the linked bug report and remaining duplicate candidates after the fix lands.

Do we have a high-confidence way to reproduce the issue?

Yes. Source inspection shows a reasoning/thinking block makes current-main resolveMessageText set hasNonTextContent, causing isHeartbeatOkResponse to reject an otherwise short HEARTBEAT_OK ACK before transcript pruning.

Is this the best way to solve the issue?

No. This PR touches the right classifier layer, but the better solution is the canonical open PR that also covers redacted_thinking, transcript-span pruning, and the tool-use boundary with real before/after proof.

Security review:

Security review cleared: The diff only changes deterministic heartbeat message classification and colocated tests, with no dependency, workflow, secret, permission, or code-execution surface changes.

AGENTS.md: found and applied where relevant.

What I checked:

Likely related people:

  • nxmxbbd: GitHub PR metadata and the merged commit subject tie this handle to the heartbeat transcript pruning replacement that added heartbeat-filter.ts and its initial tests. (role: introduced behavior; confidence: high; commits: 57f9f0a08dd7; files: src/auto-reply/heartbeat-filter.ts, src/auto-reply/heartbeat-filter.test.ts)
  • obviyus: GitHub metadata for the merged heartbeat transcript pruning replacement lists this handle as the merger of the PR that introduced the relevant filter path. (role: merger and adjacent owner; confidence: medium; commits: 57f9f0a08dd7; files: src/auto-reply/heartbeat-filter.ts, src/auto-reply/heartbeat-filter.test.ts)
  • lin-hongkuan: Current-main blame for the classifier region is attributed to a recent broad commit that reintroduced the current file snapshot, so this is a weak current-file routing signal. (role: recent current snapshot contributor; confidence: low; commits: 67118d5ab912; files: src/auto-reply/heartbeat-filter.ts, src/auto-reply/heartbeat-filter.test.ts)
  • hanZeng-08: This handle owns the open canonical candidate PR with broader reasoning/thinking/redacted_thinking coverage and sufficient before/after proof for the same bug. (role: likely follow-up owner; confidence: medium; commits: 034787c9a890; files: src/auto-reply/heartbeat-filter.ts, src/auto-reply/heartbeat-filter.test.ts)

Codex review notes: model internal, reasoning high; reviewed against d1b917120a47.

@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. labels Jun 23, 2026
@steipete steipete closed this Jul 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. size: XS status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants