On Windows, opening magpie from the Start menu while it already ran took
over 10s to show the window, longer than a cold start. fb6b4de0a made
every start wait, up to 30s, for the WebView2 profile folder's lockfile
before the app is made. A second launch hands over to the running magpie
only as the app is made (Wails' single instance, in application.New), and
the running magpie's WebView2 holds that folder for as long as it runs,
so every second launch waited the whole 30s, then handed over.
Now the wait is skipped when Wails' single instance mutex for this config
(wails-app-<id>-sim) is held: a magpie runs, and the launch goes straight
on to hand over. A restart after an update or a failed WebView2 start
still waits: the magpie before has ended by then (AwaitPredecessor), so
the mutex is free and only its msedgewebview2 can still hold the folder.
Run:
- Reproduced on xiaomi-gpu (Windows 11) with builds of 406ad72f1 and of
this commit, sandbox USERPROFILE/APPDATA/LOCALAPPDATA, MAGPIE_ADDR
:3461, HKCU magpie/ccswitch/App Paths/Uninstall keys exported and put
back. ssh has no desktop (the real app crashes in uxtheme there, and no
one was signed in for an interactive task), so a stand-in held what a
running magpie holds: the single instance mutex for the sandbox's
config and EBWebView\lockfile without sharing. Launching magpie.exe
with no arguments, as the Start menu does, three times each: before,
the launch quit after 30240, 30232, 30234 ms ("still held by another
process after 30s"); after, 189, 161, 166 ms. That Wails took the
launch for a second one also shows the mutex name matches Wails'.
- TestWebView2ReadyDoesNotWaitOnTheRunningMagpie (Windows): red with the
held check turned off by hand (waited 20.06s), green with it.
- go test -count=1 ./internal/gui on mote: ok (150s). On xiaomi-gpu: 9
reds, the same 9 at origin/main 633ab58e9 and all filed (#6068, #5324,
#5928, #6059).
- gofmt -l; go vet ./internal/gui on darwin, windows, linux -tags nogui
and windows -tags nogui (on mote: mica is out of disk).
Not tried: the real tray app with a desktop session and a Start menu
click, for the reason above.
Paseo (getpaseo/paseo) starts the same Claude Code, but builds its own model
list: first-party models plus settings.json's `model` and a few
ANTHROPIC_*_MODEL variables (providers/claude/models.ts). It never reads
Claude Code's modelPicker, where magpie writes every model, so the rest were
not selectable in Paseo. Paseo's own ~/.paseo/config.json takes
agents.providers.claude.additionalModels ([{id,label,description}], checked
against protocol/src/provider-config.ts) and passes each id to Claude Code as
written.
New agent "Paseo" (detected by ~/.paseo or PASEO_HOME): its switch writes the
models Claude Code's /model lists (same ids, [1m] marks, names; only the ones
picked for it) there, marked "via magpie" in the description; the user's own
entries and keys stay, off takes out only magpie's, a sync refreshes when on.
Claude Code must be connected to magpie as well.
Run (mote-run, sandbox HOME in tests): TestPaseoAdditionalModels,
TestStateListsPaseo, internal/agentenv, internal/gui full package ok;
internal/agent full run red only on TestPiGroupEntryKeepsItsMembers, which is
red the same on origin/main 12cd456f2 (passes alone; filed). gofmt clean,
vet darwin, windows and linux nogui on internal/agent. Broken by hand: Set
writing no models goes red.
Not tried: a real Paseo daemon reading the file (checked against its schema
source only); GUI browser suites.
0.1.3688 on Windows 11: after a restart by a script, "timed out after 1m0s
waiting for the WebView2 controller" and the window never came back. Wails
waits 60s in Embed for a controller, then exits the process (ErrorHandler
runs, then os.Exit). The cause is a start that meets the previous magpie's
msedgewebview2 still holding the profile folder (EBWebView\lockfile, opened
without sharing).
- Before the first window, the start waits (30s at most) until the profile
folder's lockfile can be opened, i.e. the old WebView2 has let go. The
folder is the one passed to Wails, else Wails' %AppData%\<exe name>.
- ErrorHandler now logs the error with the WebView2 runtime version, the
folder and whether another process holds it.
- On a WebView2 failure the process starts itself again (update.Respawn,
MAGPIE_REPLACES set so the new one waits for this one to exit), backing
off 2s, 4s; after 3 starts a box says what failed and what to do.
Run: gofmt; go vet darwin, GOOS=windows, GOOS=linux with and without
nogui; go test of the WebView2 tests on mote; the same on xiaomi-gpu via
win-run, where TestWebView2FreeSeesTheHeldLockfile holds a real
non-shared file and goes red when webView2Free is forced true (broken by
hand). Full gui/update/proc packages on mote.
Not tried: a real WebView2 timeout and the restart (the controller
timeout can't be forced here without the live app); Wails still exits
the process after the handler, so the tray does not stay up through a
failed start, it is started again instead.