[BUG] Spawned subagent identifies as team-lead and exposes parent's conversation history when DM'd directly
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
Description:
Spawned a subagent via TeamCreate + Agent (team phase-b-detection, agent backend, subagent_type=general-purpose). When the user DM'd the subagent directly via the team chat UI:
- The subagent identified itself as "team-lead" instead of its assigned name (backend)
- The subagent showed the user the parent agent's (team-lead's) conversation history
Reproduction:
- TeamCreate to create a team
- Spawn a subagent with Agent({team_name, name, subagent_type: "general-purpose"}) and a spawn prompt that explicitly states the agent's role
- User DMs the subagent directly via the team UI: "who are you?" or asks about its history
Expected: Subagent identifies with the assigned name. Each agent has isolated context.
Actual: Subagent identified as the parent ("team-lead") and was able to relay the parent's history.
Why this matters: Privacy (parent's conversation may include context not meant for the subagent), correctness (the dispatch model relies on stable agent identity), trust (hard to trust
subagent reports if their identity is mutable).
Workaround: Sending an explicit identity-assert message to the subagent re-anchors it, but this isn't durable across restarts and shouldn't be necessary in the first place.
What Should Happen?
Expected: Subagent identifies with the assigned name. Each agent has isolated context.
Actual: Subagent identified as the parent ("team-lead") and was able to relay the parent's history.
Error Messages/Logs
Steps to Reproduce
Reproduction:
- TeamCreate to create a team
- Spawn a subagent with Agent({team_name, name, subagent_type: "general-purpose"}) and a spawn prompt that explicitly states the agent's role
- User DMs the subagent directly via the team UI: "who are you?" or asks about its history
Claude Model
None
Is this a regression?
Yes, this worked in a previous version
Last Working Version
_No response_
Claude Code Version
2.1.126
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Terminal.app (macOS)
Additional Information
_No response_
This issue has 7 comments on GitHub. Read the full discussion on GitHub ↗