claude-code - 💡(How to fix) Fix [BUG] Spawned subagent identifies as team-lead and exposes parent's conversation history when DM'd directly [5 comments, 3 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#55488Fetched 2026-05-03 04:52:02
View on GitHub
Comments
5
Participants
3
Timeline
15
Reactions
0
Author
Timeline (top)
commented ×5labeled ×5cross-referenced ×2mentioned ×1

Error Message

Error Messages/Logs

Fix Action

Fix / Workaround

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.

RAW_BUFFERClick to expand / collapse

Preflight Checklist

  • I have searched existing issues and this hasn't been reported yet
  • This is a single bug report (please file separate reports for different bugs)
  • 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:

  1. The subagent identified itself as "team-lead" instead of its assigned name (backend)
  2. The subagent showed the user the parent agent's (team-lead's) conversation history

Reproduction:

  1. TeamCreate to create a team
  2. Spawn a subagent with Agent({team_name, name, subagent_type: "general-purpose"}) and a spawn prompt that explicitly states the agent's role
  3. 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:

  1. TeamCreate to create a team
  2. Spawn a subagent with Agent({team_name, name, subagent_type: "general-purpose"}) and a spawn prompt that explicitly states the agent's role
  3. 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

extent analysis

TL;DR

The subagent identification issue may be resolved by ensuring that the subagent's context is properly isolated from its parent agent, potentially through modifications to the Agent creation process or the subagent's spawn prompt.

Guidance

  • Verify that the Agent creation parameters, specifically team_name, name, and subagent_type, are correctly set when spawning the subagent to ensure it has a unique identity.
  • Check the spawn prompt for any potential issues that could cause the subagent to inherit the parent's context or identity.
  • Investigate the TeamCreate process to see if there are any configuration options or parameters that could affect subagent identity and context isolation.
  • Consider adding additional logging or debugging statements to track the subagent's identity and context throughout its lifecycle to better understand where the issue occurs.

Example

No specific code example can be provided without more information on the Agent class or the TeamCreate process, but ensuring that the subagent's name parameter is correctly set, like Agent({team_name: "phase-b-detection", name: "backend", subagent_type: "general-purpose"}), might help.

Notes

The issue seems to be related to how subagents are created and managed within the team context, and resolving it might require changes to the application logic or the underlying API. The fact that sending an explicit identity-assert message temporarily fixes the issue suggests that the problem lies in how the subagent's identity is established or maintained.

Recommendation

Apply a workaround by sending an explicit identity-assert message to the subagent until a more permanent fix can be implemented, as this has been shown to temporarily resolve the issue, although it's not a durable solution across restarts.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING