Skip to content

Support PID alias in the send_msg effect - #653

Merged
kjnilsson merged 2 commits into
mainfrom
support-pid-alias-in-send_msg-effect
Sep 1, 2026
Merged

kjnilsson merged 2 commits into
mainfrom
support-pid-alias-in-send_msg-effect

Conversation

@dumbbell

Copy link
Copy Markdown
Collaborator

This is the same as a PID except that the process who created its alias can decide if it is still interested in a reply or not. If the alias is deleted, the message won't reach the process mailbox.

However, it is not possible to query the PID or its node from an alias. In the context of Ra, it is impossible to implement the local option of the send_msg effect.

Because of this, the message is always sent from the leader.

@dumbbell

dumbbell commented Aug 26, 2026 •

Copy link
Copy Markdown
Collaborator Author

I didn’t change the documentation. I wanted to discuss the idea and its implementation first.

I’m implementing a feature in Khepri to allow to send the result of a command to a specific process which may not be the caller (as part of the batching effort). I would like to be able to set a PID alias instead of a PID to make it resistant to log replay: the result should not be sent a second time to that designated process.

As noted in a couple comments in the code, it’s impossible to determine the PID or the node of a PID alias. Therefore, the local options can’t be honored.

@dumbbell
dumbbell force-pushed the support-pid-alias-in-send_msg-effect branch from b4af6af to 4d07f4d Compare August 27, 2026 08:57
@dumbbell
dumbbell marked this pull request as ready for review September 1, 2026 08:08
@mergify

mergify Bot commented Sep 1, 2026

Copy link
Copy Markdown

Tick the box to add this pull request to the merge queue (same as @mergifyio queue).

  • Queue this pull request

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds PID-alias support to send_msg effects, routing alias messages through the leader.

Changes:

  • Detects reference-based aliases during effect dispatch.
  • Adds an integration test for active alias delivery.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/ra_server_proc.erl Dispatches alias-targeted messages from the leader.
test/ra_machine_int_SUITE.erl Tests basic alias delivery.

πŸ’‘ Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/ra_server_proc.erl Resolved
Comment thread src/ra_server_proc.erl Resolved
@dumbbell
dumbbell force-pushed the support-pid-alias-in-send_msg-effect branch from 4d07f4d to 189e967 Compare September 1, 2026 08:53
This is the same as a PID except that the process who created its alias
can decide if it is still interested in a reply or not. If the alias is
deleted, the message won't reach the process mailbox.
Only the PID was documented as a valid target. It was missing the
registered process and the newly added process alias.
@dumbbell
dumbbell force-pushed the support-pid-alias-in-send_msg-effect branch from 189e967 to 5e2b9b6 Compare September 1, 2026 09:09
@kjnilsson
kjnilsson merged commit 6e89e8e into main Sep 1, 2026
18 of 20 checks passed
@kjnilsson
kjnilsson deleted the support-pid-alias-in-send_msg-effect branch September 1, 2026 10:34
@michaelklishin michaelklishin added this to the 3.2.0 milestone Sep 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants