Repository navigation
Description
[Bug] Gateway swallows user-visible reply when an agent's exec stdout matches "configuration file" — replies=2 puts ⚠️ 🛠️ first, the actual reply second
Environment
- OpenClaw version: 2026.6.10-beta.2 (this is the version we observed the bug on; we have not bisected earlier versions)
- Feishu plugin:
@openclaw/feishu@2026.6.8 - Channel: Feishu DM, single account (
feishu[tester]) - Model that produced the run:
zai/glm-5.2 - Host: macOS 15.5.0, Node v26.3.0
- Observed at: 2026-06-24 08:32–08:34 Asia/Shanghai (tester run); a second instance at 09:21–09:23 in the same DM with the same
replies=2shape
Summary
When an agent's exec step produces stdout that contains the substring configuration file at <path>, the gateway populates trace.artifacts.data.lastToolError with that stdout and sets mutatingAction: true. The turn's finalStatus is success and every item completes, but the channel still receives replies=2 — the first reply is a ⚠️ 🛠️ warning card referencing the exec step, and the second reply is the agent's actual final text.
From the user's perspective in the Feishu DM, the warning card sits above the actual reply in the conversation list. The user opens the DM, sees only the warning, and concludes the agent "errored and dropped the message" — even though the real reply IS delivered, just visually displaced.
This affects the user in two ways:
- For runs the user is waiting on (the tester's 8:32 case): the user thinks the agent errored and re-prompts, producing duplicate work and a duplicate
replies=2for the follow-up turn. - For the user's own follow-up messages in the same DM (the 9:21 case below): the user sends a short message, the agent replies with a brief text, but again
replies=2is reported, and the user only sees the warning card. The actual agent reply is delivered as the second card and is not visible at the top of the DM.
We do not have evidence yet that the second pattern is triggered by an exec step with the same stdout shape — we are reporting both instances because the observable symptom (replies=2, warning card first, real reply second) is the same. Both could plausibly be the same gateway behavior surfacing warnings for two different underlying conditions; we have not bisected to confirm.
First observed instance (08:32–08:34, tester)
During a multi-tool agent turn, one of the agent's exec steps ran cat ~/Library/Application Support/ngrok/ngrok.yml. The command succeeded and its stdout began with the literal text Valid configuration file at /Users/penny/Library/Application Support/ngrok/ngrok.yml (this is a normal ngrok startup/log message, not an error).
After the turn completed, the gateway's trace.artifacts.data.lastToolError was populated with:
{
"toolName": "exec",
"meta": "run # → print text",
"error": "Valid configuration file at /Users/penny/Library/Application Support/ngrok/ngrok.yml",
"mutatingAction": true,
"actionFingerprint": "tool=exec|meta=run # → print text"
}The turn's finalStatus was success (all 26 items started and completed). However, the Feishu channel received replies=2 from the gateway instead of replies=1. From the user's perspective in the Feishu DM, the first card was a ⚠️ 🛠️ warning referencing the cat step, and the second card was the agent's actual final reply containing the URLs the user asked for. The warning card sits above the reply in the DM list, so at a glance the user sees "agent just errored".
Second observed instance (09:21–09:23, config agent, no exec trigger found)
2026-06-24T09:21:52.156+08:00 [feishu] feishu[config]: dispatching to agent
2026-06-24T09:21:58.597+08:00 [feishu] feishu[config] Started streaming: cardId=7654766098637851612
... <agent does its work, does NOT visibly invoke an exec step with "configuration file" stdout at this point, but we have not pulled the trajectory for this run yet> ...
2026-06-24T09:23:23.211+08:00 [feishu] feishu[config]: dispatch complete (queuedFinal=true, replies=2)
2026-06-24T09:23:24.531+08:00 [feishu] feishu[config] Closed streaming
User-visible result: user only saw a ⚠️ 🛠️ card in the Feishu DM. The actual reply ("Issue #96239 created, link: ...") was the second card and was visually below the warning. We have not yet pulled the trajectory for this second run to confirm whether the same lastToolError / mutatingAction mechanism fired, or whether a different lastToolError payload was responsible. We are including this instance to demonstrate that the bug bites for short, single-shot agent replies too, not just multi-tool turns.
Gateway log excerpt (08:32 tester run)
2026-06-24T08:32:08.594+08:00 [feishu] feishu[tester]: received message from <user_id> in <chat_id> (p2p)
2026-06-24T08:32:08.631+08:00 [feishu] feishu[tester]: dispatching to agent (session=agent:tester:main)
2026-06-24T08:32:20.444+08:00 [feishu] feishu[tester] Started streaming: cardId=7654753303888907225, messageId=om_x100b6c8617f2fca0b32e362961f959a
... ~2m of exec/memory_search/gateway/process activity ...
2026-06-24T08:34:22.875+08:00 [feishu] feishu[tester]: dispatch complete (queuedFinal=true, replies=2)
2026-06-24T08:34:37.825+08:00 [feishu] feishu[tester] Closed streaming: cardId=7654753303888907225
Trajectory excerpt (08:32 tester run, 8:32:09 → 8:34:22 UTC)
trace.artifacts itemLifecycle: {startedCount: 26, completedCount: 26, activeCount: 0} — the run completed normally.
trace.artifacts toolMetas (16 entries, in order):
[0] wiki_search: 外网调试地址 远程访问
[1] memory_search: 外网调试地址 远程访问 URL
[2] gateway: gateway.externalUrl
[3] memory_search: tunnel ngrok cloudflare 外网 端口 调试
[4] exec: print text → show ~/.openclaw/config.yaml ...
[5] exec: run # -> show first 80 lines ...
[6] exec: run # → print text → run ps aux -> search "grep" ...
[7] exec: run # → print text → print text → run ps aux ...
[8] memory_search: 外网 IP 端口转发 18765 18789 公网访问 remote
[9] exec: # 查之前是否用过ngrok/cloudflared建隧道 ...
[10] exec: run # → show ~/.ngrok2/ngrok.yml ...
[11] exec: run # → print text
[12] exec: show ~/Library/Application Support/ngrok/ngrok.yml
[13] exec: # 启动 ngrok 隧道到 Polyphone 18765 ...
[14] process: crisp-coral
[15] exec: fetch http://localhost:18765/
trace.artifacts lastToolError: as shown above.
Expected behavior
- A successful agent turn (
finalStatus: success, all items completed) should produce exactly one user-visible reply card, not two. This applies to both multi-tool turns and short single-shot replies. - An
execstep that onlycats / reads a file and whose stdout happens to mention "configuration file" should not be classified as amutatingAction. The agent did not modify the file. - If a warning is generated for any reason, it should not pre-empt the agent's actual final reply in the channel card ordering.
- If the gateway cannot determine whether a tool call mutated state, the default should be "do not warn the user" rather than "warn the user with a visually-prior card".
Actual behavior
- The Feishu DM shows a
⚠️ 🛠️warning card referencing thecat ngrok.ymlstep (first instance) — and the user only sees a⚠️ 🛠️card with no obvious reason (second instance, mechanism not yet confirmed) — before the agent's actual final reply. - The gateway reports
replies=2for turns that, from the agent's perspective, completed exactly once. - In both observed instances, the user had to re-prompt the agent because they thought the reply had been lost. The re-prompt produced a second
replies=2shape, compounding the visual confusion.
Observations about the classification (first instance)
- The string
Valid configuration file at <path>in theerrorfield matches the stdout of the previousexecstep verbatim. This suggestslastToolErrormay be populating from a heuristic that scansexecstdout for substrings like "configuration file" rather than from a real tool error. mutatingAction: trueis set even though the command was a read-onlycat(no write/redirect/in-place edit verb).- The
runsucceeded —itemLifecycle.activeCount: 0andfinalStatus: "success".
We have not yet identified which subsystem of the gateway sets these fields, and we are not sure if the same code path is responsible for both populating lastToolError and emitting the ⚠️ 🛠️ warning. We are filing this with whatever concrete evidence we have.
Impact
- Data loss: None in either instance. The agent's reply is delivered, just out of order and visually buried.
- User experience: The user has to look past the warning card to find the real reply, and may re-prompt because they think the reply was lost. In both instances we observed, the user re-prompted, which produced a follow-up turn that also suffered from the same
replies=2shape. - Reproducibility: We have observed this on at least two agents (
testerandconfig) in the same Feishu DM in the same hour, with two different trigger shapes. We do not yet have a controlled reproduction script.
What we have not yet verified
- Whether this reproduces on OpenClaw versions earlier than 2026.6.10-beta.2.
- Whether the same
lastToolError/mutatingActionbehavior occurs on other channels (Discord / Telegram / WebChat). - Whether the second instance (09:21, config agent) was triggered by the same
execstdout heuristic or by a different code path. We have not yet pulled the trajectory for that run. - Whether the heuristic is specifically targeting the substring
configuration fileor something else about the exec metadata (run # → print text). - Which subsystem file/code path is responsible.
We can run additional bisects or supply more trajectory files if maintainers want to narrow this down.
Related issues (already triaged, none matched our case)
- [Bug]: Feishu: messages not delivered when blockStreamingDefault is "on" (queuedFinal=false, replies=0) #38258 (
blockStreamingDefault: "on"drops final reply): different mechanism —replies=0, no warning card. Not the same bug. - [Bug] Agent tool-chain final text segments silently dropped — invisible to user and next-turn context #76477 (tool-chain final text segments silently dropped): different symptom — text missing in WebChat and not in next-turn context. Our case delivers all text; it's just ordered wrong.
- [Bug] Feishu card action callback causes streaming reply to fail with Invalid open_message_id #56818 (card-action callback streaming reply fails):
open_message_idshape mismatch, different code path. - Feishu streaming card creation fails with HTTP 400 - missing update_multi field #68049 (streaming card creation HTTP 400 missing
update_multi): JSON 2.0 schema config, fixed in earlier versions. - [Bug]: Feishu/Lark: streaming card sessions are created even when
channels.feishu.streaming=false(final message may show only tail / truncated) #10078 (streaming=true even whenstreaming=false): config-respected, different layer. - fix #73713: surface nested embedding fetch failures #92628 (PR —
surface nested embedding fetch failures): CLI-level cause chain formatting, not gateway-runtime. Different code path.
Reporter
- OpenClaw + Feishu setup on a single Mac mini, 7 agents.
- Trajectory files retained per session under
~/.openclaw/agents/<agent>/sessions/. - Gateway log at
~/Library/Logs/openclaw/gateway.log.
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Activity
[-][Bug] Gateway sends ⚠️ 🛠️ card before final reply when exec stdout contains "configuration file"[/-][+][Bug] Gateway swallows user-visible reply when an agent's exec stdout matches "configuration file" — replies=2 puts ⚠️ 🛠️ first, the actual reply second[/+]clawsweeper commentedon Jun 24, 2026
Codex review: keeping this open for maintainer follow-up; there is still a little grit to resolve. Reviewed July 27, 2026, 11:58 AM ET / 15:58 UTC.
Summary
Keep open for maintainer follow-up. The prior review says the Feishu ordering defect was fixed in v2026.6.11, but the remaining question—when a recovered or ambiguous mutating-tool error may become a user-visible warning alongside a successful final answer—still has no current-main live trajectory or narrower canonical issue.
Reproducibility: no. high-confidence current-main live reproduction is available. The shared source path and detailed historical Feishu logs make the behavior source-reproducible, but the remaining warning trigger and its second observed shape need a redacted current-main trajectory.
Ways to help us reproduce this
Maintainer decision needed
Why: The current record supports an already-fixed Feishu ordering problem but does not establish whether the remaining visible warning is an intended safety signal or a stale recovered-error leak. That user-facing policy cannot be chosen safely from historical logs alone.
Next step
The remaining work depends on a maintainer-visible warning-policy choice and current Feishu proof; it should not enter an automated fix lane while the intended safety boundary is unresolved.
Review details
Best possible solution:
Obtain one redacted current-main trajectory that shows the warning payload and final successful answer, then make gateway emit a warning only for a confirmed terminal failure or an explicitly unrecovered mutating action; Feishu should preserve the final answer as the primary user-visible outcome.
Do we have a high-confidence way to reproduce the issue?
No high-confidence current-main live reproduction is available. The shared source path and detailed historical Feishu logs make the behavior source-reproducible, but the remaining warning trigger and its second observed shape need a redacted current-main trajectory.
Is this the best way to solve the issue?
Unclear. The shipped Feishu ordering repair appears to solve the warning-overwrites-answer portion, but the best handling of recovered or ambiguous mutating-tool warnings needs a maintainer policy decision backed by current live evidence.
AGENTS.md: found and applied where relevant.
Remaining risk / open question:
Codex review notes: model internal, reasoning high; reviewed against e79faff8aa75.
Label changes
Label justifications:
P2: The final reply is delivered but can be visually displaced by a warning, creating a normal-priority channel-delivery and trust problem rather than total loss.impact:message-loss: The warning-first presentation makes users reasonably conclude that the actual reply was dropped and can trigger duplicate prompts.impact:session-state: A retained lastToolError from tool execution is alleged to influence the terminal reply presentation after a successful run.impact:ux-friction: Affected users must search below a warning card or re-prompt to discover a final answer that was already delivered.Evidence reviewed
What I checked:
extensions/feishu/src/reply-dispatcher.ts)src/agents/pi-embedded-runner/run/payloads.ts:177, 483d7be6c40a)src/agents/pi-embedded-subscribe.handlers.tools.ts:1043, 483d7be6c40a)Likely related people:
src/agents/pi-embedded-runner/run/payloads.ts,src/agents/pi-embedded-subscribe.handlers.tools.ts,src/agents/tool-mutation.ts)src/agents/pi-embedded-runner/run/payloads.ts,src/agents/pi-embedded-runner/run/payloads.errors.test.ts)src/agents/pi-embedded-runner/run/payloads.ts,src/agents/pi-embedded-runner/run/payloads.errors.test.ts)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.openclaw-barnacle commentedon Jul 8, 2026
This issue has been automatically marked as stale due to inactivity.
Please add updates or it will be closed.
openclaw-barnacle commentedon Jul 24, 2026
This issue has been automatically marked as stale due to inactivity.
Please add updates or it will be closed.
steipete-oai commentedon Jul 29, 2026
Thank you for providing both the exact ngrok stdout and the precise replies=2 artifact. I reproduced the first, identified case end-to-end against current main on Blacksmith using the real agent loop and a real operating-system exec tool.
The actual command printed
Valid configuration file at /tmp/openclaw-s18-ngrok.yml. Its real tool_execution_end event wasstatus=completed,exitCode=0, andisError=false; the production isToolResultError classifier also returned false. The next real assistant request received the intact stdout and completed normally.I then separately injected your exact reported stale error shape (
toolName=exec, the benign configuration-file stdout,mutatingAction=true, andmeta=run # → print text) into the actual completed-turn payload builder together with a successful final reply. Current main produced exactly one reply: the real final answer. No warning card or second payload was generated. This is fixed by the generic exec-before-mutation recovery policy in f12ad4a (#103574), with channel-progress suppression covered by 127b781.All directly affected remote suites passed: 516 tests across structured tool-error classification, tool completion, final-error/recovery payloads, and the actual reply-dispatch owner. This proves the first configuration-file/exec cause, independently of Feishu rendering. I did not access a live Feishu account and the report itself says the second occurrence has no traced exec trigger, so I am not claiming to diagnose that separate observation. Closing the demonstrated exec-stdout/replies=2 defect as completed. Please reopen a separate Feishu delivery issue if a current-build trajectory proves two final deliveries without this exec error path.