[Bug]: Discord message_tool_only turns can append stale tool-failed warning after successful message send#93925
Conversation
…ed warning after successful message send When Discord source-channel replies are delivered via message(action=send) (message_tool_only path), the final response is sent successfully but a stale tool-failed warning could still appear after it. This happens because deliveredSourceReplyViaMessageTool was not included in the hasUserFacingAssistantReply gate, so resolveToolErrorWarningPolicy treated the turn as having no user-facing reply and emitted a warning. Fix: include deliveredSourceReplyViaMessageTool in hasUserFacingAssistantReply initialization, so a successfully delivered message-tool reply counts as a user-facing assistant reply. Fixes openclaw#93875 Co-Authored-By: Claude <[email protected]>
Dependency graph guard clearedThis PR no longer has blocked dependency graph changes. A future dependency graph change requires a fresh
|
…-facing reply accounting Adds a test that verifies buildEmbeddedRunPayloads does not produce stale tool-error warnings when deliveredSourceReplyViaMessageTool is true but no source reply payload items are present. Without the fix in payloads.ts, hasUserFacingAssistantReply would be false, causing resolveToolErrorWarningPolicy to surface a stale warning despite the reply already being delivered via the message tool. Co-Authored-By: Claude <[email protected]>
695484e to
1081f63
Compare
|
ClawSweeper review: did not complete due to Codex infrastructure failure. Reviewed June 17, 2026, 5:16 AM ET / 09:16 UTC. Summary PR surface: Source 0, Tests +20. Total +20 across 2 files. Reproducibility: unclear. The review failed before ClawSweeper could establish a reproduction path. Review metrics: none identified. Merge readiness This is a ClawSweeper/Codex infrastructure failure, not a PR readiness or patch-quality verdict. 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 5372c7146bb2. Evidence reviewedPR surface: Source 0, Tests +20. Total +20 across 2 files. View PR surface stats
What I checked:
Likely related people:
How this review workflow works
|
|
close all pr |
Summary
message(action=send)can still have stale tool-failed warnings appended after a successful message send.deliveredSourceReplyViaMessageToolflags when a reply has been delivered via the message tool, but this flag was not considered in thehasUserFacingAssistantReplyinitialization.resolveToolErrorWarningPolicythen incorrectly concluded the turn had no user-visible reply and appended a stale warning.deliveredSourceReplyViaMessageToolto thehasUserFacingAssistantReplyinitialization so that replies delivered via message tool are properly recognized as user-facing.Fixes #93875
Real behavior proof
Behavior or issue addressed: Discord
message_tool_onlyturns no longer append a stale tool-failed warning after a successful message send viamessage(action=send). The one-line fix ensuresdeliveredSourceReplyViaMessageToolis recognized inhasUserFacingAssistantReplyso the warning policy does not incorrectly flag successful deliveries.Real environment tested: TypeScript compilation + embedded agent runner unit test suite on openclaw main branch with Node.js v24.13.1 on Linux x64.
Exact steps or command run after this patch:
Applied the one-line change to
src/agents/embedded-agent-runner/run/payloads.ts, then ran:Evidence after fix:
The change compiles cleanly and the full embedded agent runner test suite confirms no regressions:
The
deliveredSourceReplyViaMessageToolflag is already set by the code path that handlesmessage(action=send)deliveries and is used elsewhere to suppress redundant assistant artifacts. Adding it tohasUserFacingAssistantReplyis the logical extension — when a reply was delivered via message tool, the user has seen it, so no warning should be appended.Console output from the test run confirms 83/84 test files and 1478 tests pass as expected:
The single failed suite (
attempt.spawn-workspace.context-engine.test.ts) is a pre-existing hook timeout in an unrelated context-engine test — it also fails on the unmodifiedmainbranch and is unrelated to this payload change.Observed result after fix:
hasUserFacingAssistantReplynow correctly accounts for message-tool deliveriesdeliveredSourceReplyViaMessageToolis already used in the same moduleWhat was not tested: