Skip to content

Native single-instance and control-socket rpc.eval - #14

Merged
dominicletz merged 6 commits into
feat/edw-rpc-and-restartfrom
cursor/single-instance-rpc-eval-282d
Sep 13, 2026
Merged

dominicletz merged 6 commits into
feat/edw-rpc-and-restartfrom
cursor/single-instance-rpc-eval-282d

Conversation

@dominicletz

@dominicletz dominicletz commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

Summary

The host now owns single-instance locking and --edw-rpc no longer uses erl_call or epmd.

When instances = single, the first host binds a per-user control socket (Unix socket on macOS/Linux, mutex + named pipe on Windows). A second launch sends instance.activate with the forwarded argv, the running host raises windows and emits event.system.open_url / open_file / reopen, and the second process exits 0.

--edw-rpc is a control-socket client. It sends instance.eval; the host forwards rpc.eval to the connected Elixir Transport, which runs Code.eval_string/1 and returns Kernel.inspect/1. The EDW TCP session stays one Elixir client.

Default instances = multi so current E2E and --edw-no-beam keep working. Packaged apps set single in their ini. On BEAM spawn the host sets RELEASE_DISTRIBUTION=none when that env key is unset.

Specs

  • New docs/specs/feature-single-instance.md and tests-single-instance.yaml
  • Rewrote feature-edw-rpc.md / tests-edw-rpc.yaml (drop cookie / node / erl_call)
  • Protocol, packaging, porting, AGENTS.md hard rule 8

Tests

Linux Elixir E2E is green:

  • test/e2e/rpc_test.exs: 1+12; module eval; no host → non-zero; --edw-rpc + --edw-recover exclusive
  • test/e2e/instance_test.exs: second host ddrive://invite/xevent.system.open_url; empty argv → reopen; instances=multi both stay up
  • Full mix test --exclude host: 33 tests, 0 failures
  • 20 repeats of the new E2E files: 0 failures after Launcher.stop/1 stopped using Process.exit/2 on a stored drain pid (that kill could hit a reused ExUnit test pid)

Status rows for --edw-rpc (control socket) and Single-instance are done on macOS, Windows, and Linux. Shared Elixir E2E is the source of truth.

Out of scope

  • ddrive / release vm.args
  • Multi-client EDW TCP
  • --edw-recover changes
Open in Web Open in Cursor 

cursoragent and others added 3 commits September 11, 2026 14:34
Add the single-instance spec and rewrite --edw-rpc off erl_call. The
control socket stays separate from the Elixir EDW TCP client.

Co-authored-by: Dominic Letz <dominicletz@users.noreply.github.com>
Bind a per-user lock when instances=single. Second launch sends
instance.activate. --edw-rpc is a control-socket client that forwards
rpc.eval to the connected Elixir Transport. Drop erl_call.

Co-authored-by: Dominic Letz <dominicletz@users.noreply.github.com>
Linux Elixir E2E covers instance.activate and --edw-rpc. Shared suite is the source of truth for all hosts.

Co-authored-by: Dominic Letz <dominicletz@users.noreply.github.com>
@dominicletz
dominicletz marked this pull request as ready for review September 11, 2026 14:39
cursoragent and others added 3 commits September 11, 2026 14:42
on_exit Process.exit/2 on a dead drain pid can hit the next ExUnit
test after pid reuse. Only kill the drain while it still owns the port.

Co-authored-by: Dominic Letz <dominicletz@users.noreply.github.com>
Close the port and terminate the host OS pid. Do not kill a stored
drain pid. Unlink Transport from the E2E test process.

Co-authored-by: Dominic Letz <dominicletz@users.noreply.github.com>
Copy the remaining byte count before withUnsafeMutableBytes so
the exclusive buffer access does not overlap buf.count.

Co-authored-by: Dominic Letz <dominicletz@users.noreply.github.com>
@dominicletz
dominicletz merged commit 76b65e3 into feat/edw-rpc-and-restart Sep 13, 2026
4 checks passed
@dominicletz
dominicletz deleted the cursor/single-instance-rpc-eval-282d branch September 13, 2026 16:59
Sign up for free to 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.

2 participants