Repository navigation
Conversation
…mode When messages.visibleReplies is set to "message_tool", the heartbeat run forces the heartbeat response tool and sourceReplyDeliveryMode= message_tool_only. If the model returns plain final text without calling heartbeat_respond, that private text leaked to the channel, bypassing the configured privacy mode. Treat the no-tool-call fallback as a silent heartbeat ack instead of delivering the raw text. Scope is limited to the explicit visibleReplies="message_tool" opt-in so the Codex-harness default (which also forces the tool but expects plain-text fallback delivery) is unchanged. Notices marked deliverDespiteSourceReplySuppression and relayable exec-completion events are still delivered. Closes openclaw#94053
5bfeb52 to
1a5fb44
Compare
|
Codex review: needs maintainer review before merge. Reviewed July 16, 2026, 1:26 AM ET / 05:26 UTC. Summary PR surface: Source +82, Tests +44. Total +126 across 2 files. Reproducibility: yes. at high confidence. The linked issue supplies deterministic steps and logs, while the contributor's standalone production-runner script records one outbound send before the patch and zero after it; current-main drift should still be checked after rebase. Review metrics: none identified. Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Mantis proof suggestion Risk before merge
Maintainer options:
Next step before merge
Maintainer decision needed
Security Review detailsBest possible solution: Rebase onto current main, retain the explicit message-tool-only suppression with the notice and exec-relay exceptions plus metadata-only preview, rerun focused heartbeat coverage, and land this as the canonical fix for the linked issue. Do we have a high-confidence way to reproduce the issue? Yes at high confidence. The linked issue supplies deterministic steps and logs, while the contributor's standalone production-runner script records one outbound send before the patch and zero after it; current-main drift should still be checked after rebase. Is this the best way to solve the issue? Yes. Handling the exception in the heartbeat runner is the narrowest maintainable fix because that path resolves and durably delivers its own payloads rather than relying entirely on the normal reply dispatcher; the patch also preserves the existing notice and exec-relay escape hatches. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 9f5609382b54. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source +82, Tests +44. Total +126 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
|
|
Nice implementation! I appreciate the clear commit messages and focused changes. |
|
This pull request has been automatically marked as stale due to inactivity. |
|
Still relevant and ready for review. This keeps a non-empty no-tool heartbeat final reply off the source channel in |
…preview Addresses ClawSweeper P1: the message_tool_only no-tool suppression path copied the private reply text into emitHeartbeatEvent.preview, which is stored as lastHeartbeat, broadcast to gateway subscribers, returned by last-heartbeat, and rendered in the Debug view. Replace with a metadata-only marker so the off-channel reply is not exposed via operator status surfaces. Regression test asserts Telegram is not called and getLastHeartbeatEvent() does not carry the private final text.
|
Addressed the review point: pushed a commit that redacts the suppressed private final text from the heartbeat event preview on the Added regression coverage in |
|
Thank you, @Bartok9, for the detailed privacy analysis and Telegram regression coverage. Closing as already fixed on current |
Summary
messages.visibleReplies: "message_tool"is configured, a heartbeat that returns plain final text without callingheartbeat_respondno longer leaks that text to the channel.message_tool_onlyprivacy contract.Motivation
Closes #94053.
With
visibleReplies: "message_tool", the heartbeat runner forces the heartbeat response tool and passessourceReplyDeliveryMode: "message_tool_only"to the agent. The privacy contract is that nothing user-facing reaches the channel unless the model surfaces it viaheartbeat_respond.But if the model returned plain final text and did not call the tool,
heartbeatToolResponsewasundefinedand the runner fell through tonormalizeHeartbeatReply()→ durable channel delivery. Any final text whoseHEARTBEAT_OKtoken wasn't at an edge (so it survived stripping) was delivered to the Telegram DM/channel — exactly the leak in the issue's log:The first line says it was kept private; the second line shows it was sent anyway.
Fix
After resolving the reply payload, if the run forces the response tool and the operator explicitly opted into
visibleReplies: "message_tool", and the model returned outbound text without a tool response, treat it as a silent heartbeat ack (restoreupdatedAt, optionally emit the OK token, mark commitments, returnran) instead of delivering the raw text.Two payloads are still delivered to preserve existing behavior:
deliverDespiteSourceReplySuppression(e.g. Codex runtime usage-limit / failure notices), andScope is intentionally limited to the explicit
message_toolopt-in. The Codex-harness default also forces the response tool but expects plain-text fallback delivery, so its behavior is unchanged (verified by the existing tool-response and default-unset suites).Real behavior proof
Behavior addressed: with
visibleReplies: "message_tool", a heartbeat whose final reply is plain text (noheartbeat_respondcall) containingHEARTBEAT_OKmid-string was delivered to the Telegram channel. After the fix that private text is suppressed and the run still completes as a silent ack.Real environment tested: node v25.5.0 on macOS (Darwin arm64), this branch rebased on
openclaw/main. The shippedrunHeartbeatOncefromsrc/infra/heartbeat-runner.tswas driven directly via a standalonetsxscript (no test framework / no mocking library) against a real on-disk session store under a temp dir; only the leaf Telegram send was a plain recorder so channel delivery could be observed.Exact steps or command run after this patch:
sessions.jsonwithlastChannel/lastProvider/lastTopointing at a Telegram group.messages.visibleReplies: "message_tool".getReplyFromConfigthat returns plain final text (noheartbeat_respondcall) withHEARTBEAT_OKmid-string.node_modules/.bin/tsx .tmp-heartbeat-proof.mts→ callrunHeartbeatOnce({ cfg, deps })and record every Telegram send.openclaw/mainto capture the pre-fix behavior.Evidence after fix: live captured stdout from the shipped runner (private text NOT delivered):
Observed result after fix:
runHeartbeatOncereturnedstatus=ranand the recorder captured 0 Telegram sends — the private text never reached the channel. Re-running the same script withsrc/infra/heartbeat-runner.tsreverted toopenclaw/mainreproduced the original leak live:So the same shipped code path leaks before the patch and is silent after it.
What was not tested: delivery through a live Telegram API endpoint (the runner's channel-plugin send seam was exercised with a recorder rather than real credentials); the Codex-harness plain-text fallback path is intentionally unchanged and is covered by the existing default-unset and tool-response suites.
Supplemental automated checks
npx vitest run src/infra/heartbeat-runner.tool-response.test.ts— 16 passed (15 existing + 1 new regression assertingsendTelegramis not called inmessage_tool_onlymode).npx vitest run src/infra/heartbeat-runner.returns-default-unset.test.ts src/infra/heartbeat-runner.ghost-reminder.test.ts src/infra/heartbeat-runner.skips-busy-session-lane.test.ts src/infra/heartbeat-runner.commitments.test.ts src/infra/heartbeat-runner.respects-ackmaxchars-heartbeat-acks.test.ts src/infra/heartbeat-runner.scheduler.test.ts— all pass (no regression in default / Codex-harness / commitment paths).npx oxlint+npx oxfmton both changed files — clean.