Agent pane: Claude Code's delivered messages draw as the agent line, not the person's

Merged
TE
15d ago
+114-13

In progress: review, fleet compile-check and CI are running; this merges once they pass.

What. In an adopted Claude session, another session's message now draws as the agent line (sender chip, preview, card) instead of the person's bubble.

Why. Claude Code puts a line before the envelope it delivers: Another Claude session sent a message: (or … while you were working:). The envelope match is anchored at the start of the prompt, so it missed every one of these. In this machine's recent transcripts, 89 of 89 delivered messages had that line.

Change (conversation/incomingMessage.ts, adopted prompts only; live prompts are unchanged):

  • The prompt is matched after skipping Claude Code's line.
  • <agent-message from="id">…</agent-message> (a subagent's or teammate's message) reads like <cross-session-message>. It is named by its id.
  • Claude Desktop's name= is a fallback when there is no from-name.
  • When the body starts with an agent name in brackets ([coord-deputy] …, the same convention as acpmux send from a shell, #23775), that name is the sender. The envelope's from-name is the sending session's title (2026-10-20-gui-push-be); the bracketed name is the agent, and its chip finds that agent's chat by name. [Subagent hand-back] is not a name.
  • The shell path shares the same bracket reader (namedFirst) and behaves as before.

Tests (incomingMessage.test.ts): both forms of the line, the line alone, a live prompt, <agent-message> (closed, unclosed, hand-back), the bracketed name, name= with and without from-name, and a bracketed sentence. Run on CI (no test runs on Leo's Macs). The same inputs gave the expected results in node against the module.

Agent session: cosmic-gray

🤖 Generated with Claude Code


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.


Summary by cubic

Fixes message rendering in adopted Claude sessions so messages delivered by Claude Code draw as the sender's agent line instead of the person's bubble.

  • Skips Claude Code's Another Claude session sent a message: line and any bookkeeping before matching envelopes.
  • Recognizes <agent-message> envelopes from subagents/teammates, naming them by their id.
  • Uses from-name, then Claude Desktop's name, then from as the sender fallback.
  • A bracketed name at the start of the body overrides the session title as the sender only when it reads as an agent (coord-deputy); tags like [WIP] or [1/3] stay in the text.
  • Treats [Subagent hand-back] as body text, not a sender name.