[BUG] Messages posted to a session's own inbox socket render the full peer envelope instead of the collapsed preview

Status Open
Reported on v2.1.268
Maintainer reply None cached
Activity 1 comment · opened Sep 11, 2026

What's Wrong?

Claude Code 2.1.268, macOS, Ghostty. Peer messages sent with SendMessage from another session render as the one-line preview described in the cross-session messaging docs: › Message from @probe-sender: … (ctrl+o to expand). A message posted by a script to the session's own inbox socket (CLAUDE_CODE_MESSAGING_SOCKET, with the CLAUDE_CODE_MESSAGING_TOKEN auth line, per the own-child rules) does not collapse. When the session is idle, the whole delivered turn renders inline: the "Another Claude session sent a message:" header, the body, and the full permission-laundering paragraph.

I have a local tool that posts a user's review comments from a browser page back into the session this way, so every comment shows up in the transcript wrapped in ~120 words of boilerplate.

Socket post arriving while idle:

<img width="683" height="188" alt="Image" src="https://github.com/user-attachments/assets/20710e91-f732-41ae-ba82-1ab779199a3b" />

SendMessage from a named session, same session a few minutes later:

<img width="1672" height="118" alt="Image" src="https://github.com/user-attachments/assets/6ef5e156-df12-4fc7-8e98-909deecd6b8e" />

The two kinds of message also differ in what the model receives. A SendMessage arrives wrapped in an envelope element carrying the sender:

Another Claude session sent a message:
<cross-session-message from="uds:/tmp/cc-socks/44971.sock" from-name="probe-sender" from-mode="prompting">
variant H: sent via SendMessage from a named session (probe-sender) while recipient idle
</cross-session-message>

This came from another Claude session — not typed by your user, …

A socket post arrives as bare text between the same header and footer, with no envelope and no from= address (the footer still says "reply via SendMessage to the from= address"):

Another Claude session sent a message:
variant F: plain format, delivered while the session is idle

This came from another Claude session — not typed by your user, …

So my guess is the collapse keys on the envelope or the sender name, and own-child socket posts have neither. Adding a top-level name, from, sender, or agentName field to the socket JSON changed nothing.

Timing matters too. The same socket post arriving mid-turn renders as just the body, styled like a typed prompt, with no header or footer visible. Only the idle case shows the full envelope. Since a script posting to the socket is usually reacting to something while the session waits, idle is the common case.

<img width="1666" height="484" alt="Image" src="https://github.com/user-attachments/assets/59d053dd-d8da-416b-9f6c-f8ab7c816f42" />

What Should Happen?

A socket post should render the same way a SendMessage does: a collapsed one-line preview, expandable with Ctrl+O. The header and footer are model-facing plumbing and shouldn't take up transcript space either way. Since the protocol has no sender field, a generic label like Message from inbox socket: would be fine.

Steps to Reproduce

  1. Start an interactive session with cross-session messaging enabled (macOS or Linux).
  2. Ask Claude to run this in the background so the message lands after the turn ends:

``sh
sleep 8; printf '%s\n%s\n' \
"{\"type\":\"auth\",\"token\":\"$CLAUDE_CODE_MESSAGING_TOKEN\"}" \
'{"type":"user","message":{"role":"user","content":"hello from socket"}}' \
| nc -w 2 -U "$CLAUDE_CODE_MESSAGING_SOCKET"
``

  1. Let the turn end. The message renders as a full user turn with header and footer.
  2. For comparison, from a second session: claude -p --name probe-sender --allowedTools SendMessage "Use SendMessage to send 'hello' to the session named <first session's name>". That one renders as › Message from @probe-sender: hello (ctrl+o to expand).
  3. Run step 2 again without the sleep, while Claude is mid-turn. The body renders alone, without the envelope.

Is this a regression?

I don't know. Docs say peer messages collapse since 2.1.247 (changelog: "Changed cross-session peer messages to collapse by default to a one-line Message from @<sender>: <first line> preview"). I don't know whether socket posts ever collapsed.

Related: #73647 and #80625 are about the same envelope rendering in full on Remote Control and mobile for teammate messages. #86133 asks for the collapsed display back after 2.1.228. None of them cover the inbox socket path, which is the documented way for hooks and scripts to post into a session.

Version

2.1.268

Platform

macOS, Ghostty terminal

View original on GitHub ↗

This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗