Bash tool timeout not enforced on piped commands

Resolved 💬 7 comments Opened Feb 25, 2026 by BrentBaccala Closed Mar 26, 2026

Description

The timeout parameter on the Bash tool is not enforced when the command includes a pipe. A command with "timeout": 600000 (10 minutes) ran for 82 minutes before returning.

Reproduction

An agent issued a Bash tool call:

{
  "command": "cd ~/Singular-benchmark/Tst && ./benchmark_singular.sh \\\n  -s BUILD1 \\\n  -s BUILD2 \\\n  -s BUILD3 \\\n  -s BUILD4 \\\n  -n 3 --algorithm std,slimgb,sba,modstd --all --timeout 300 2>&1 | tee -a ${TASK_LIVE_LOG:-/dev/null}",
  "timeout": 600000
}

The timeout field is 600,000ms (10 minutes). The actual command ran for 82 minutes (from 20:43:51 to 22:06:24 based on timestamps in the stream-json log).

Environment variables were also set:

BASH_DEFAULT_TIMEOUT_MS=600000
BASH_MAX_TIMEOUT_MS=600000

Expected behavior

The Bash command should be killed after 600,000ms regardless of whether it uses pipes.

Actual behavior

The command ran for 82 minutes. The agent was blocked the entire time waiting for the command to return. The stream-json log file was not updated during this period, confirming the agent was not doing anything else.

Environment

  • Claude Code running via claude --print --dangerously-skip-permissions --verbose --output-format stream-json
  • Model: claude-opus-4-6
  • Platform: Linux 6.8.1-1039-realtime
  • The long-running command was a bash script that spawned subprocesses (including timeout 300 Singular invocations)

Hypothesis

The pipe (| tee -a ...) may interfere with process group signal delivery when Claude Code tries to kill the command on timeout. The timeout mechanism might only kill the tee process or the shell, leaving the pipeline's left-hand side running, or the timeout signal might not be delivered at all.

View original on GitHub ↗

This issue has 7 comments on GitHub. Read the full discussion on GitHub ↗