Skip to content

feat(alias): send a message from a reply alias's own peer identity - #49

Merged
Mearman merged 4 commits into
mainfrom
feat/alias-send
Sep 20, 2026
Merged

Mearman merged 4 commits into
mainfrom
feat/alias-send

Conversation

@Mearman

@Mearman Mearman commented Sep 20, 2026

Copy link
Copy Markdown
Member

AliasPool could give a relayed session a reply-able name per correspondent, but nothing could actually send from one: the alias processes only ever relayed inbound replies back to the parent. That leaves a relay delivering every message from its own peer, so the session's native reply-to-sender goes back to the relay rather than to the correspondent it is answering (ExaDev/agent-comms#284).

This adds a send command to the alias IPC contract, AliasProcess.send, and AliasPool.send(name, target, body), which starts the alias if it is not already running and resolves with the message id its own peer gave the message. A send is correlated to its acknowledgement by request id, so several can be in flight at once, and one whose worker exits before acknowledging it rejects with AliasSendError rather than hanging.

ensure() and send() now share one internal acquire path that returns the running process. Looking the process back up after ensure() would have needed a "started but no longer active" branch that cannot actually be reached.

Covered by unit tests against the fake alias process and the fake child, plus integration tests that fork the real worker and send to a real CcPeer (and a real failure, where the target has no published inbox). Coverage and mutation gates both still at 100 locally.

Covers both halves of the outbound path: a send the alias's own peer
refused, and a send whose worker process was gone, or went away, before
acknowledging the command.
…as IPC

The command names its target the same three ways CcPeer's own PeerRef
does, with each variant strict so a target carrying fields from more than
one of them is rejected rather than resolved by whichever branch happens
to match first. Each command is answered by a sent or send_failed event
carrying the same requestId, so several sends can be in flight at once.
AliasPool.send(name, target, body) starts the named alias if it is not
already running and sends from that alias's own CcPeer, so the recipient
sees the correspondent rather than the relay as the sender and its native
reply-to-sender lands back on the alias.

ensure() and send() now share one acquire() path that returns the running
process, which removes the otherwise unreachable "started but no longer
active" branch a separate lookup after ensure() would need. A send whose
worker exits before acknowledging it rejects with AliasSendError rather
than hanging, and a send issued once the worker has ended fails the same
way instead of writing to a channel nothing is reading.
Explains why the sending identity is what makes the reply land: a session
replies to whoever sent it a message, so a message delivered from the
relay's own peer comes back to the relay with nothing to say which
correspondent it answers.
@Mearman
Mearman marked this pull request as ready for review September 20, 2026 16:46
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 20, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
🔒 Security Review ✅ Completed 2026-09-20T16:53:30.264476Z 85b2d9e Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@Mearman
Mearman merged commit 4154414 into main Sep 20, 2026
9 checks passed
@Mearman
Mearman deleted the feat/alias-send branch September 20, 2026 16:50
@exadev

exadev Bot commented Sep 20, 2026

Copy link
Copy Markdown

🎉 This PR is included in version 1.6.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@exadev exadev Bot added the released label Sep 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant