Repository navigation
Description
Bug type
Behavior bug (incorrect output/state without crash)
Beta release blocker
No
Summary
When an embedded run times out after partially completing real work, OpenClaw can deliver an aborted partial assistant message to the user-facing channel instead of a clean timeout/error response. In my repro, internal commentary text and a reply directive leaked into a Feishu DM.
Steps to reproduce
- Run OpenClaw
2026.4.1with Feishu connected. - In a normal
mainagent session, trigger a longer multi-step task that:- reads memory/session state
- performs several tool/exec steps
- then prepares a final user-facing summary
- Let the run reach the embedded timeout path.
- Observe logs showing:
embedded run timeoutembedded_run_failover_decision ... decision=surface_error reason=timeout
- Observe the channel user receives a partial assistant reply that includes internal-looking text instead of only a clean failure/degraded response.
Expected behavior
After timeout/abort, the user-facing channel should receive either:
- a clean synthesized timeout/degraded response, or
- a clean partial completion summary written for the user
It should never deliver:
- commentary-phase text
- internal drafting notes
- reply directives such as
[[reply_to_current]] - truncated half-finished assistant output
Actual behavior
In my Feishu repro, the run partially succeeded, then timed out, and OpenClaw delivered an aborted assistant message containing internal text.
Observed leaked content included:
Need answer concise mention not fully E2E tested tomorrow.[[reply_to_current]]
The leaked message was recorded in the session JSONL as an aborted assistant response, not as a clean final user reply.
OpenClaw version
2026.4.1
Operating system
Ubuntu Linux (Tencent Cloud server)
Install method
npm / pnpm global install
Model
openai-codex/gpt-5.4
Provider / routing chain
openclaw -> gateway embedded agent runtime -> Feishu channel delivery
Additional provider/model setup details
- Repro happened in a Feishu DM with the
main/ CEO-style agent. - The same run had already completed meaningful work before timeout.
- This does not look Feishu-only from prior issue history; Feishu is just the channel used in this repro.
- Logs suggest the problem is in the embedded timeout / abort / final-delivery path, not in business logic of the task itself.
Logs, screenshots, and evidence
Gateway/session evidence from my environment:
Session file:
`/root/.openclaw/agents/main/sessions/b2253668-a725-4944-9ace-e50ae7e8ab7a.jsonl`
Relevant entries:
- an `openclaw:prompt-error` with `error: "request timed out"`
- immediately followed by an assistant message with:
- commentary-phase text:
`Need answer concise mention not fully E2E tested tomorrow.`
- and visible reply directive text:
`[[reply_to_current]] ...`
- the assistant message has `stopReason: "aborted"` and `errorMessage: "This operation was aborted"`
Representative log sequence:
- `embedded run timeout`
- `embedded_run_failover_decision ... decision=surface_error reason=timeout`
- channel dispatch completes and the user sees the bad partial reply
This suggests the aborted partial assistant payload was still eligible for delivery.Impact and severity
Affected:
- user-facing messaging channels when an embedded run times out after partial progress
Severity:
- High for UX / trust; users can see internal commentary or half-finished content
Frequency:
- Intermittent / edge-case, but reproducible under longer multi-step runs that hit timeout
Consequence:
- confusing user-visible garbage
- loss of trust in the assistant
- unclear whether the task actually succeeded
- channel users may see internal framework-only text that should never surface
Additional information
This looks related to other timeout / delivery / leakage bugs in OpenClaw, for example:
- Text between tool calls leaks to messaging channels #25592
- Bug: raw internal tool/runtime errors leak into chat as user-visible replies #51149
- [Bug]: Control UI chat can stay stuck on "Stop" after embedded run timeout on Windows #42011
- Agent run timeout during tool execution misclassified as LLM timeout, triggers unnecessary model fallback #52147
My repro is specifically about:
- timeout/abort
- aborted partial assistant content
- commentary/internal text leaking to the user-facing channel
Suggested fix
A likely fix would be one or both of:
- On timeout/abort, discard commentary-phase / internal partial assistant blocks before channel delivery.
- If
surface_erroris chosen after timeout, prefer a clean synthesized user-facing error/degraded response over any aborted partial assistant payload.
A regression test could assert that after an embedded timeout:
- no
phase="commentary"text is delivered to the channel - no
[[reply_to_current]]or other internal directive tags reach the final user-visible message
log:
2026-04-02T14:57:36+08:00 [agent/embedded] embedded run timeout: runId= sessionId= timeoutMs=
2026-04-02T14:57:36+08:00 [agent/embedded] embedded_run_failover_decision: stage=assistant decision=surface_error failoverReason=timeout timedOut=true aborted=true
2026-04-02T14:57:36+08:00 [session] openclaw:prompt-error error="request timed out"
2026-04-02T14:57:36+08:00 [session] aborted assistant response contained leaked text:
- "Need answer concise mention not fully E2E tested tomorrow."
- "[[reply_to_current]] ..."
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Activity
mbelinky commentedon Apr 5, 2026
Related update: #61282 is now merged in commit 4175cae.
What #61282 fixes:
Why this issue stays open:
[[reply_to_current]]on the timeout /surface_errorpath.Leaving this issue open for the timeout/abort-specific remainder.
miguelmanlyx commentedon Apr 5, 2026
Looks like this looks like a timeout problem on ai api. Maybe try npx ai-doctor. It can fix missing timeout guards with safe request timeouts plus timeout and retry protection.
steipete commentedon Apr 25, 2026
Closing this as implemented after Codex review.
Current
mainsuppresses commentary-phase partials before channel delivery, strips[[reply_to_current]]/other reply directives from visible outbound text, and synthesizes a clean timeout error when a timed-out embedded run has no safe assistant payload. The timeout/abort remainder called out after #61282 appears covered onmainand shipped inv2026.4.7.What I checked:
handleMessageUpdateresolves assistant phase, returns early forcommentary, and never flushestext_endblock replies for that phase. (src/agents/pi-embedded-subscribe.handlers.messages.ts:457, ec3dbd22a4de)text_delta/text_endupdates, including phase carried only intextSignaturemetadata. (src/agents/pi-embedded-subscribe.handlers.messages.test.ts:414, ec3dbd22a4de)buildEmbeddedRunPayloadsderives answer text fromextractAssistantVisibleText(...)/final_answerand parses reply directives before emitting payload text; the matching test expects no payload when only commentary text exists andDone.when afinal_answerblock exists. (src/agents/pi-embedded-runner/run/payloads.ts:233, ec3dbd22a4de)parseReplyDirectivesremoves reply tags from text while preserving reply metadata, and reply-tag tests verify[[reply_to_current]]\nHellois delivered as textHellowithreplyToCurrent=trueinstead of leaking the directive. (src/auto-reply/reply/reply-directives.ts:16, ec3dbd22a4de)run.tsexplicitly returns an error payload with timeout text whentimedOut && !timedOutDuringCompaction && !payloadsWithToolMedia.length, and timeout-compaction tests assert the returned payload is an error containingtimed out. (src/agents/pi-embedded-runner/run.ts:1776, ec3dbd22a4de)v2026.4.5notes the earlier#61282commentary buffering fix, whilev2026.4.7adds the later#61829/related history-and-replies hardening that matches the issue comment saying#61282was only partial. (CHANGELOG.md:1130, ec3dbd22a4de)So I’m closing this as already implemented rather than keeping a duplicate issue open.
Review notes: reviewed against ec3dbd22a4de; fix evidence: release v2026.4.7.
fix(embedded): suppress aborted assistant partial payload leaks