Skip to content

fix: retry LLM template model pulls#68

Merged
konstantinbe merged 1 commit into
mainfrom
kb.retry-llm-ollama-pull
Jul 1, 2026
Merged

fix: retry LLM template model pulls#68
konstantinbe merged 1 commit into
mainfrom
kb.retry-llm-ollama-pull

Conversation

@konstantinbe

Copy link
Copy Markdown
Contributor

Why

The LLM template starts two services: Ollama and Open WebUI. Open WebUI can be healthy before the configured model exists, because the Ollama container downloads the model in a background task after the API starts. That is useful for large models because the UI comes up quickly, but it creates a bad failure mode when the device is not online yet.

We hit that during validation: Ollama started, Open WebUI was reachable, but the first automatic pull failed because DNS/network was not available. The background task exited after that one failure. From the user's point of view the app looked alive, but Open WebUI showed an empty model picker forever. Nothing in the UI made it clear that the app had already given up, and the only way forward was to know enough to manually call Ollama's pull API.

That is the wrong behavior for an edge device first boot. Network readiness can lag app startup, especially when the device is being configured over USB, Wi-Fi is being connected after deployment, or DNS briefly fails. The template should be self-healing in that situation: keep the server available, keep trying the configured model, and make the waiting/retry state visible in the service logs.

This keeps the design simple. It does not add a custom status UI or block Open WebUI behind a large download. It only makes the existing first-run puller persistent instead of one-shot, with clear log messages telling the user that the model picker may stay empty until the download succeeds.

Tests

  • bash -n python/llm/ollama/entrypoint.sh
  • Reviewed against the failure observed on Thor: the previous one-shot pull exited after registry.ollama.ai DNS failed, leaving Open WebUI up with no model. With this change, that failure path logs the problem and retries with capped backoff instead of permanently giving up.

First boot can race device network setup. If Ollama gives up after one
failed pull, Open WebUI remains reachable but never gets a model until a
user knows to pull it manually. Retrying keeps the app self-healing when
DNS or internet connectivity appears after the containers start, while
making the waiting state visible in the service logs.

Co-Authored-By: ChatGPT <noreply@openai.com>
@konstantinbe konstantinbe self-assigned this Jul 1, 2026
@konstantinbe konstantinbe marked this pull request as draft July 1, 2026 21:46
@konstantinbe konstantinbe marked this pull request as ready for review July 1, 2026 21:51
@konstantinbe konstantinbe merged commit b314973 into main Jul 1, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant