Skip to content

chat: wrap inbox deliveries in the cross-session envelope - #131

Merged
m4ttheweric merged 1 commit into
mainfrom
inbox-envelope
Aug 29, 2026
Merged

chat: wrap inbox deliveries in the cross-session envelope#131
m4ttheweric merged 1 commit into
mainfrom
inbox-envelope

Conversation

@m4ttheweric

@m4tthewericm4ttheweric commented Aug 29, 2026

Copy link
Copy Markdown
Collaborator

What

Claude Code's terminal renders an inbound peer message as a collapsed one-line row only when the content opens with its <cross-session-message ...> envelope; bare text renders in full. rt's socket deliveries sent bare text, so every chat message and welcome frame dumped its whole body (plus the harness's safety boilerplate) into the recipient's terminal view.

How

  • lib/daemon/inbox.ts: wrapCrossSession(label, body) builds the exact envelope (from-name only; no from, which is a SendMessage reply address rt recipients must not use); deliveryLabel(items) names the sender for a single message (kai (#rt) / kai (dm)) and counts a batch (rt chat (3 messages)).
  • lib/daemon/handlers/chat.ts: deliverPost and the sign-in welcome wrap at the delivery seam; render helpers stay pure.
  • skills/rt-chat/SKILL.md: the delivery format section shows the envelope and warns that from-name is a label, not a reply address.

Presentation only: the model still receives the full body, and these messages were already framed as peer input.

Tests

3 new unit tests (envelope shape, label attr-escaping, label selection); delivery assertions updated across unit + e2e. Unit suite green; e2e chat-inbox-delivery 2/2 against a real daemon and socket.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Chat and direct messages now include clear sender, channel, room, and batch-count context.
    • Messages are delivered in a standardized cross-session format while preserving the original chat content.
    • Sender labels are safely formatted for reliable display.
  • Documentation

    • Clarified message delivery formatting and the supported commands for replying to chat messages.

…ed rendering
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@m4ttheweric
m4ttheweric merged commit 4841f3a into mainAug 29, 2026
3 of 4 checks passed
@m4ttheweric
m4ttheweric deleted the inbox-envelope branch August 29, 2026 03:11
@coderabbitai

coderabbitaiBot commented Aug 29, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 4aeb27c7-5b78-410b-a742-03a6fb700292

📥 Commits

Reviewing files that changed from the base of the PR and between fd5c61d and 886cb66.

📒 Files selected for processing (6)
  • e2e/tests/chat-inbox-delivery.test.ts
  • lib/daemon/__tests__/chat-delivery.test.ts
  • lib/daemon/__tests__/inbox.test.ts
  • lib/daemon/handlers/chat.ts
  • lib/daemon/inbox.ts
  • skills/rt-chat/SKILL.md

📝 Walkthrough

Walkthrough

Chat delivery now wraps room, DM, batched, and welcome content in labeled <cross-session-message> envelopes. Labels are sanitized, and tests and documentation cover the updated delivery format.

Changes

Chat delivery formatting

Layer / File(s)Summary
Envelope and label helpers
lib/daemon/inbox.ts, lib/daemon/__tests__/inbox.test.ts
Adds wrapCrossSession with label sanitization and deliveryLabel for single and batched deliveries. Tests cover envelope formatting and labels.
Inbox delivery integration
lib/daemon/handlers/chat.ts
Applies delivery labels and cross-session envelopes to post deliveries and welcome content.
Delivery expectations and documentation
lib/daemon/__tests__/chat-delivery.test.ts, e2e/tests/chat-inbox-delivery.test.ts, skills/rt-chat/SKILL.md
Updates delivery assertions and documents sender metadata, DM formatting, batch labels, and response commands.

Estimated code review effort: 2 (Simple) | ~10 minutes

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch inbox-envelope

Comment @coderabbitai help to get the list of available commands.

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@m4ttheweric