claude-code - 💡(How to fix) Fix Agent Teams: teammate-message envelope intermittently renders as raw XML text instead of styled notification block [1 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#52554Fetched 2026-04-24 06:04:04
View on GitHub
Comments
0
Participants
1
Timeline
4
Reactions
0
Participants
Timeline (top)
labeled ×4

When a sub-agent spawned via Task(name=..., team_name=..., subagent_type=...) sends a message to the lead via SendMessage, the message is delivered to the lead's conversation as a <teammate-message teammate_id="..." color="..." summary="...">...</teammate-message> envelope. Normally the Claude Code UI renders this as a styled, color-coded notification block. Intermittently, the envelope renders as literal XML angle-bracket text — the <teammate-message> tag is visible as plain text in the chat, alongside the message body — instead of being styled.

Error Message

  • The failure mode is silent (user has to notice the styling issue; nothing surfaces an error)
  • A parse error on one specific content pattern (body containing characters that break the renderer's parser)

Root Cause

Not reproducible on demand. Single observed instance in several sessions of heavy Agent Teams usage. Filing on the one observation because:

  • The failure mode is silent (user has to notice the styling issue; nothing surfaces an error)
  • It affects UX in multi-agent workflows specifically (where teammate messages are the primary coordination channel)
  • Anyone else seeing it may not have known where to file
RAW_BUFFERClick to expand / collapse

Summary

When a sub-agent spawned via Task(name=..., team_name=..., subagent_type=...) sends a message to the lead via SendMessage, the message is delivered to the lead's conversation as a <teammate-message teammate_id="..." color="..." summary="...">...</teammate-message> envelope. Normally the Claude Code UI renders this as a styled, color-coded notification block. Intermittently, the envelope renders as literal XML angle-bracket text — the <teammate-message> tag is visible as plain text in the chat, alongside the message body — instead of being styled.

Observed instance

Single instance observed 2026-04-23, in a session using the PACT plugin (Agent Teams with several concurrent teammates).

  • 4 teammate messages arrived in the same session within a few minutes of each other, all delivered via the same SendMessage mechanism from 4 different sub-agents (colors: blue, green, yellow, purple).
  • 3 of the 4 rendered correctly as styled notification blocks (blue, yellow, purple).
  • 1 rendered as raw XML plain text (the green one).
  • On the model's side of the wire, all 4 envelopes appeared identical in structure — same opening <teammate-message teammate_id="..." color="..." summary="..."> tag, same closing </teammate-message> tag. No structural difference the model could see explained the UI-layer rendering difference.
  • A subsequent teachback from the same green teammate later in the session rendered correctly — so the bug is not per-teammate-identity persistent; it's position/timing-dependent.

Variables worth checking

What I've ruled out from the model side:

  • Not PACT-plugin-emitted: <teammate-message> envelopes come from the platform's inter-agent message delivery, not from any PACT hook. No PACT hook writes to stdout in a way that would produce this envelope.
  • Not per-teammate: same teammate rendered correctly on a later message.
  • Not color-value-specific: green rendered correctly in other sessions.

What I can't rule out:

  • Turn composition: the problematic message arrived in its own user-turn with nothing else in it. The correctly-rendered messages arrived in a turn that ALSO contained other content (e.g. a <command-name>/config</command-name> block, {\"type\":\"idle_notification\",...} entries). So the "simple" turn broke and the "complex" turn rendered fine — counterintuitive.
  • Message length / envelope size: the problematic message was long but so were the correctly-rendered peers. No obvious length threshold.
  • Whitespace/escaping inside the envelope body: not audited yet.
  • Timing / streaming: possibly a race where a fast-arriving envelope gets classified as literal markdown instead of a platform event.

Reproducibility

Not reproducible on demand. Single observed instance in several sessions of heavy Agent Teams usage. Filing on the one observation because:

  • The failure mode is silent (user has to notice the styling issue; nothing surfaces an error)
  • It affects UX in multi-agent workflows specifically (where teammate messages are the primary coordination channel)
  • Anyone else seeing it may not have known where to file

Hypothesis for investigation

The renderer that transforms <teammate-message> envelopes into styled blocks may have a fallback-to-plain-text path triggered by:

  • Arrival-ordering / streaming-boundary condition
  • A parse error on one specific content pattern (body containing characters that break the renderer's parser)
  • Concurrent renderer state when other rendering paths are active (e.g. slash-command dialog just dismissed)

Environment

  • Session using Claude Code with the PACT plugin for Agent Teams orchestration
  • 4+ concurrent sub-agents
  • macOS terminal (Darwin 25.5.0)
  • gh CLI 2.91.0

Happy to add more context if a triage request specifies what would help. This was filed by the PACT orchestrator after one observation; the user noticed the UI glitch and asked that it be reported upstream.

extent analysis

TL;DR

The issue might be resolved by investigating and fixing the renderer's parsing logic for <teammate-message> envelopes, potentially related to arrival ordering, concurrent rendering, or specific content patterns.

Guidance

  • Investigate the renderer's fallback-to-plain-text path and its triggers, such as arrival-ordering or parse errors on specific content patterns.
  • Audit the whitespace and escaping inside the envelope body to ensure it doesn't break the renderer's parser.
  • Test the rendering of <teammate-message> envelopes with varying lengths and complexities to identify potential thresholds or edge cases.
  • Consider implementing logging or debugging tools to capture more information about the rendering process and potential errors.

Example

No code snippet is provided due to the lack of specific implementation details in the issue.

Notes

The issue is not reproducible on demand, and the failure mode is silent, making it challenging to investigate. The provided information suggests that the issue might be related to the rendering of <teammate-message> envelopes, but more context and debugging information are needed to determine the root cause.

Recommendation

Apply a workaround by auditing and testing the rendering of <teammate-message> envelopes with varying lengths and complexities to identify potential thresholds or edge cases, and consider implementing logging or debugging tools to capture more information about the rendering process and potential errors.

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

claude-code - 💡(How to fix) Fix Agent Teams: teammate-message envelope intermittently renders as raw XML text instead of styled notification block [1 participants]