-
-
Notifications
You must be signed in to change notification settings - Fork 52.6k
Closed
Closed
Copy link
Description
Summary
Background exec sessions launched via the exec tool with background: true are silently terminated (SIGTERM) after approximately 30 minutes. This appears to happen both on context compaction and potentially via a hard timeout.
Reproduction Steps
- Launch a long-running background exec:
exec({ command: "while true; do echo tick; sleep 300; done", background: true }) - Continue chatting normally for 30+ minutes
- Check process status — session shows
failedwithsignal SIGTERM
Observed Behavior
- All background exec sessions die at approximately the 30-minute mark with SIGTERM
- Multiple processes killed simultaneously, suggesting compaction is the trigger
Exec failed (session-id, signal SIGTERM)notifications arrive bundled with the next user message, not as real-time events- The agent cannot proactively restart failed processes since it only "wakes" on user messages, cron jobs, or heartbeats
Real-World Impact
I was running:
- Batch audio transcription (Whisper processing 930 .wav files, ~20 min job) — killed 3 times
- Tesla location polling loop (every 5 min) — killed repeatedly
- Both had to be restarted manually by the user noticing and asking
Expected Behavior
- Background exec sessions should survive context compaction
- Or: a configurable
maxDurationMsparameter should allow agents to set longer timeouts - Or: exec failure should trigger an agent turn so the agent can self-heal
Current Workaround
Launch processes as fully detached OS processes:
nohup bash /path/to/script.sh > /tmp/output.log 2>&1 &This works but loses all integration with the process tool (log, poll, kill).
Related Issues
- Session context lost after agent run timeout — background exec results injected into new session without history #20436 — Session context lost after agent run timeout (related: orphaned exec processes)
- Feature Request: Async exec callback — inject result back to session when process exits #18237 — Feature Request: Async exec callback (related: long-running process lifecycle)
Proposed Solutions
- Compaction-safe exec: Don't SIGTERM background processes on compaction. Re-attach them to the new context.
- Configurable timeout: Add
maxDurationMsparameter to exec tool for known long-running tasks. - Failure callbacks: Exec failures should optionally trigger an agent turn for self-healing.
Environment
- OpenClaw version: 2026.2.17
- OS: macOS (Apple Silicon, M-series)
- Model: Claude Opus 4
- Shell: zsh
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels