Background Task agents fail on Claude Code Web — sandbox recycled between turns
Summary
Background Task agents (run_in_background: true) and long-running foreground Task agents consistently fail on Claude Code Web because the sandbox environment is destroyed and recreated between each conversation turn. Agent transcripts are lost, output files in /tmp disappear, and resume attempts fail with "No transcript found for agent ID."
Environment
- Platform: Claude Code Web (claude.ai/code)
- Model: claude-opus-4-6
- Date: 2026-02-06
Root Cause
The Claude Code Web sandbox has an ephemeral process space:
- Each conversation turn spins up a fresh sandbox (
uptimeshows "up 0 min") - Git repo persists on mounted storage (disk survives)
/tmpis wiped between turns (ephemeral)- All running processes are killed when the sandbox restarts
- Conversation context is restored via cloud session persistence (
--resumeflag) - But background subprocesses (Task agents) have no persistence mechanism
Evidence
$ uptime
14:48:36 up 0 min, 0 user, load average: 0.00, 0.00, 0.00
$ ls -la /tmp/claude-0/-home-user-loom-dream/tasks/
# Empty — all agent output files wiped
Reproduction Steps
- Open Claude Code Web session
- Launch a Task agent with
run_in_background: truethat takes >2 minutes - Before the agent completes, send another message (e.g., "what's the status?")
- New sandbox starts — background agent process is killed
- Output file path (e.g.,
/tmp/claude-0/.../tasks/abc123.output) no longer exists - Attempting to resume with agent ID fails:
No transcript found for agent ID: <id>
Impact
This breaks any workflow relying on parallel background agents:
- Skills like
/dev-loop(6 parallel review agents) - Skills like
/consensus(3 parallel planning agents) - Any
Taskwithrun_in_background: true - Background
Bashcommands
Key pattern
Background agents succeed ONLY when the user does not interact with the session before they complete. Any user message triggers sandbox recycle, killing all agents.
Session Timeline (Real Example)
| Action | Result |
|--------|--------|
| 3 consensus agents (background) | All 3 lost — transcripts gone |
| 6 review agents (background) | All 6 completed (user waited) |
| 2 fix agents (background) | 1 completed, 1 lost transcript |
| Test fix agent (foreground) | Timed out |
| Direct inline work | Succeeded |
Suggested Fixes
- Short-term: Document that background agents are unreliable on Web; add warning when
run_in_background: trueis used - Medium-term: Persist agent transcripts to cloud session storage (not
/tmp); store output files on mounted storage - Long-term: Keep sandbox alive while background agents run, or migrate them to a persistent worker process
Workaround
Use foreground-only agents or do work directly inline instead of delegating to subagents. Write outputs to git-tracked files instead of /tmp.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗