feat(alias): send a message from a reply alias's own peer identity - #49
Merged
Merged
Conversation
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
marked this pull request as ready for review
September 20, 2026 16:46
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
🎉 This PR is included in version 1.6.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
AliasPoolcould 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
sendcommand to the alias IPC contract,AliasProcess.send, andAliasPool.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 withAliasSendErrorrather than hanging.ensure()andsend()now share one internal acquire path that returns the running process. Looking the process back up afterensure()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.