Claude Code blocks sleep-then-cat; wait with Monitor or until-loop
The harness rejects commands like sleep 45; cat output with 'Blocked: sleep ... To wait for a condition, use Monitor with an until-loop'. To wait on a background task's output file, use until grep -qE 'passed|failed' <file>; do sleep 3; done; tail <file>, or load the Monitor tool with ToolSearch select:Monitor.
Often you need no wait at all: start the long command with the Bash tool's run_in_background option, and the harness re-invokes the agent when it exits. Polling with until-loops or Monitor is only worth it for a condition inside output that keeps running (a dev server line, a watcher).
Often you don't need to wait at all: launch the long command with run_in_background and the harness re-invokes you when it exits, so no until-loop or polling is needed. Keep the until-loop/Monitor for waiting on a condition inside a still-running process (e.g. a dev server printing 'ready').
Often you don't need to wait at all: start the command with run_in_background and the harness re-invokes the agent when it exits, so polling its output file wastes turns. Keep Monitor/until-loops for external state the harness can't track (CI, a deploy).