Repository navigation
Description
[Bug]: 2026.5.19 Discord shows failed file reads in chat
Existing issue check:
- Related open issue: Discord leaks internal tool-call traces (NO_REPLY, commentary, to=functions) to channel #44905
- Related open issue: [Bug]: Discord partial/block streaming can emit misleading mid-output fragments #78561
- Related open issue for the same class on Matrix: [Bug]: Default-mode Matrix channel rooms receive internal tool/progress events as visible chat messages #85000
- I did not find an exact open Discord issue for visible
print lines ... failedmessages from failed file reads.
Bug type
Behavior bug
Beta release blocker
No
Summary
Discord can show internal failed file-read messages such as print lines 1-220 from memory/2026-05-22.md (agent) failed or print lines 1-220 from ~/.openclaw/workspace/skills/gemini/SKILL.md (agent) failed as normal app output.
Steps to reproduce
- Run OpenClaw
2026.5.19with Discord enabled. - Start an agent turn from a Discord-delivered workflow where the agent tries to read a missing workspace file.
- In this install, the observed workflow was a scheduled Discord channel turn.
- Observe the Discord channel after the turn finishes.
Expected behavior
Discord should show the user-facing reply or job output only. Failed internal file-read attempts should stay in logs or diagnostics and should not appear as app messages in the channel.
Actual behavior
Discord showed this internal failed tool message:
⚠️ 🛠️ `print lines 1-180 from memory/2026-05-20.md (agent)` failed
The same bug is still present after upgrading to 2026.5.20:
⚠️ 🛠️ `print lines 1-220 from memory/2026-05-22.md (agent)` failed
The same visible-failure shape was also observed for a skill instruction file:
⚠️ 🛠️ `print lines 1-220 from ~/.openclaw/workspace/skills/gemini/SKILL.md (agent)` failed
OpenClaw version
2026.5.19 (a185ca2)
Operating system
macOS 26.5 (25F71)
Install method
Source checkout with pnpm build. Gateway runs from the built source checkout.
Model
openai/gpt-5.5
Provider / routing chain
Discord -> OpenClaw Gateway -> Codex runtime -> openai/gpt-5.5
Additional provider/model setup details
Relevant local config:
agents.defaults.model.primary = openai/gpt-5.5
agents.defaults.models.openai/gpt-5.5.agentRuntime.id = codex
channels.discord.streaming.mode = off
messages.groupChat.visibleReplies = message_tool
Logs, screenshots, and evidence
OpenClaw version and source state at the time of the primary observed failure:
$ openclaw --version
OpenClaw 2026.5.19 (a185ca2)
$ node --version
v22.22.3
$ git -C openclaw-src describe --tags --exact-match
v2026.5.19
$ git -C openclaw-src rev-parse --short=12 HEAD
a185ca283a74
The primary 2026.5.19 failure came from an agent attempt to read a missing memory file:
sed -n '1,220p' memory/2026-05-20.md
sed: memory/2026-05-20.md: No such file or directory
The relevant file was missing on disk:
$ ls -l ~/.openclaw/workspace/memory/2026-05-20.md
ls: ~/.openclaw/workspace/memory/2026-05-20.md: No such file or directory
A later 2026.5.20 run showed the bug is still present. Local launchd job log shows the user-facing scheduled summary followed by the failed internal read message:
**Scheduled summary: 3 item(s) need attention**
Summary body omitted here because it contains site-specific operational details.
[normal user-facing summary content]
⚠️ 🛠️ `print lines 1-220 from memory/2026-05-22.md (agent)` failed
delivered scheduled summary
Gateway log for the same event:
<timestamp> ⚠️ 🛠️ `print lines 1-220 from memory/2026-05-22.md (agent)` failed
Impact and severity
Affected: Discord channels on this install.
Severity: Medium annoyance. The main work can still complete, but Discord shows internal failed tool messages that look like app errors.
Frequency: Seen on this install across 2026.5.19 and still present in 2026.5.20, with different memory files.
Consequence: Users see noisy implementation details in chat, and routine automation or skill-backed turns can look broken even when the useful output was delivered.
Additional information
This looks related to the broader Discord internal-output leak tracked in #44905, but the visible symptom here is narrower and easy to search for: failed file reads are rendered as print lines ... failed app messages.
Local workaround for the scheduled job was to stop using an agent turn for a simple summary and send the formatted summary directly. That avoids this one job path, but it does not address Discord showing failed file-read messages from other agent turns.
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Activity
clawsweeper commentedon May 22, 2026
Codex review: keeping this open for maintainer follow-up; there is still a little grit to resolve.
Latest ClawSweeper review: 2026-05-22 10:42 UTC / May 22, 2026, 6:42 AM ET.
Workflow note: Future ClawSweeper reviews update this same comment in place.
How this review workflow works
@clawsweeper re-reviewcomments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.@clawsweeper re-reviewor@clawsweeper re-runon an open PR or issue to request a fresh review only.@clawsweeper reviewto request a fresh review only.@clawsweeper autofix,@clawsweeper automerge,@clawsweeper fix ci, or@clawsweeper address review.@clawsweeper explainto ask for more context, or@clawsweeper stopto stop active automation.Summary
Keep open: the report is source-plausible on current main because scheduled heartbeat/cron-style Discord runs do not fully reuse the group/channel visible-reply policy or model-specific runtime policy that normally keeps message-tool-only output private.
Reproducibility: yes. at source level: the reported config can bypass heartbeat message-tool-only source delivery even though normal group/channel dispatch honors it. I did not live-replay the Discord scheduled turn.
Next step
The source path is clear, but the issue is a security-sensitive Discord output leak that overlaps an existing broader leak thread, so maintainers should choose whether to fold it into that work or authorize a narrow heartbeat fix.
Security
Needs attention: The report describes internal file-read failure details leaking into a Discord channel, which is a concrete information-exposure concern.
Review details
Best possible solution:
Align heartbeat scheduled runs with the same source-reply visibility and runtime policy used for normal group/channel turns, including groupChat visibleReplies and model-specific Codex runtime overrides, then add regression coverage for Discord/channel scheduled turns with failed text-only tool progress.
Do we have a high-confidence way to reproduce the issue?
Yes at source level: the reported config can bypass heartbeat message-tool-only source delivery even though normal group/channel dispatch honors it. I did not live-replay the Discord scheduled turn.
Is this the best way to solve the issue?
No patch is proposed yet; the maintainable fix is to share or mirror the existing source visibility/runtime resolution for heartbeat runs rather than adding a Discord-only sanitizer special case.
Label changes:
P1: Internal failed tool/file-read details can leak into real Discord channels during scheduled agent workflows.impact:security: The visible failed-read messages can expose local file paths and operational context to chat participants.impact:message-loss: The issue is about internal runtime messages being delivered to the wrong user-visible channel surface.issue-rating: 🦞 diamond lobster: Current issue advisory state selects this label.clawsweeper:source-repro: Current issue advisory state selects this label.clawsweeper:no-new-fix-pr: Current issue advisory state selects this label.clawsweeper:fix-shape-clear: Current issue advisory state selects this label.clawsweeper:needs-maintainer-review: Current issue advisory state selects this label.clawsweeper:needs-security-review: Current issue advisory state selects this label.Label justifications:
P1: Internal failed tool/file-read details can leak into real Discord channels during scheduled agent workflows.impact:security: The visible failed-read messages can expose local file paths and operational context to chat participants.impact:message-loss: The issue is about internal runtime messages being delivered to the wrong user-visible channel surface.Security concerns:
src/infra/heartbeat-runner.ts:471A scheduled run can expose file paths and failed internal reads as ordinary chat messages, so the fix should be reviewed as a channel-output privacy boundary issue.
Confidence: 0.83
Acceptance criteria:
What I checked:
print lines ... failedin both v2026.5.19 and v2026.5.20, withmessages.groupChat.visibleReplies = message_tooland a model-specific Codex runtime override.messages.groupChat.visibleReplies: "message_tool"lets the agent decide when to speak by callingmessage(action=send)and keeps normal final text private when the model misses that tool. Public docs:docs/channels/groups.md. (docs/channels/groups.md:48, ff79299d68e3)messages.visibleRepliesbefore falling back tousesCodexHarness, so a group-onlymessages.groupChat.visibleRepliessetting does not by itself force heartbeat message-tool-only delivery. (src/infra/heartbeat-runner.ts:471, ff79299d68e3)sourceReplyDeliveryMode: "message_tool_only"only whenusesHeartbeatResponseToolis true, so the reported configuration can leave the dispatch-level source-suppression path disabled. (src/infra/heartbeat-runner.ts:1723, ff79299d68e3)agents.defaults.models.<model>.agentRuntime, butusesCodexHarnessin the heartbeat runner does not consult that canonical policy path. (src/agents/harness-runtimes.ts:63, ff79299d68e3)sourceReplyDeliveryModeismessage_tool_only, which matches the intended outcome for failed file-read progress. (src/auto-reply/reply/dispatch-from-config.ts:1464, ff79299d68e3)Likely related people:
src/infra/heartbeat-runner.ts,src/auto-reply/reply/source-reply-delivery-mode.ts,src/auto-reply/reply/dispatch-from-config.ts)src/infra/heartbeat-runner.ts,src/infra/heartbeat-runner.subagent-session-guard.test.ts)Remaining risk / open question:
Codex review notes: model gpt-5.5, reasoning high; reviewed against ff79299d68e3.
martingarramon commentedon May 22, 2026
Root cause confirmed on current main (
ab1fedb63f1). The gap is atsrc/infra/heartbeat-runner.ts:470-471:resolveUsesHeartbeatResponseToolreads onlymessages.visibleRepliesand notmessages.groupChat.visibleReplies. When a Discord group setsmessages.groupChat.visibleReplies: "message_tool"but leaves the globalmessages.visibleRepliesunset, the heartbeat runner falls through tousesCodexHarness(). With a non-Codex model that returnsfalse,usesHeartbeatResponseToolstaysfalseand the dispatch layer atdispatch-from-config.ts:1230never activates themessage_tool_onlysuppression gate — so failed tool-progress lines reach the channel unchanged.Minimal code change: one line at
:470to resolve the more-specific group setting first:messages.groupChat.visibleRepliesoverrides the global setting for group contexts per the JSDoc atsrc/config/types.messages.ts:107.The dispatch-level suppression at
dispatch-from-config.ts:1230already handlesmessage_tool_onlycorrectly once activated, so no change is needed there.Leaving security review to maintainers given the
clawsweeper:needs-security-reviewlabel.Test target:
src/infra/heartbeat-runner.tool-response.test.ts.neeravmakwana commentedon May 22, 2026
Opened a focused fix PR: #85357
It keeps scheduled heartbeat turns in
message_tool_onlydelivery when group/channel visible replies or model-specific Codex runtime policy require it, with redacted before/after behavior proof in the PR body.joshavant commentedon May 22, 2026
Thanks @jasonftl for the detailed report and concrete release evidence. The config snippets and visible
print lines ... failedexamples made this tractable.The bug was in the scheduled heartbeat path: it could decide whether to use heartbeat response-tool delivery before carrying forward the group/channel delivery policy and before consulting model-specific Codex runtime config. In the reported Discord setup, that meant
messages.groupChat.visibleReplies = "message_tool"and the model-specific Codex runtime override were not reliably enough to put the heartbeat turn intomessage_tool_only, so failed internal file-read/tool progress could surface as normal Discord output.PR #85357 fixed that path by making heartbeat runs honor the resolved group/channel chat type and model-specific runtime policy, reusing the existing
message_tool_onlydispatch suppression rather than adding a Discord-specific sanitizer. The issue was closed by that merged PR.We verified the fix with focused regression tests and a live AWS Crabbox Discord E2E run. The live run seeded a real Discord heartbeat session, executed
runHeartbeatOnce, read the Discord channel back through the Discord API, and confirmed the expected heartbeat message was visible while internal failed-tool markers were not leaked.Fixed by #85357, merged as bd9c78f.
fix(container): update image ghcr.io/openclaw/openclaw (2026.5.20 ➔ 2…