Repository navigation
fix: pin localmodels 0.1.0.dev40, recover a not-ready local model launch, clean up failed installs - #236
Closed
oldwinter53 wants to merge 3 commits into
Closed
fix: pin localmodels 0.1.0.dev40, recover a not-ready local model launch, clean up failed installs#236oldwinter53 wants to merge 3 commits into
oldwinter53 wants to merge 3 commits into
Conversation
0.1.0.dev40 replaces a Pi that cannot load extensions when the stack is applied again, reports it in setup binding as pi-extensions-unavailable, fails harness apply with RUNTIME_ACTION_FAILED or RUNTIME_EXTENSIONS_FAILED instead of exiting 0 after an incomplete install, refuses an unusable SIMPLEX_PI_PATH and a too-long Windows runtime root at plan time, reports GPU and free-memory shortfalls with byte figures, and stops the library Bifrost on stack down. - Pin 0.1.0.dev40 in the three desktop distributions and in scripts/installs/stack.sh and stack.ps1, copied from the published launchers; the three tool archives and both launchers were checked against the release's SHA256 and size. - Point the run-without-cloning URLs in scripts/installs/README.md at the pinned version, and sync the stack pins in scripts/install with scripts/sync-install-stack-pin.mjs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…aves behind A start whose lease identity could not be proved left its supervisor and service running with no record, so PostgreSQL kept postmaster.pid and every Try Again failed until the processes were killed by hand. - When a start fails before its record is kept and the lease cannot be proved, end the process group of the supervisor it spawned and has not reaped yet; that PID cannot belong to another program. - On macOS and Linux, reclaimNativeOrphans now also ends a supervisor whose command line names a job file in the instance's process directory under a lease no record holds, once its environment proves the lease; the services step runs it before PostgreSQL starts, so a state an earlier release left heals on the next attempt. - Split the POSIX stop of one lease out of stopNativeProcess to share it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…en the stack is not ready A launch that found the local model stack not ready failed with LOCAL_MODELS_RECOVERY_REQUIRED and asked to review an updated plan, which the start failure page cannot do; Try Again failed the same way and Set Up Again was the only way out. A 0.1.3 Pi installed without extension support reports pi-extensions-unavailable from localmodels 0.1.0.dev40 the same way. - When the saved binding for the approved plan is not ready and the saved plan inputs still match, apply that plan again and bind once it verifies; changed inputs still need a new review. The binding's reason codes go out in details.reasons and to the installer log. - The desktop's start failure words the first known reason code and names the action that works for LOCAL_MODELS_RECOVERY_REQUIRED (Try Again) and LOCAL_MODELS_APPROVAL_REQUIRED (Set Up Again). - Map localmodels harness errors to structured failures: a refused harness plan (unusable SIMPLEX_PI_PATH, a Windows runtime root too long for Pi without long paths) is RUNTIME_PLAN_REFUSED, and RUNTIME_ACTION_FAILED and RUNTIME_EXTENSIONS_FAILED keep their codes through dependency preparation and into the failed job's errorCode. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Request changes (1 P1, 1 P3)
Scope: base main, merge base 080cbcf9. I reviewed 3 commits and 26 files at 5b9ccf3c. Loaded skills: coderbook, ponytail-review and karpathy-guidelines. The review ran in a separate session.
Findings
P1
packages/local-installation/src/native-process.ts:769: the macOS process listing in ownCommands truncates command lines, so the new POSIX reclaim matches nothing on macOS
- Problem:
ownCommandsruns/bin/ps -axo pid=,uid=,command=with noww. When stdout, stderr and stdin are not terminals, macOS (BSD)pscuts each line to about 79 columns unless-wwis passed. Two existing call sites pass it for exactly this reason:native-process-identity.ts:221,302(eww) and the daemon'sagent_chrome.go:42andagent_browser.go:298(-axww). - Failure scenario: The installer manager and the desktop app run
psthrough pipes, so the command column is cut to about 79 characters. A supervisor's command line is longer than that: the node exec path, then.../native-process-worker.mjs, then~/Library/Application Support/.../native/processes/postgres.<64 hex>.job. TheindexOf(jobs)lookup and the^name.lease.jobmatch therefore never succeed.reclaimUnrecordedLeasesreturns[], and an unrecorded supervisor and PostgreSQL left by 0.1.3 keeppostmaster.pidagainst every retry. That is the macOS case this PR names: "a state left by 0.1.3 heals on the next attempt" and the macOS RC check list. Linux reads/proc/<pid>/cmdlineand is unaffected, which is why the newnative-process.test.tscase passes in CI. - Fix: Use
["-axww", "-o", "pid=,uid=,command="]. Ideally also add a darwin unit test likenative-process-darwin.test.tsthat asserts thewwargument, or feeds longpsoutput.
P3
apps/desktop/src/main/local-server.ts:2695: RESUME_ACTIONS gives "Try Again" for every LOCAL_MODELS_RECOVERY_REQUIRED, including the case where retrying cannot help
prepareLocalModelsreturns the same code when the saved inputs no longer authorize the plan (!approvedInputs, for example a missing or damagedinputsfile). The page then shows "…Review a new plan…" followed by "Try Again to apply the approved local model plan again". In that case Try Again fails the same way every time.- Give that branch a distinct code that maps to the Set Up Again action, or carry a structured flag in
details, so the action text stays code-driven.
Verified as fine
prepareLocalModels:- The re-apply path runs only when a saved binding names the current
planId,localModelsReplanis unset, and the saved inputs match (planId,shareGpu,decision === false). A missing or damaged inputs file never authorizes an apply. - The result is persisted only after
setup bindingreports ready. reasonsare validated (^[a-z][a-z0-9-]{0,63}$) before they go intodetailsand the log. The upstream message is trimmed and capped at 300 characters, for display only.
- The re-apply path runs only when a saved binding names the current
- Desktop
#runResume: messages are keyed bydetails.codeand reason codes throughObject.hasOwnlookups. Nothing matches on prose. endUnreapedGroup: it signals-pidonly while Node has not reaped the child. After that, a live group ID cannot be reused. It is unreachable on Windows, which returns earlier.stopLeaseextraction: record removal still happens only after a successful POSIX stop, and theNATIVE_PROCESS_REPLACEDpath behaves as before.reclaimUnrecordedLeases: it requires a recorded-lease miss, this instance's job directory, a known service name, and a lease proved through the process environment (nativeProcessIdentity) before it signals anything. The services step andstopNativeSourcecall it underwithInstanceLock.runtimeFailureCodereplaces the two duplicatedLOCALMODELS_RUNTIME_UNAVAILABLEchecks.RUNTIME_ACTION_FAILEDbecomesRUNTIME_PLAN_REFUSEDonly forharness plan. The installer copies these codes toerrorCodeonly forfailedjobs, and no desktop or installer UI consumer assumes a closed set.- Pins: the darwin, linux and win32 distribution JSON,
stack.shandstack.ps1, the README URLs and thescripts/installpins all move together to dev40. - Docs:
apps/desktop,apps/linger-installerandpackages/local-installationAGENTS.mdare updated for the new behavior. - Tests: there are tests for the re-apply branches, the error-code mapping, job
errorCode, the resume copy, the unverified-start cleanup and the reclaim of an unrecorded lease.
Process notes
- No merge commits and no fixup commits. The branch is up to date with
main.BLOCKEDreflects required review only. Commits are authored by linked accountoldwinter90.
CI
- All checks pass: desktop, installer, packages, teamhub-cli, web, web-static, repository-gate, CodeQL and the three web test shards.
computer-go,contractsandteamhubwere skipped by path; the PR doesn't touch them.- CI runs on Linux, so the macOS
pspath inownCommandsis untested. I ran no tests myself.
Automated review by Claude Code
Automated review of 5b9ccf3 by Claude Code.
This was referenced Nov 18, 2026
Author
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.
Summary
0.1.4 group B and C2 from the fix list: pin localmodels 0.1.0.dev40, recover a launch whose local model stack is not ready, and clean up after a failed install attempt so Try Again works without killing processes by hand (P1-10, P1-8, #173).
B: localmodels 0.1.0.dev40 (
45eaccab)apps/desktop/distribution/{darwin-arm64,linux-x64,win32-x64}.json, and inscripts/installs/stack.shandstack.ps1, copied byte for byte from the published launchers. Also updates the README run-without-cloning URLs and syncs thescripts/installpins withsync-install-stack-pin.mjs.648e8909…, linux-x64 20790291 Ba8e176fa…, win32-x64 23191788 Bde073060…, stack.sh 15225 Bf4bc0795…, stack.ps1 32584 B04fff205….pi-extensions-unavailable, and stack apply replaces a jiti-less Pi. Harness apply now exits 1 withRUNTIME_ACTION_FAILEDorRUNTIME_EXTENSIONS_FAILED. A plan with an unusableSIMPLEX_PI_PATH, or a Windows runtime root longer than about 90 characters without LongPathsEnabled, is refused at plan time. Stack down also stops the library Bifrost.C2: launch recovery (P1-10,
5b9ccf3c)Root cause:
prepareLocalModelsonly observed the saved binding. When the binding was not ready it returnedLOCAL_MODELS_RECOVERY_REQUIREDwith "Review an updated plan". The start-failure page has no way to do that, so Try Again failed the same way and Set Up Again was the only exit. On dev40, a 0.1.3 machine with a jiti-less Pi reportspi-extensions-unavailableand lands on the same dead end.packages/local-installation/src/local-models.ts: when a binding saved for the approved plan is not ready, and the saved plan inputs (planId, GPU sharing, no decision model) still match the current choices, the approved plan is applied again withstack apply --approve <planId>. The result is bound only once setup binding verifies it. This covers every binding reason,pi-extensions-unavailableincluded. Only a plan the person approved is ever applied: changed inputs still need a new review, and a missing or damaged inputs file never authorizes an apply. The binding's reason codes go out indetails.reasonsand to the installer log.apps/desktop/src/main/local-server.ts(#runResume): the start-failure text puts the first known binding reason code in Linger's own words, for example "The local model's Pi can't load extensions, which every Linger run needs." Then, keyed bydetails.code, it names an action that works. ForLOCAL_MODELS_RECOVERY_REQUIREDthat is Try Again, which now applies the approved plan again, or Set Up Again. ForLOCAL_MODELS_APPROVAL_REQUIREDit is Set Up Again. All of this is driven by codes; nothing matches on prose.packages/local-installation/src/managed-runtimes.tsanddependencies.ts: localmodels harness errors now become structured failures.RUNTIME_ACTION_FAILEDfromharness planbecomesRUNTIME_PLAN_REFUSED(unusableSIMPLEX_PI_PATH, or a Windows runtime root too long for Pi).RUNTIME_ACTION_FAILEDandRUNTIME_EXTENSIONS_FAILEDfrom apply keep their own codes. They used to be folded intoLOCALMODELS_RUNTIME_UNAVAILABLE.apps/linger-installer/src/server/jobs.tsputs these codes on the failed job'serrorCodeinstead ofINSTALL_FAILED.RUNTIME_ACTION_FAILEDat plan time. Linger therefore reports it asRUNTIME_PLAN_REFUSEDand shows the upstream cause text, which names the root length and long paths. Telling it apart from other plan refusals needs a distinct code from localmodels. Linger does not copy the 90-character budget or the registry check.C2: failed-install cleanup (P1-8 / #173,
7270430a)Root cause: when
startNativeProcesscould not prove the new supervisor's lease identity (on 0.1.3 this was the localizedps lstart), its cleanup also found nothing by lease. The supervisor and PostgreSQL kept running with no record, and every Try Again then hitpostmaster.pid already existsor "identity could not be verified".packages/local-installation/src/native-process.ts, failed start: when the lease cannot be proved, the start now ends the process group of the supervisor it spawned and has not reaped yet. That PID cannot belong to another program.reclaimNativeOrphanson macOS and Linux: it now also ends a supervisor whose command line names a job file in this instance's process directory under a lease no record holds, once that process's environment proves the lease. Windows already did this. The services step runs it before PostgreSQL starts, so a state left by 0.1.3 heals on the next attempt.stopNativeProcessso both paths share it.installer.js) still stays up for its idle timeout after a failed job. It does not block Try Again, which reuses that manager.Docs
apps/desktop/AGENTS.md,apps/linger-installer/AGENTS.mdandpackages/local-installation/AGENTS.mdare updated for the resume re-apply, the reason and action copy, the runtime error codes, and the POSIX reclaim.Critical path
Nothing here touches the user message →
provider_readypath. The extra work runs only while installing or resuming: onestack applywhen the stack is not ready, and one process listing of this user's processes before services start.Tests (each written first, failing before the fix)
local-models.test.ts: a not-ready binding (deployment-unavailable,pi-extensions-unavailable) applies the approved plan again and binds. A stack still not ready asks for recovery and keeps the earlier binding and its reasons. A failed re-apply reports the upstream cause. Changed GPU sharing never re-applies.managed-runtimes.test.tsanddependencies.test.ts: plan refusal maps toRUNTIME_PLAN_REFUSED(Windows long-root text); apply keepsRUNTIME_ACTION_FAILEDandRUNTIME_EXTENSIONS_FAILED.jobs.test.ts: the runtime cause becomes the failed job'serrorCode.local-server.test.ts: the resume failure names the action for each code and wordspi-extensions-unavailable.native-process-unverified.test.ts(new) uses real processes. When every identity check fails, the start still ends the supervisor and the service.native-process.test.tsuses real processes. A service whose record was lost is reclaimed, and a recorded one is untouched.make check BASE=origin/main: repository, docs, packages, teamhub-cli, installer, desktop, scripts-fast and web all pass.make check-repository-gate BASE=origin/mainpasses.native-process.test.ts("cleans the launched owned group when identity persistence fails", which this PR does not touch) timed out twice while the host load average was 47–70. It passed 3 of 3 standalone runs and themake check-packagesrerun.Real-machine checks for the 0.1.4 RC round (not run here)
stack down, or kill the llama server), quit, and launch. It should start because the resume applies the approved plan again. Also try Unload, then upgrade 0.1.3 → 0.1.4.native-process-worker.mjsorpostgres -D …should remain from the first attempt.pi-extensions-unavailable, stack apply should replace Pi, and a Pi chat with the computer tools should work.SIMPLEX_PI_PATHshould fail witherrorCodeRUNTIME_PLAN_REFUSEDand show the upstream cause.RUNTIME_PLAN_REFUSED, text naming the root length), not fail mid-install.Overlaps
#213 and #224 edit the same
apps/desktop/distribution/*.jsonlines, so they rebase over one URL/sha change. This PR does not touchlocal-server.tssections they edit beyond#runResume.🤖 Generated with Claude Code