ollama converge: wait for it before the first start, read the binary's own version, keep ROCm (#1511) - #1512
Merged
Merged
Conversation
…s own version, keep ROCm (#1511) The daemon's start-up converge had four problems, all read from the code: 1. It read the wrong version. `ollama --version` asks the server on OLLAMA_HOST's default, 127.0.0.1:11434, and waired's engine runs on its own port. ParseEngineVersion preferred the server's line, so on a host whose own Ollama runs another release the bundled engine read as off the pin, and the converge downloaded it again on every start. ollama's versionHandler prints the binary's own version as "client version is" whenever it differs from the server's, and that line now wins. 2. It dropped ROCm. The daemon installed with no overlay decision while the promotion replaces lib/ wholesale, so an AMD host lost ROCm at every pin move on the apt path. setup.OllamaROCmOverlayWanted is now the one answer, for the CLI on all three OSes and for the daemon, which starts its converge once the profiler exists (still ahead of anything that can fail the subsystem). 3. It swapped bin/ and lib/ under a running `ollama serve`. The daemon spawns an off-pin engine as normal (ExpectedVersion only guards adoption), and ollama launches its runners from its own directory on every model load. A load mid-swap found lib/ half gone; a load after it ran new runners under an old server; on Windows lib/ was deleted before the locked exe failed to go, with nothing restored. The ollama adapter now waits on a StartGate that the converge's ollama pass releases, however it ends. Nothing is serving at daemon start, a host at the pin waits one `--version`, and a wait ended by Stop or Park is not counted against the engine (ErrEngineStartHeld). The promotion also moves the previous install aside and back on any failure, instead of deleting it first. 4. The daemon's and the installer's converges shared one staging directory on the apt path. Installs now take <BaseDir>/.install.lock (flock on Linux and macOS; Windows needs none, because install.ps1 stops the service first), and ConvergeOllama probes again once it holds the lock. `runtimes install ollama` and `runtimes upgrade ollama` take it too. Decision: docs/decisions/20260921/1937-engine-start-waits-for-the-engine-update.md (partly supersedes 20260816/2243). docs-site update page (en/ja) gets one sentence about local inference starting after a background engine update. Fixes #1511 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BviBGHJqCeM88hxCRYrtAg Signed-off-by: gen16k <gen16k@users.noreply.github.com>
|
📘 Docs preview — the preview channel for this PR has been deleted now that it is closed. |
Contributor
Author
|
Hardware check after merge, 2026-09-21. The build was main plus #1514; each host moved from its installed ollama to the 0.34.2 pin at start.
Every host was restored to its previous build and engine afterwards. — #1361-L107 |
gen16k
added a commit
that referenced
this pull request
Sep 21, 2026
…#1517) Knowledge note from putting three hosts back after a test build moved the bundled ollama 0.33.3 -> 0.34.2 -> 0.33.3 (#1512 / #1514 hardware checks): build from main to see the converge at all, restore the runtime bin from the backup, remove ollama 0.34's models/metadata and the install lock, keep the Windows bench cache (schema v4 vs v5), engine.log keeps one generation, and macOS's first start after the move timed out its own GPU discovery. Claude-Session: https://claude.ai/code/session_01BviBGHJqCeM88hxCRYrtAg Signed-off-by: gen16k <gen16k@users.noreply.github.com> Co-authored-by: gen16k <gen16k@users.noreply.github.com> Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
This was referenced Sep 21, 2026
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.
Fixes #1511
Why
The daemon's start-up converge of the bundled ollama had four problems. All were found by reading the code; a hardware check follows below.
ollama --versionasks whatever server listens onOLLAMA_HOST's default,127.0.0.1:11434. waired's engine runs on its own port, so the server that answers there is the user's own Ollama if they have one.ParseEngineVersionpreferred the server's line. On a host whose own Ollama runs a different release, the bundled engine read as off the pin, and the converge downloaded the pin (about 1.4 GB) again on every daemon start.NewOllamaConvergeDepsinstalled without an overlay decision, and the promotion replaceslib/wholesale. On the apt path, an AMD host lost ROCm at every pin move.bin/andlib/under a runningollama serve.ExpectedVersiononly guards adopting an orphan.lib/half gone. A load after it ran new runners under an old server.lib/was deleted before the locked, runningollama.exefailed to go, and nothing was restored.<BaseDir>/.stage.Change
internal/hardware/profiler.go). ollama v0.34.2'sversionHandlerprints the server line, thenWarning: client version is Xwhenever the two differ or no server answers. The client line now wins.setup.OllamaROCmOverlayWanted(goos, profile, gpuMode)):WAIRED_OLLAMA_GPU_MODEis still read on Windows only.NewOllamaConvergeDepstakes it, and the daemon starts the converge right after the profiler is built. That is still ahead of anything that can failstartInferenceSubsystem, so a host whose engine choice errors is still converged.OllamaConfig.StartGate, wired toengineStartGate, which the converge's ollama pass releases however it ends):--version;ErrEngineStartHeld);engine start is waiting for the bundled engine update to finishonce.OllamaInstaller.Lock):<BaseDir>/.install.lock, on Linux and macOS;ConvergeOllamadecides unlocked, then takes the lock and probes again;runtimes install ollamaandruntimes upgrade ollamatake it too.20260921/1937, which partly supersedes20260816/2243(links in both directions; the guard passes);getting-started/update.mdx(en/ja): one sentence saying local inference starts after a background engine update has downloaded.User-facing wording added (draft, for owner review)
Another engine install is running on this computer; waiting for it to finish...Tests
TestParseOllamaVersion_TheBinarysOwnVersionWins. This invertsTestParseOllamaVersion_ServerLineWins. The old fixture put the lines in an order ollama never prints; the new one uses v0.34.2's real order.TestOllamaROCmOverlayWanted: GOOS × host shape × mode, including an AMD iGPU that is set aside, the Windows Strix Halo arm, and the mode being read on Windows only.TestOllamaAdapter_StartGate:starting, and there is exactly one spawn once it opens;TestStartFailureIsEvidence_AHeldStartIsNot.TestEngineStartGate: passes through once the update is done, logs the wait once, and a Stop ends the wait.TestConvergeOllama_ProbesAgainUnderTheLock: events run probe → lock → probe → unlock with no install; a host at the pin never locks.TestOllamaInstallerLock_ExcludesASecondHolder(Unix).TestPromoteStagedInstall_AFailureRestoresThePreviousInstall: each of the four renames fails in turn, for shared and exclusive destination directories, and the old tree comes back intact.TestRuntimesInstallOllama_TakesTheInstallLock(Linux).StartGatecases;go test ./...(exit 0);-raceon the gate tests;GOOS=windows|darwinvet andgo test -cforinternal/runtime,cmd/wairedandcmd/waired-agent;GOOS=windows, the only hit is the existingoom_score_other.go;Not in this PR
waired runtimes install ollamaalongside restarting. With the gate and the rollback-capable promotion, that is no longer unsafe, so its wording is left alone.waired runtimes install ollamaon a host whose engine is running;darwin_updatebefore the agent restarts.Verification on hardware
To follow:
ollama serveof another release on 11434 no longer triggers a re-download; the first start waits for the converge.Results will be added here.
🤖 Generated with Claude Code
https://claude.ai/code/session_01BviBGHJqCeM88hxCRYrtAg