Background tasks that crash/fail still show as 'running' in CLI
Resolved 💬 3 comments Opened Jan 15, 2026 by nsheaps Closed Jan 19, 2026
Description
When a background task fails or crashes, the CLI task tracker continues to report status: running even after the process has exited. The blocking TaskOutput call times out instead of returning the failure status.
Reproduction
# Run a command that will crash immediately as a background task
OTEL_LOGS_EXPORTER=none claude -p "say hi" 2>&1
When run with run_in_background: true:
- The process crashes immediately with:
````
Error: Unknown exporter type set in OTEL_LOGS_EXPORTER env var: none
at sf7 (/$bunfs/root/claude:2227:1350)
...
TaskOutputwithblock: falsereturnsstatus: runningTaskOutputwithblock: truetimes out withretrieval_status: timeout
The task tracker never transitions to a completed/failed state and shows the task as still running indefinitely, beyond 12 hours.
In addition, viewing the failed task initially shows the output, but subsequent views show no output.
Expected Behavior
- Background tasks that exit should update their status
- Exit code 0 →
status: completed - Non-zero exit code →
status: failedorstatus: completedwithexit_code: N - Blocking
TaskOutputshould return immediately when process exits
Actual Behavior
status: runningpersists indefinitely- Blocking calls timeout instead of returning
Related Issues
- #18259 - The OTEL crash used in reproduction (separate bug)
Environment
- Claude Code CLI v2.1.7 (bun binary version)
- macOS arm64
---
🤖 Generated with Claude Code
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗