openclaw - 💡(How to fix) Fix [Bug] Exec completion events injected into user chat session as queued messages, derailing active conversation [1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#61990Fetched 2026-04-08 03:10:26
View on GitHub
Comments
0
Participants
1
Timeline
0
Reactions
0
Participants

Fix Action

Workaround

Use message tool explicitly for all user-visible updates during long exec chains, rather than relying on chat reply. Reduces blast radius but doesn't prevent context corruption.

Code Example

System: [2026-04-06 11:04:45 EDT] Exec completed (gentle-g, code 0) :: 42k/272k (15%) ...
System: [2026-04-06 11:05:43 EDT] Exec failed (grand-la, signal SIGKILL)
System: [2026-04-06 11:09:20 EDT] Exec completed (lucky-ca, code 0) :: [grocery search results JSON] ...
RAW_BUFFERClick to expand / collapse

Problem

When a session is processing a long-running exec task (e.g. browser automation for a Whole Foods grocery order via Camoufox), internal exec completion events are delivered as [Queued messages while agent was busy] into the same chat session. The model treats these as new user input, abandoning the active task mid-flow and responding to machine-generated noise instead of continuing the workflow.

Reproduction

  1. Trigger a workflow involving multiple sequential exec + process poll calls (e.g. grocery order via browser automation — grocery search, grocery add, grocery cart, etc.)
  2. While the session is processing, the user sends a reply (normal: answering a question the agent asked mid-flow)
  3. The agent continues the workflow, generating more exec completions
  4. When the model finishes a tool loop, it receives the exec completion dumps in the [Queued messages while agent was busy] block as if they were user messages
  5. Model context shifts — it abandons the workflow and starts responding to the internal System: Exec completed ... events

Expected

Exec completion events should land as tool results in the session context — not as queued user messages. Internal system events should never appear in the [Queued messages while agent was busy] block alongside real user chat.

Actual

The queued messages block contains entries like:

System: [2026-04-06 11:04:45 EDT] Exec completed (gentle-g, code 0) :: 42k/272k (15%) ...
System: [2026-04-06 11:05:43 EDT] Exec failed (grand-la, signal SIGKILL)
System: [2026-04-06 11:09:20 EDT] Exec completed (lucky-ca, code 0) :: [grocery search results JSON] ...

The model receives all of these as user input on the next turn, causing context corruption.

Real-world impact

  • User said "grocery run," agent asked one clarifying question, user answered, agent continued
  • Underlying grocery order did complete (credit card charged, items ordered) — but agent never sent a completion message
  • User had no idea the order placed until the delivery notification
  • Agent session ended in a confused state responding to exec output instead of the workflow

Environment

  • OpenClaw: 2026.4.5
  • Model: openai-codex/gpt-5.4 (codex alias)
  • Channel: Discord group channel (requireMention: false)
  • Task: long-running browser automation (Camoufox + Python scripts, 10+ sequential exec calls over ~12 minutes)

Workaround

Use message tool explicitly for all user-visible updates during long exec chains, rather than relying on chat reply. Reduces blast radius but doesn't prevent context corruption.

Related

  • #34041 (queued messages duplicate delivery)
  • #57617 (parent session stuck after subagent abort)
  • #36212 (queued messages lose platform message_id)

Notes

This may be model-specific — we only started seeing it after upgrading to GPT-5.4 (codex), though the upgrade coincided with OpenClaw 2026.4.5. Unclear whether it's a model behavior change or a platform routing change in 4.5.

extent analysis

TL;DR

Use the message tool explicitly for user-visible updates during long exec chains to reduce context corruption.

Guidance

  • Identify all user-visible updates in long exec chains and replace them with explicit message tool calls to prevent the model from treating them as user input.
  • Verify that the message tool is correctly configured to send updates to the user without interrupting the workflow.
  • Review the workflow to ensure that all internal system events are properly handled and do not appear in the [Queued messages while agent was busy] block.
  • Consider implementing a mechanism to filter out internal system events from the queued messages block to prevent context corruption.

Example

# Instead of relying on chat reply
# agent.reply("Grocery search results: ...")

# Use the message tool explicitly
agent.message("Grocery search results: ...")

Notes

The issue may be model-specific, and it's unclear whether it's a model behavior change or a platform routing change in OpenClaw 2026.4.5. Further investigation is needed to determine the root cause.

Recommendation

Apply the workaround by using the message tool explicitly for all user-visible updates during long exec chains. This reduces the blast radius of context corruption but may not prevent it entirely. A more permanent fix may require changes to the model or platform routing.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING