fix(heartbeat): skip reasoning payloads when includeReasoning is false (#92260)#92262
fix(heartbeat): skip reasoning payloads when includeReasoning is false (#92260)#92262liuhao1024 wants to merge 1 commit into
Conversation
…ad when includeReasoning is false resolveHeartbeatReplyPayload picks the last outbound-capable payload but never checked the isReasoning flag. When a reasoning model (e.g. xai/grok) places a reasoning payload after the final text payload, it was selected as the heartbeat reply and delivered to the channel — even with includeReasoning: false. Add an optional includeReasoning option to resolveHeartbeatReplyPayload. When false, reasoning payloads (isReasoning === true) are skipped. The heartbeat runner now computes includeReasoning before calling the function and passes it through. Fixes openclaw#92260
|
Codex review: needs real behavior proof before merge. Reviewed June 11, 2026, 4:52 PM ET / 20:52 UTC. Summary PR surface: Source +16, Tests +84. Total +100 across 4 files. Reproducibility: unclear. The review failed before ClawSweeper could establish a reproduction path. Review metrics: none identified. 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
Review detailsBest possible solution: Retry the Codex review after fixing the execution failure. Do we have a high-confidence way to reproduce the issue? Unclear. The review failed before ClawSweeper could establish a reproduction path. Is this the best way to solve the issue? Unclear. Retry the review first so ClawSweeper can evaluate the actual issue and fix direction. AGENTS.md: unclear because the file could not be read completely. Codex review notes: model internal, reasoning high; reviewed against 9827490f5f73. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source +16, Tests +84. Total +100 across 4 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
|
|
Closing this PR — received |
What does this PR do?
Fixes
resolveHeartbeatReplyPayloadto skip reasoning/thinking payloads whenincludeReasoningis false, preventing the heartbeat from delivering internal model reasoning as a user-visible channel message.Related Issue
Fixes #92260
Type of Change
Changes Made
src/auto-reply/heartbeat-reply-payload.ts: Added optionalincludeReasoningoption toresolveHeartbeatReplyPayload. Whenfalse, payloads withisReasoning === trueare skipped during selection.src/infra/heartbeat-runner.ts: MovedincludeReasoningcomputation before theresolveHeartbeatReplyPayloadcall and passes it through.src/plugin-sdk/reply-runtime.ts: Added type export forResolveHeartbeatReplyPayloadOptions.src/auto-reply/heartbeat-reply-payload.test.ts: Added 12 test cases covering reasoning payload skipping, backward compatibility, and edge cases.How to Test
node scripts/run-vitest.mjs run src/auto-reply/heartbeat-reply-payload.test.tsnode scripts/run-vitest.mjs run src/plugin-sdk/reply-payload.test.tsReal behavior proof
Behavior or issue addressed:
resolveHeartbeatReplyPayloaditerates reply payloads in reverse and returns the last one with outbound content. It never checkedisReasoning, so when a reasoning model (e.g.xai/grok-4.3) places a reasoning payload after the final text payload, the reasoning text was selected as the heartbeat reply and delivered to the channel — even whenincludeReasoningisfalse.Real environment tested:
macOS, Node.js v22, vitest 4.1.7
Exact steps or command run after the patch:
Evidence after fix:
Observed result after fix:
Reasoning payloads are correctly skipped when
includeReasoningis false. The fix is backward-compatible — existing callers without the options parameter retain the previous behavior.What was not tested:
Full OpenClaw gateway with a live reasoning model (e.g. xai/grok). The fix is verified via focused unit tests on the payload selection logic.
Checklist