Repository navigation
Plan 323 — Start Ollama from the banner and the page - #127
Merged
Merged
Conversation
…chine's executor A runtime on this machine that does not answer offers Start Ollama wherever the machine's executor is paired, in the chat's readiness banner and on This Computer, in place of the instruction to start it by hand. - The request travels a per-machine channel (hostRuntimeRequestChannel), published only by the operator's local-models route on a space admin's request; it names nothing to run but the port. - The executor starts Ollama as installed: a Homebrew service through `brew services`, another launch agent through `launchctl`, a Linux user unit, the macOS app, and only then `ollama serve`, detached and without the executor's environment. A service first, because its definition carries the runtime's settings: Homebrew's sets the q8_0 cache and flash attention the machine was measured with, which a bare serve drops. A system service is left to the administrator, with the command. - The server never starts it: in the appliance it runs in a container. Helmsman cannot either, and needs not: it cannot run without its runtime. - The publish-and-wait exchange the browser settings used moves into @aflow/redis (askHost) and serves both; probeEnv is shared by the host's three callers. - An action's refusal now shows on This Computer as well as in the banner. Proven on a Homebrew install: stopped with `brew services stop`, started by this code in about a second, with its environment intact. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
What it does
When Ollama on this machine doesn't answer, the chat's readiness banner and This Computer now offer Start Ollama, as long as this machine's host executor is paired. That replaces the instruction to open the app or run
ollama serve. Where nothing in Aflow can start it (a runtime on another machine, or no paired executor), the instruction stays as it was.How
Request. The operator's existing
POST /spaces/:id/local-models/actionsroute takes a new action,start_runtime. It requires a space admin, like the other actions there.hostRuntimeRequestChannel(hostname), and waits for the answer.&aflow:pubsub:*grant covers it, so the Redis permissions don't change.Starting it. The executor starts Ollama the way the machine has it installed, in this order:
brew services start ollama;launchctl;systemctl --user;ollama serveas the operator: detached, and without the executor's own environment (noREDIS_URL).Then it waits until Ollama answers.
Why a service comes first. A service's definition carries the runtime's settings. On this Mac, Homebrew's sets
OLLAMA_KV_CACHE_TYPE=q8_0andOLLAMA_FLASH_ATTENTION=1, the settings G6 was measured with. A bareollama servedrops both.brew services stopremoves the launch agent's file. That's why Homebrew is checked first, through its own command.System services. A Linux system service is left to the administrator, and the answer gives the
sudo systemctlcommand.Not the server. In the appliance the server runs in a container that can reach Ollama but can't start a program on the Mac.
Not Helmsman.
start_runtimeis an operator action only and isn't in Helmsman's change schema. Helmsman can't run while its model's runtime is down anyway.Shared exchange. The browser settings' publish-and-wait exchange moved into
@aflow/redisasaskHost, and both routes use it.probeEnvis shared by the host's three callers.Errors on the page. A refused action, such as "not installed, get it from https://ollama.com/download", now shows on This Computer as well as in the banner.
Guard updated. The host's one-spawn-path guard names
localRuntimeStart.ts, with its reason.Testing
brew services stop ollamaand started it throughstartLocalRuntime. It answered in about 1 s withq8_0and flash attention set, andbrew servicesreports it started.askHost.yarn typecheckand the web-product build pass.test:changed: 822 pass.checkoutReplacementthat also fails on main.liveand the host executor restarts: stop Ollama, then click Start Ollama in the chat banner.🤖 Generated with Claude Code