Skip to content

Deliver Windows launch links once - #18

Merged
dominicletz merged 2 commits into
masterfrom
windows/launch-args-once
Nov 2, 2026
Merged

dominicletz merged 2 commits into
masterfrom
windows/launch-args-once

Conversation

@dominicletz

@dominicletz dominicletz commented Nov 1, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Pass cold-start arguments to the Windows BEAM only on the first spawn, so a crash restart does not open the original link again.
  • Queue host notifications until an Elixir client is connected, and hold event.system.open_url in the event bridge until Desktop.Env is up.

Test plan

  • Launch with a protocol URL, crash the BEAM, and confirm the link is not handled again on respawn.
  • Activate a second protocol URL while the BEAM is down, then confirm it arrives after the client reconnects.

Made with Cursor


Note

Medium Risk
Changes cold-start argv/env forwarding and the timing of open-url delivery across BEAM restarts and RPC connect; incorrect behavior could drop or duplicate deep links.

Reviewed by Cursor Bugbot for commit 842e340. Configure here.

Summary

  • Pass cold-start arguments to the Windows BEAM only on the first spawn, so a crash restart does not open the original link again.
  • Queue host notifications until the Elixir client finishes initialize. TCP accept is too early: Transport.connect/2 discards every frame except that reply, so a protocol URL queued while BEAM was down never reached EventBridge.
  • Hold event.system.open_url in the event bridge until Desktop.Env is up.

Test plan

  • Launch with a protocol URL, crash the BEAM, and confirm the link is not handled again on respawn.
  • Activate a second protocol URL while the BEAM is down, then confirm it arrives after the client reconnects and finishes initialize.
  • mix test test/desktop_webview/transport_connect_test.exs — a notification written before the initialize result is dropped; one written after it is delivered.
Open in Web Open in Cursor 

…connects.

A beam restart was opening the original URL again, and a link that arrived with no client was discarded.

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 default effort and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix is ON, but it could not run because on-demand usage is turned off. To enable Bugbot Autofix, turn on on-demand usage and set a spend limit in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 842e340. Configure here.

Comment thread native/windows/src/rpc_server.cpp Outdated
client_sock_ = s;
buffer_.clear();
WSAAsyncSelect(client_sock_, notify_hwnd_, WM_EDW_SOCKET, FD_READ | FD_CLOSE);
flush_queued();

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Queued links lost on reconnect

High Severity

flush_queued runs in accept_client as soon as the TCP socket is accepted, before the Elixir client finishes initialize. Transport.connect/2 is still in recv_result/3 and discards any frame that is not that initialize reply, so a protocol URL queued while the BEAM is down is consumed and never reaches EventBridge.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 842e340. Configure here.

flush_queued ran as soon as the TCP socket was accepted. Transport.connect
is still in recv_result and drops every frame except the initialize reply,
so a protocol URL queued while BEAM was down never reached EventBridge.

Co-authored-by: Dominic Letz <dominicletz@users.noreply.github.com>
@dominicletz
dominicletz merged commit 452fde8 into master Nov 2, 2026
4 checks passed
@dominicletz
dominicletz deleted the windows/launch-args-once branch November 2, 2026 23:58
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