Background Task agents fail on Claude Code Web — sandbox recycled between turns

Resolved 💬 3 comments Opened Feb 6, 2026 by oleh-l Closed Feb 6, 2026

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:

  1. Each conversation turn spins up a fresh sandbox (uptime shows "up 0 min")
  2. Git repo persists on mounted storage (disk survives)
  3. /tmp is wiped between turns (ephemeral)
  4. All running processes are killed when the sandbox restarts
  5. Conversation context is restored via cloud session persistence (--resume flag)
  6. 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

  1. Open Claude Code Web session
  2. Launch a Task agent with run_in_background: true that takes >2 minutes
  3. Before the agent completes, send another message (e.g., "what's the status?")
  4. New sandbox starts — background agent process is killed
  5. Output file path (e.g., /tmp/claude-0/.../tasks/abc123.output) no longer exists
  6. 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 Task with run_in_background: true
  • Background Bash commands

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

  1. Short-term: Document that background agents are unreliable on Web; add warning when run_in_background: true is used
  2. Medium-term: Persist agent transcripts to cloud session storage (not /tmp); store output files on mounted storage
  3. 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.

View original on GitHub ↗

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