Agent Teams: teammate-message envelope intermittently renders as raw XML text instead of styled notification block

Resolved 💬 2 comments Opened Apr 23, 2026 by michael-wojcik Closed May 27, 2026

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.

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗