This report is completely AI generated.
Summary
When tools.exec.notifyOnExit is enabled (the default), completion notifications for backgrounded exec sessions are delivered as system messages immediately upon process exit. If an agent turn is actively in progress (streaming a response, making tool calls, etc.), this notification can interrupt the flow, causing the agent to context-switch or respond to the notification rather than completing its current task.
Environment
- OpenClaw version: 2026.2.1
- Node.js version: v22.22.0
- OS: Linux 6.1.0-42-amd64 (Debian, x64)
- Channel: webchat (also observed in Telegram)
- Config: Default
tools.exec.notifyOnExit: true
Steps to Reproduce
- Start a conversation with the agent in webchat or Telegram
- Have the agent run a backgrounded exec command (e.g., a long-running process using
yieldMs or background: true)
- While the background process is running, continue chatting with the agent about a different topic
- When the background process exits, observe the notification arriving
Expected Behavior
Exec completion notifications should either:
- Be queued until the current agent turn completes
- Be batched with other pending notifications
- At minimum, not interrupt an actively streaming response
Actual Behavior
Notifications arrive as system messages immediately when the process exits, regardless of whether the agent is mid-turn. Example observed sequence:
[12:01:30] User: Can you explain how the calendar script works?
[12:01:31] Agent: Sure! The calendar script uses khal via nix-shell to...
[12:01:32] System: [2026-02-04 12:01:32 EST] Exec completed (salty-wh, code 0) :: chromium --version
[12:01:33] Agent: ...I see a background task completed. Anyway, as I was saying about the calendar...
The agent acknowledges the notification mid-explanation, breaking the flow.
Impact
- Conversation coherence: Agent may lose track of what it was explaining
- User confusion: Sudden topic switches feel jarring
- Token waste: Agent spends tokens acknowledging routine notifications
- Compounding effect: Multiple rapid notifications (e.g., several background tasks finishing) can derail a turn entirely
Related Issues
Suggested Solutions
- Queue notifications: Hold
notifyOnExit messages until the current turn completes, then deliver them before the next user message
- Batch notifications: If multiple background tasks complete in quick succession, combine them into a single notification
- Config option: Add
tools.exec.notifyTiming: "immediate" | "queued" | "batched" to let users choose behavior
- Silent mode: Add
tools.exec.notifySilent: true option that logs completions without injecting system messages
Workaround
Set tools.exec.notifyOnExit: false in config, but this loses visibility into background task completion entirely.
Additional Context
This issue was observed during a session where multiple web searches and file operations were running in background. Each completion notification would briefly distract the agent from its current explanation.
This issue was drafted with AI assistance (Claude/OpenClaw). The bug was observed directly during normal usage.
This report is completely AI generated.
Summary
When
tools.exec.notifyOnExitis enabled (the default), completion notifications for backgrounded exec sessions are delivered as system messages immediately upon process exit. If an agent turn is actively in progress (streaming a response, making tool calls, etc.), this notification can interrupt the flow, causing the agent to context-switch or respond to the notification rather than completing its current task.Environment
tools.exec.notifyOnExit: trueSteps to Reproduce
yieldMsorbackground: true)Expected Behavior
Exec completion notifications should either:
Actual Behavior
Notifications arrive as system messages immediately when the process exits, regardless of whether the agent is mid-turn. Example observed sequence:
The agent acknowledges the notification mid-explanation, breaking the flow.
Impact
Related Issues
Suggested Solutions
notifyOnExitmessages until the current turn completes, then deliver them before the next user messagetools.exec.notifyTiming: "immediate" | "queued" | "batched"to let users choose behaviortools.exec.notifySilent: trueoption that logs completions without injecting system messagesWorkaround
Set
tools.exec.notifyOnExit: falsein config, but this loses visibility into background task completion entirely.Additional Context
This issue was observed during a session where multiple web searches and file operations were running in background. Each completion notification would briefly distract the agent from its current explanation.
This issue was drafted with AI assistance (Claude/OpenClaw). The bug was observed directly during normal usage.