Skip to content

Add --edw-rpc and Mix eval BEAM recovery - #13

Open
dominicletz wants to merge 1 commit into
masterfrom
feat/edw-rpc-and-restart
Open

Add --edw-rpc and Mix eval BEAM recovery#13
dominicletz wants to merge 1 commit into
masterfrom
feat/edw-rpc-and-restart

Conversation

@dominicletz

Copy link
Copy Markdown
Contributor

Summary

  • Add --edw-rpc as a one-shot Elixir eval on a running BEAM node via erl_call.
  • Restart BEAM after a crash. After three startup crashes, run Mix eval recovery, then start again.
  • Cover both CLIs with Elixir E2E on the shared suite.

Test plan

  • NO_WX=1 mix test test/e2e/rpc_test.exs test/e2e/restart_test.exs (macOS host)
  • CI macos-e2e, linux-e2e, and windows-e2e
  • Confirm --edw-rpc and --edw-recover together exit with a non-zero status

Made with Cursor

The host evaluates Elixir on a running node with erl_call.
After three startup crashes the host runs Mix eval, then starts again.

Co-authored-by: Cursor <cursoragent@cursor.com>

@cursor cursor Bot 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.

Cursor Bugbot has reviewed your changes using high effort and found 4 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit fc6a1fd. Configure here.

cmd << "cmd.exe /c \"" << bin << "\" eval \"" << expr << "\"";
} else {
cmd << '"' << bin << "\" eval \"" << expr << '"';
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Broken Windows recovery command quoting

High Severity

--edw-recover and automatic crash recovery wrap Code.eval_file("...") in extra quotes and pass it through cmd.exe /c. Nested " characters break Windows command-line parsing, so the Mix eval argument is split and recovery does not run.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit fc6a1fd. Configure here.

std::wstring wwd = utf8_to_wide(wd);
auto env = env_block(extra);
DWORD flags = CREATE_UNICODE_ENVIRONMENT | CREATE_NO_WINDOW;
if (!CreateProcessW(nullptr, mutable_cmd.data(), nullptr, nullptr, TRUE, flags, env.data(),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Recovery spawn lacks a console

Medium Severity

Windows recovery eval is launched with CREATE_NO_WINDOW and no new console. Packaged start already uses CREATE_NEW_CONSOLE because OTP 26's logger crashes or enters nouser without real stdio. Automatic recovery from the GUI host can fail even when a script is present.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit fc6a1fd. Configure here.

let proc = Process()
proc.executableURL = URL(fileURLWithPath: erlCall)
proc.arguments = args
proc.environment = ProcessInfo.processInfo.environment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

macOS RPC drops extra environment

Medium Severity

macOS --edw-rpc sets erl_call's environment to the process environment only and skips ini [env]. Linux and Windows merge extra_env, and macOS recovery already does. RPC on macOS can miss PATH or other release overrides required to reach the node.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit fc6a1fd. Configure here.

if (beamcli::maybe_run_exclusive(config, &exclusive)) {
CoUninitialize();
return exclusive;
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Windows restart cap exits successfully

Medium Severity

After restart_max_attempts the Windows host posts PostQuitMessage(1) but wWinMain always return 0. Linux and macOS now exit(1) on the same path. Crash-loop termination therefore looks like success to Windows launchers and scripts.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit fc6a1fd. Configure here.

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.

1 participant