Repository navigation
fix(launcher): System32 tools, instance-lock contention vs failure, fragment-only credentials - #330
Closed
dovvnloading wants to merge 3 commits into
Closed
dovvnloading wants to merge 3 commits into
dovvnloading wants to merge 3 commits into
Conversation
… PATH The WebView2 signature check (the gate before the bundled installer runs), the private-folder ACL and the dev-server tree kill started their tools by bare name, so whichever powershell.exe, icacls or taskkill came first on a user-modified PATH ran instead. core/win_paths.system32() resolves them under the directory GetSystemDirectoryW reports (%SystemRoot% / %windir% only as a fallback), with PowerShell's WindowsPowerShell\v1.0 subfolder, and falls back to the bare name only when that absolute path does not exist. Plan item: LP-12 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…log every failed exit InstanceLock.acquire() returned None for every failure -- an icacls error, a lock file that could not be opened, a secret or record that could not be written -- exactly as it did for "another Cortex holds the lock". The launch then went looking for a running instance that did not exist and exited 2. acquire() now returns None only for a contended lock (EACCES/EAGAIN/ EWOULDBLOCK/EDEADLK from the lock call, or from writing the locked byte) and raises InstanceLockError(reason) for anything else; _run_web records it under the stage "instance lock" and the dialog names the --data-dir remedy. The lock-file size is read with fstat instead of reading the byte, which fails under a held lock, and normalising writes go straight to the descriptor. Several failing exits (no record behind a held lock, a dead holder's lock that never frees, an unreadable handoff secret, a headless backend that stopped on its own) printed to a console a windowed build does not have and wrote no startup diagnostic, while the dialog said the log "could not be written". Every non-zero exit now goes through _fail(stage, message, code), which writes the diagnostic and prints; the dialog only mentions an unwritable log when a write was actually attempted. Plan item: LP-10 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
readLauncherCredentials() still honoured ?bootstrap= and ?handoff= in the query string, although the launcher has only ever sent them in the fragment (main.py _desktop_url), which never reaches a server, a request line or a log. Nothing in production used the query branches -- only the Playwright specs and the screenshot scripts did. The query is no longer read (it is still scrubbed from the address bar), and those specs and scripts now open /#bootstrap=... like the launcher does. Plan item: LP-02 (remainder) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Owner
Author
|
Superseded by #331, which combines this with the other pending fixes into one pull request. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Three launcher defects:
powershell.exe,icaclsandtaskkillby bare name.PATHran instead of Windows' own.InstanceLock.acquire()returnedNonefor every failure, exactly as for "another Cortex holds the lock". That included an icacls error, a lock file that could not be opened, and a secret or record that could not be written.readLauncherCredentials()still honoured?bootstrap=and?handoff=in the query string.main.py_desktop_url), which never reaches a server, request line or log. Only Playwright specs and screenshot scripts used the query form.Change
One commit each.
core/win_paths.system32(name)resolves under the directoryGetSystemDirectoryWreports, with%SystemRoot%/%windir%only as a fallback. PowerShell is looked up inWindowsPowerShell\v1.0. It falls back to the bare name only when that absolute path does not exist. It is used at all three call sites.acquire()returnsNoneonly for a contended lock. That meansEACCES/EAGAIN/EWOULDBLOCK/EDEADLKfrom the lock call or from writing the locked byte.InstanceLockError(reason). Its message is fixed text plus the OS error's class name, never a path or secret._run_webrecords it under the stage "instance lock", and the dialog names the data-folder remedy.fstat(reading a locked byte fails), and normalising writes go straight to the descriptor._fail(stage, message, code), which writes the diagnostic. The dialog mentions an unwritable log only when a write was attempted./#bootstrap=...as the launcher does.Not included from the original branch, because they add features rather than fix defects: remembering the window's size and position, and asking before closing during a reply.
Compatibility and rollback
Checks
Windows, Python 3.14 unless stated.
python -m pytest -q tests/test_launcher.py tests/test_win_paths.pygives 222 passed. Python 3.12 (py -3.12): 222 passed.npx vitest run src/app/App.test.tsxgives 39 passed.origin/main. Instead, the old behaviour was put back inside the new code:_contended()made to always returnTrue(every failure treated as contention), andsystem32()made to skip the system directory. Result: 6 failed, 216 passed, includingtest_instance_lock_distinguishes_contention_from_setup_failure, the PowerShell, icacls and taskkill path tests, and the WebView2 check.scripts/check.ps1quick tier): all 11 checks passed in 637 s (backend 450.8 s, vitest 99 s).Security
PATHdependency from the installer's signature gate.Limits
Plan item: LP-12, LP-10, LP-02 (remainder)
🤖 Generated with Claude Code