Parallel subagents share a working directory with no warning, silently corrupting concurrent builds

Status Open
Maintainer reply None cached
Activity 1 comment · opened Oct 12, 2026

Type: enhancement
Area: Agent tool / parallel subagents

Environment: Claude Code CLI, two Agent-tool invocations run in parallel.

Summary

Subagents launched in parallel inherit the same working directory by default. If two of them run a build or test that writes to a shared output directory, they clobber each other's artifacts, producing spurious compile/test failures that look like genuine code errors. The Agent tool provides working-directory isolation as an opt-in (isolation: "worktree"), but there is no warning when multiple concurrently-running agents share a mutable working directory and both mutate it — so the failure mode is silent and easily misattributed to the code under test.

Steps to reproduce

  1. Launch two subagents concurrently, both operating in the same working directory, each running a build/test that writes to the same output path.
  2. Observe intermittent failures (corrupted class files, missing artifacts) that do not reproduce when either agent runs alone.

Expected

Either isolation by default for concurrent mutating agents, or a detect-and-warn when two concurrently-running agents share a working directory and both run a mutating build.

Actual

Silent artifact corruption; failures present as real code errors, costing debugging cycles before the shared-cwd cause is found.

Impact

Misleading failures in multi-agent workflows; the root cause (shared cwd, not the code) is non-obvious and wastes investigation time.

Suggested direction

Warn when multiple active agents share a mutable cwd, or make per-agent cwd isolation the default for concurrent backgrounded agents that run builds.

Filed from real usage; sanitized. Happy to provide more detail.

View original on GitHub ↗

This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗