feat(install): prestart guard reclaims :11434 from Ollama squatters#10
Merged
Merged
Conversation
quenchforge's pre-bind check yields (exits 0) when 11434 is already held, and the LaunchAgent's KeepAlive.SuccessfulExit=false then leaves the job dead — so anything that grabs the port during a restart window (classically Ollama.app's auto-launched `ollama serve`) wins and quenchforge stays down until hand-evicted. `quenchforge install` now writes a prestart guard to ~/.config/quenchforge/prestart-guard.sh and points the generated plist's ProgramArguments[0] at it. On every (re)start + at login the guard boots out com.ollama.ollama, evicts any non-quenchforge listener on the port, then execs `quenchforge serve` — so quenchforge authoritatively owns the canonical Ollama-API port without ceding it or needing a manual eviction. The guard only kills the actual squatter (never a running quenchforge / llama-server) and is a no-op when Ollama isn't present. Covered by TestInstall_WritesPlistAndPrestartGuard. Operators who intentionally run Ollama can point ProgramArguments back at the bare binary.
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
Ollama.app auto-launches
ollama serve, which grabs:11434— quenchforge's canonical port. quenchforge's pre-bind check deliberately yields (exits 0) when the port is held, and the LaunchAgent'sKeepAlive.SuccessfulExit=falsethen leaves the job dead. So during any quenchforge restart window, Ollama can win the port and quenchforge stays down until an operator hand-evicts it (launchctl bootout com.ollama.ollama+ re-kickstart). This recurs on every login/restart.Moving quenchforge off
:11434was considered and rejected: 111+ consumers (cerid-ai, contextplus, docs) assume the canonical Ollama-API port, and vacating it would let Ollama silently answer those clients with the wrong backend.Fix
quenchforge installnow writes a prestart guard to~/.config/quenchforge/prestart-guard.shand points the generated plist'sProgramArguments[0]at it. Before exec'ingquenchforge serve, the guard:com.ollama.ollama(if its launchd job exists) so it can't respawn the serve child;lsofby command, never kills a runningquenchforge/llama-server);execsquenchforge serve(launchd supervises quenchforge directly).So quenchforge authoritatively reclaims the port on every (re)start and at login, with no manual step. It's a no-op when Ollama isn't installed and only ever targets the actual squatter.
Changes
cmd/quenchforge/prestart-guard.sh— the guard (embedded via//go:embed).cmd/quenchforge/install.go— write the guard (0755) to~/.config/quenchforge/during install.cmd/quenchforge/plist_template.plist—ProgramArguments[0]→ guard; comments updated.cmd/quenchforge/install_test.go—TestInstall_WritesPlistAndPrestartGuard.packaging/macos/README.md,CHANGELOG.md(Unreleased).Build/vet/gofmt clean;
bash -non the guard passes. macOS-only path; install test skips on Linux.