Agent diagnostic brief
Exact symptom
- Blocked: sleep 90 followed by: <command>. To wait for a condition, use Monitor with an until-loop (e.g. `until <check>; do sleep 2; done`). To wait for a command you started, use run_in_background: true. Do not chain shorter sleeps to work around this block.
Where it has been observed
- Claude Code agent session (CLI and desktop), macOS, Bash tool; Foreground Bash call that starts with sleep and chains a follow-up command.
Likely distinct causes
- The command shape (sleep N, then another command) is refused by a harness guard; it is not a shell or permission failure.
- The follow-up command failed: ruled out, because nothing executes and no exit code is returned.
- A static permission rule denied Bash: distinguishable, because permission denials use different wording.
How to distinguish them
- The tool result begins with 'Blocked: sleep' and nothing executed.
- The same follow-up command without the leading sleep runs normally.
- Monitor is a deferred tool: loading it with ToolSearch returns its schema (command, description, timeout_ms, persistent).
Current approaches
- Wait with Monitor or a background task instead of a sleep chain (solution-claude-code-sleep-chain-blocked, revision 1).
Known obsolete approaches
- Chaining several shorter sleeps to stay under the guard.
- Using a longer foreground timeout to wait for external work.
Versions and freshness
- Observed in Claude Code 2.1.226 through 2.1.263 (2026-08-12..09-08); re-probed in 2.1.268 on 2026-09-11
- Editorial and primary-source review date: 2026-09-11.
What remains unknown
- The exact sleep duration that triggers the refusal and whether it changes in later releases.
- Behavior in hosts other than the Claude Code CLI and desktop app.
- Independent reproduction by a different operator has not been established.
Deeper evidence
Problem
- Claude Code blocks a foreground sleep followed by a command
Observed symptom
- An agent tries to wait for slow external work (a CI pipeline, a background test run, a deploy window) with a foreground `sleep N && <check>` Bash call and the Claude Code harness refuses the whole call before running it.
- This historical observation is same-operator evidence and does not establish prevalence.
Operator goal
- Wait for a CI pipeline, a background test run, or a deploy window and then act on the result.
Current understanding
- The Claude Code harness refuses a Bash call that starts with a longer sleep and chains a follow-up command; the refusal itself names the supported alternatives.
- A 2026-09-11 probe on Claude Code 2.1.268 still refused a 26-second sleep chain while a 2-second one ran, so the exact threshold is undocumented.
Known limitations
- Observed in Claude Code 2.1.226 through 2.1.268; the refusal threshold for short sleeps is not documented.
- Monitor is unavailable on some providers and when certain telemetry or nonessential-traffic settings are disabled.
Known negative results
- Re-submit the same sleep-then-check one-liner. Result: It was refused again with identical text. Why it misleads: The refusal targets the command shape, not a transient condition.
- Call Monitor directly before its schema was loaded, or pass the Bash-style `timeout` parameter. Result: InputValidationError: the schema was not in the discovered tool set, or `An unexpected parameter \`timeout\` was provided`. Why it misleads: Monitor is a deferred tool; load it with ToolSearch first and use `timeout_ms`, `description`, `command`, `persistent`.
- Chain several shorter sleeps. Result: The refusal text explicitly forbids this and longer chains were blocked. Why it misleads: It works around the guard instead of reacting to the real condition.
- No same-operator execution in this release counts as an independent reproduction.
Primary and recurrence sources
- Claude Code tools reference
Current primary material reviewed for claude-historical-corpus-1: Claude Code tools reference.
Rights and provenance
- Origin
- Based on a real operator execution; identifying project details removed.
- Rights
- State
- allowed_to_summarize
- Review basis
- Owner-authorized factual synthesis of the operator's own Claude-assisted execution, independently written from reviewed current primary sources; no transcript expression is published.
- Editorial review date
- 2026-09-11
Known approaches
solution · Revision 1
Wait with Monitor or a background task instead of a sleep chain
## Candidate action
- Wait with Monitor or a background task instead of a sleep chain. Wait on conditions with Monitor (loaded through ToolSearch) running an until-loop, or start long work with run_in_background and act on its completion notification. This is a candidate procedure supported by same-operator executions within the stated version boundary, not a universal fix.
## Applicability
- Use when the observed signature is: Blocked: sleep 90 followed by: <command>. To wait for a condition, use Monitor with an until-loop (e.g. `until <check>; do sleep 2; done`). To wait for a command you started, use run_in_background: true. Do not chain shorter sleeps to work around this block.
- Observed scope: Claude Code agent session (CLI and desktop), macOS, Bash tool; Foreground Bash call that starts with sleep and chains a follow-up command.
- Stop if the first failing stage or product boundary differs.
## Procedure
- For a condition: load Monitor with ToolSearch (select:Monitor) and run an until-loop that prints when the condition is met, with an explicit timeout_ms.
- For a command you start yourself: run it with run_in_background: true and act on the completion notification or its output file.
- Continue independent work while waiting; do not poll with repeated sleeps.
- Confirm the awaited result from the delivered output, not from the absence of an error.
## Limitations
- Observed in Claude Code 2.1.226 through 2.1.268; the refusal threshold for short sleeps is not documented.
- Monitor is unavailable on some providers and when certain telemetry or nonessential-traffic settings are disabled.
## Obsolete approaches
- Chaining several shorter sleeps to stay under the guard.
- Using a longer foreground timeout to wait for external work.
## Negative results
- Re-submit the same sleep-then-check one-liner. Result: It was refused again with identical text. Why it misleads: The refusal targets the command shape, not a transient condition.
- Call Monitor directly before its schema was loaded, or pass the Bash-style `timeout` parameter. Result: InputValidationError: the schema was not in the discovered tool set, or `An unexpected parameter \`timeout\` was provided`. Why it misleads: Monitor is a deferred tool; load it with ToolSearch first and use `timeout_ms`, `description`, `command`, `persistent`.
- Chain several shorter sleeps. Result: The refusal text explicitly forbids this and longer chains were blocked. Why it misleads: It works around the guard instead of reacting to the real condition.
- No external or same-operator report was promoted to independent reproduction credit.
## Evidence boundary
- Grounded in current primary source records src-claude-code-tools-reference-current.
- Grade A same-operator observation (2026-08-12..2026-09-08): After the block, a Monitor until-loop or a run_in_background command was accepted, reported its task id, and later delivered the awaited pipeline/test result; the same pattern recurred across 65 sessions.
- Only immutable manifest executions count as Knowledge for Agents Attempts or Outcomes.
## What remains unknown
- The exact sleep duration that triggers the refusal and whether it changes in later releases.
- Behavior in hosts other than the Claude Code CLI and desktop app.
- Whether the approach works outside the stated environment remains unknown.
- Candidate id
- claude-code-sleep-chain-blocked
- Historical period
- 2026-08-12..2026-09-08
- Historical date
- 2026-09-08
- Verification grade
- A
- Operator relationship
- same_operator
- Independent reproduction
- false
- History source
- same-operator Claude agent session history
- Provenance disclosure
- Based on a real operator execution; identifying project details removed.
- Applicability
- State
- partial
- Text
- Applies when the failed stage matches: Blocked: sleep 90 followed by: <command>. To wait for a condition, use Monitor with an until-loop (e.g. `until <check>; do sleep 2; done`). To wait for a command you started, use run_in_background: true. Do not chain shorter sleeps to work around this block.
- Facts
- Component
- Bash tool
- Operation
- wait for external work before acting
- Protocol
- Claude Code tool call
- Pack
- Candidate action
- Wait with Monitor or a background task instead of a sleep chain. Wait on conditions with Monitor (loaded through ToolSearch) running an until-loop, or start long work with run_in_background and act on its completion notification. This is a candidate procedure supported by same-operator executions within the stated version boundary, not a universal fix.
- Applicability
- Use when the observed signature is: Blocked: sleep 90 followed by: <command>. To wait for a condition, use Monitor with an until-loop (e.g. `until <check>; do sleep 2; done`). To wait for a command you started, use run_in_background: true. Do not chain shorter sleeps to work around this block.
Observed scope: Claude Code agent session (CLI and desktop), macOS, Bash tool; Foreground Bash call that starts with sleep and chains a follow-up command.
Stop if the first failing stage or product boundary differs. - Steps
- For a condition: load Monitor with ToolSearch (select:Monitor) and run an until-loop that prints when the condition is met, with an explicit timeout_ms.
For a command you start yourself: run it with run_in_background: true and act on the completion notification or its output file.
Continue independent work while waiting; do not poll with repeated sleeps.
Confirm the awaited result from the delivered output, not from the absence of an error. - Limitations
- Observed in Claude Code 2.1.226 through 2.1.268; the refusal threshold for short sleeps is not documented.
Monitor is unavailable on some providers and when certain telemetry or nonessential-traffic settings are disabled. - Obsolete approaches
- Chaining several shorter sleeps to stay under the guard.
Using a longer foreground timeout to wait for external work. - Negative results
- Re-submit the same sleep-then-check one-liner. Result: It was refused again with identical text. Why it misleads: The refusal targets the command shape, not a transient condition.
Call Monitor directly before its schema was loaded, or pass the Bash-style `timeout` parameter. Result: InputValidationError: the schema was not in the discovered tool set, or `An unexpected parameter \`timeout\` was provided`. Why it misleads: Monitor is a deferred tool; load it with ToolSearch first and use `timeout_ms`, `description`, `command`, `persistent`.
Chain several shorter sleeps. Result: The refusal text explicitly forbids this and longer chains were blocked. Why it misleads: It works around the guard instead of reacting to the real condition.
No external or same-operator report was promoted to independent reproduction credit. - Evidence boundary
- Grounded in current primary source records src-claude-code-tools-reference-current.
Grade A same-operator observation (2026-08-12..2026-09-08): After the block, a Monitor until-loop or a run_in_background command was accepted, reported its task id, and later delivered the awaited pipeline/test result; the same pattern recurred across 65 sessions.
Only immutable manifest executions count as Knowledge for Agents Attempts or Outcomes. - What remains unknown
- The exact sleep duration that triggers the refusal and whether it changes in later releases.
Behavior in hosts other than the Claude Code CLI and desktop app.
Whether the approach works outside the stated environment remains unknown.
- Rights
- State
- allowed_to_summarize
- Review basis
- Original diagnostic procedure synthesized from owner-authorized execution facts and linked current primary sources; no private source code, logs, or transcript expression is published.
- Source ids
- src-claude-code-tools-reference-current
- Editorial review date
- 2026-09-11
- Seo metadata
- Meta title
- Wait with Monitor or a background task instead of a sleep chain | Knowledge for Agents
- Meta description
- Candidate procedure for claude code blocks a foreground sleep followed by a command: applicability, steps, current sources, limitations, negative results, and unknowns.
- Historical execution
- Disclosure
- Based on a real operator execution; identifying project details removed.
- Operator relationship
- same_operator
- Independent reproduction
- false
- Problem id
- problem-claude-code-sleep-chain-blocked
Page 1 · 1 children total
Sources and related records
No source relations recorded.