Skip to content

fix(launch): only links on the app's own scheme are links; the value of --server is not one - #1195

Merged
Hona merged 5 commits into
devfrom
review-fix/url-schemes-app
Nov 25, 2026
Merged

Hona merged 5 commits into
devfrom
review-fix/url-schemes-app

Conversation

@Hona

@Hona Hona commented Nov 25, 2026 •

Copy link
Copy Markdown
Member

Started as opencode-rune --server http://127.0.0.1:4096, the app took the server's URL for a link.

Stacked on #1192 (the Rune pin that has rune::url_schemes, anomalyco/rune#2182). Until #1192 merges, this PR's diff also shows its three files; it merges after #1192, rebased onto dev.

What went wrong

  • Rune treated every scheme:// launch argument as a link. The app's link handler got http://127.0.0.1:4096 and printed ignored a link it doesn't open on every such launch.
  • A second launch with that flag was handed to the running app as a link, not as a launch without links. Only a launch without links reopens the app and brings its window forward.

Change

One line before single_instance: rune::url_schemes([launch::product().scheme()]). From then on only arguments on the app's own scheme are links: jump list entries, notification clicks, deep links and the Console's return all use that one scheme.

OpenCode Desktop's Electron shell does the same by hand: only arguments that start with opencode:// are links (packages/desktop/src/main/lifecycle/launch-links.ts).

Run

Before this line existed here, the same line was run on a build pinned to the Rune change (Windows x64, and Linux x64 in a headless Wayland compositor): the ignored a link line went from 1 after the first launch and 2 after a second launch with the same arguments to 0 and 0; a link on the app's own scheme still reached the handler.

On this PR's own Windows x64 CI build (0f400d067) against #1192's build (60eda7d40, the same tree without the line): a real window started with --server http://127.0.0.1:<port>, then a second launch with the same arguments, then a third with none. ignored a link lines on the first window's output:

#1192 This PR
After the first launch 1 0
After the second launch 2 0
After the third launch 2 0

The later launches exit 0 in 10 to 17 ms on both.

The same three launches on the re-keyed head (864fc3932 against #1192's 9bc491fdcd): 1 / 2 / 2 lines against 0 / 0 / 0 again.

Launch pair (the line is on the launch path). Windows x64, real windows, this PR's build of 864fc3932 against #1192's build of 9bc491fdcd (the same tree without the line, the same re-keyed profile), and #1192's build a second time as a control; three sides in turn, 26 counted rounds a side after 2 not counted, the app's own launch trace; every side had the exe's page list in 26 of 26 launches; ms, paired medians:

Row This PR against the control This PR against #1192 #1192 against itself (the control)
First frame presented -1.55; slower in 12 of 26 +4.85; 18 of 26 +4.55; 16 of 26
First frame less main entered +0.35; 14 of 26 +2.30; 18 of 26 +1.45; 14 of 26
Content live -0.80; 13 of 26 +6.45; 17 of 26 +2.45; 14 of 26
Record in hand after main +0.06; 14 of 26 +0.03; 13 of 26

So the line is flat against the same build run a second time. The first-named side of a three-sided run reads about 4.6 ms faster than a second copy of itself (2 ms of it before main is entered, so before any code of the app); that is the method's, not this change's, and it is why the control column is the one to read.

Linux x64 (a headless compositor, the build of 0f400d067, which differs from this head only by profile files no Linux build reads): to be added when its lab run is in.

Not run: macOS; a second launch that brings the window forward (read from Rune, not observed); Linux arm64 (not built in a PR run).

Head 5a0200c47 = dev 866dd4ec76 (which holds the pin bump, #1192, as 866dd4ec76) taken in by a normal merge, plus the one call. The runs and the tables above were made on 864fc3932 (the bump's branch at 9bc491fdcd + the same line); this head differs from that by dev's own commits only, and from dev by three lines in apps/desktop/src/lib.rs: the call and its two-line comment.

Hona added 5 commits November 25, 2026 20:08
…of --server is not one

Rune took every scheme:// launch argument for a link. Started as 'app --server http://127.0.0.1:4096', the app got the server's URL in its link handler ('ignored a link it doesn't open'), and a second launch with that flag was handed over as a link, not as a launch that reopens the app. The app now names its scheme (rune::url_schemes, anomalyco/rune#2182, in the pin of #1192).
A pin move renames every Rune symbol, so the committed profiles were dead for Rune's code on this branch's first commit. Both are re-keyed onto this tree's names, read from the instrumented build of #1193 (scripts/pgo-rekey.mjs).

Windows x64: the counts trained on 25 Nov (launch weight 1): 17,961 of 18,439 functions keep their counts, 337 are dropped because their code changed, 141 no longer exist.
Apple silicon: the committed profile, not trained anew: 15,030 of 15,445 kept, 285 dropped, 130 gone.
@Hona
Hona marked this pull request as ready for review November 25, 2026 15:54
@Hona
Hona merged commit 5dac1b2 into dev Nov 25, 2026
7 checks passed
@Hona
Hona deleted the review-fix/url-schemes-app branch November 25, 2026 16:21
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