openclaw - ✅(Solved) Fix [Bug]: tools.exec.timeoutSec is ignored when exec auto-backgrounds via yieldMs/background without explicit timeout [1 pull requests, 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#67600Fetched 2026-04-17 08:30:07
View on GitHub
Comments
0
Participants
1
Timeline
4
Reactions
0
Author
Participants
Timeline (top)
labeled ×2cross-referenced ×1referenced ×1

tools.exec.timeoutSec is documented as the default timeout for the exec tool, but it is not applied when an exec call uses yieldMs or background without an explicit timeout parameter. Foreground exec correctly uses the configured default (e.g. 30s), while auto-backgrounded exec silently disables the default timeout, allowing commands to run indefinitely.

Root Cause

Root cause in bash-tools-CEAaYnEc.js:

const effectiveTimeout = allowBackground && explicitTimeoutSec === null && (backgroundRequested || yieldRequested) ? null : explicitTimeoutSec ?? defaultTimeoutSec;

Fix Action

Fixed

PR fix notes

PR #67603: fix: apply default timeoutSec to backgrounded/yieldMs exec (#67600)

Description (problem / solution / changelog)

Fixes #67600

Problem: tools.exec.timeoutSec was ignored when exec auto-backgrounded via yieldMs or background: true without an explicit timeout parameter. The foreground path correctly applied the default timeout, but backgrounded exec silently disabled it.

Fix: Removed the backgroundTimeoutBypass logic that nullified the timeout for background/yieldMs modes. Now effectiveTimeout always falls back to defaultTimeoutSec (from config or 1800s default).

Tests: Updated and added tests to verify background and yieldMs exec respect the default timeout. All 6 tests pass.

Changed files

  • src/agents/bash-tools.exec.background-abort.test.ts (modified, +16/-21)
  • src/agents/bash-tools.exec.ts (modified, +1/-5)

Code Example

{"tool": "exec", "command": "python3 - <<'PY'\nimport time\nprint('start', flush=True)\ntime.sleep(35)\nprint('end',flush=True)\nPY"}

---

const effectiveTimeout = allowBackground && explicitTimeoutSec === null && (backgroundRequested || yieldRequested) ? null : explicitTimeoutSec ?? defaultTimeoutSec;

---

- Config verification: `openclaw config get tools.exec.timeoutSec` returns 30
- Foreground exec: 35s sleep killed at ~30s (SIGTERM) — correct
- yieldMs exec: 35s sleep completes successfully — bug
- Explicit timeout with yieldMs: works correctly
- Source analysis: bash-tools-CEAaYnEc.js effectiveTimeout logic confirmed
- Related issues: #60151 (exec timeout vs agent run timeout), #44603 (tools.exec global defaults vs per-call params)
RAW_BUFFERClick to expand / collapse

Bug type

Behavior bug (incorrect output/state without crash)

Beta release blocker

No

Summary

tools.exec.timeoutSec is documented as the default timeout for the exec tool, but it is not applied when an exec call uses yieldMs or background without an explicit timeout parameter. Foreground exec correctly uses the configured default (e.g. 30s), while auto-backgrounded exec silently disables the default timeout, allowing commands to run indefinitely.

Steps to reproduce

  1. Configure tools.exec.timeoutSec: 30 in ~/.openclaw/openclaw.json
  2. Verify with openclaw config get tools.exec.timeoutSec (returns 30)
  3. Run a foreground exec with a 35s sleep command (no explicit timeout) — process is killed at ~30s via SIGTERM(correct)
  4. Run the same command with yieldMs: 1000 (no explicit timeout) — process completes past 30s (bug: default timeout not applied)
  5. Run the same command with yieldMs: 1000 and timeout: 50 — per-call timeout works correctly

Test command used:

  {"tool": "exec", "command": "python3 - <<'PY'\nimport time\nprint('start', flush=True)\ntime.sleep(35)\nprint('end',flush=True)\nPY"}

Expected behavior

tools.exec.timeoutSec should remain the default timeout for all exec modes (foreground, yieldMs, background) unless explicitly overridden by a per-call timeout parameter. In the foreground path this works correctly — a 35s command is killed at ~30s when timeoutSec=30.

Actual behavior

When exec is called with yieldMs or background and no explicit timeout, the configured tools.exec.timeoutSec default is silently bypassed. The effective timeout becomes null, allowing the command to run indefinitely.

Root cause in bash-tools-CEAaYnEc.js:

const effectiveTimeout = allowBackground && explicitTimeoutSec === null && (backgroundRequested || yieldRequested) ? null : explicitTimeoutSec ?? defaultTimeoutSec;

OpenClaw version

2026.4.14

Operating system

N/A (not specified in report)

Install method

N/A (not specified in report)

Model

N/A (not model-specific bug)

Provider / routing chain

N/A (not provider-specific bug)

Additional provider/model setup details

This bug is not provider or model specific. It affects the exec tool timeout resolution logic in the OpenClaw runtime itself. The config is correctly loaded and passed to createExecTool(defaults), but the effective timeout computation bypasses it on the auto-background path.

Logs, screenshots, and evidence

- Config verification: `openclaw config get tools.exec.timeoutSec` returns 30
- Foreground exec: 35s sleep killed at ~30s (SIGTERM) — correct
- yieldMs exec: 35s sleep completes successfully — bug
- Explicit timeout with yieldMs: works correctly
- Source analysis: bash-tools-CEAaYnEc.js effectiveTimeout logic confirmed
- Related issues: #60151 (exec timeout vs agent run timeout), #44603 (tools.exec global defaults vs per-call params)

Impact and severity

1. Affected users / systems / channels
The system running the OpenClaw AI assistant, and any processes or services relying on its tool execution capabilities.

2. Severity – Disrupts workflow
Frequency – Special case (runaway AI tool call), In my VPS full disk grep search without stopping.

3. Consequences

  • Memory spike (up to 2.9 GB), potentially slowing down system performance or triggering OOM killer.
  • 8 zombie processes created, consuming process table entries and affecting system stability.
  • If this recurs, it may lead to repeated resource exhaustion or hung tasks.

Additional context
Cleaned up residual zombie processes — found 8 stuck child processes doing a full-disk grep search (looks like a runaway AI tool call). All were killed, memory dropped from the 2.9 GB peak.

Additional information

By the way, this problem was discovered, tested and raised by OpenClaw itself.

extent analysis

TL;DR

The default timeout for the exec tool is not applied when using yieldMs or background without an explicit timeout parameter, allowing commands to run indefinitely.

Guidance

  • The issue is caused by the effectiveTimeout computation logic in bash-tools-CEAaYnEc.js, which bypasses the default timeout when allowBackground is true and no explicit timeout is provided.
  • To verify the issue, run the test command with yieldMs: 1000 and no explicit timeout, and observe that the command completes past the default timeout of 30s.
  • To mitigate the issue, provide an explicit timeout parameter when using yieldMs or background, or modify the effectiveTimeout logic to use the default timeout when no explicit timeout is provided.
  • Review related issues #60151 and #44603 for potential insights into the timeout resolution logic.

Example

// Modified effectiveTimeout logic to use default timeout when no explicit timeout is provided
const effectiveTimeout = (explicitTimeoutSec !== null) ? explicitTimeoutSec : defaultTimeoutSec;

Notes

The provided code snippet is a potential fix, but it may require additional testing and validation to ensure it works correctly in all scenarios. The issue is specific to the OpenClaw runtime and does not appear to be related to the operating system or install method.

Recommendation

Apply a workaround by providing an explicit timeout parameter when using yieldMs or background, until a permanent fix can be implemented. This will prevent commands from running indefinitely and reduce the risk of resource exhaustion.

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…

FAQ

Expected behavior

tools.exec.timeoutSec should remain the default timeout for all exec modes (foreground, yieldMs, background) unless explicitly overridden by a per-call timeout parameter. In the foreground path this works correctly — a 35s command is killed at ~30s when timeoutSec=30.

Still need to ship something?

×6

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

Back to top recommendations

TRENDING

openclaw - ✅(Solved) Fix [Bug]: tools.exec.timeoutSec is ignored when exec auto-backgrounds via yieldMs/background without explicit timeout [1 pull requests, 1 participants]