[Bug] CLAUDE_CODE_DISABLE_BACKGROUND_TASKS=1 ineffective for fork subagents
Bug Description
Bug: fork subagents always run in background despite CLAUDE_CODE_DISABLE_BACKGROUND_TASKS=1
Version: 2.1.179
Docs (code.claude.com/docs/en/sub-agents) state:
"Every subagent spawn runs in the background, whether it is a fork or a named
subagent. Set CLAUDE_CODE_DISABLE_BACKGROUND_TASKS to 1 to keep spawns synchronous."
Actual behavior: with CLAUDE_CODE_FORK_SUBAGENT=1 and CLAUDE_CODE_DISABLE_BACKGROUND_TASKS=1,
spawning subagent_type:"fork" via the Agent/Task tool STILL launches async (background).
DISABLE_BACKGROUND_TASKS does not return fork spawns to the foreground.
Tested matrix (fork always async):
- EXPERIMENTAL_AGENT_TEAMS=1 + DISABLE_BACKGROUND_TASKS=1 -> background
- EXPERIMENTAL_AGENT_TEAMS=0 + DISABLE_BACKGROUND_TASKS=1 -> background
- EXPERIMENTAL_AGENT_TEAMS unset + DISABLE_BACKGROUND_TASKS=1 -> background
=> Either a bug, or the docs are stale (DISABLE_BACKGROUND_TASKS has no effect on fork mode).
Expected: forks run synchronously when DISABLE_BACKGROUND_TASKS=1, OR docs updated to say
fork spawns are always background.
Environment Info
- Platform: linux
- Terminal: vscode
- Version: 2.1.179
- Feedback ID: 0e2c960f-b358-4521-a027-667781edd287
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗