#1981·SurfSense

An image row reads In use before sd-server has started on it

Author: MODSetterCreated Sep 28, 2026Updated Oct 1, 2026
Labelshelp wantedUXdesktop

The gap

docs/architecture/local-models/catalog.md lists this under Known gaps:

Nothing on the screen says whether sd-server is up: an image row reads In use as soon as it is chosen, while Electron starts sd-server on it only when a Studio job needs it. The hard-coded list's route reported that, and went with it.

Why it matters

"In use" on an image row means only that the selection names this build. sd-server may not be running at all, and by design usually is not: watchImageModel() starts it on the model the API asks for, and the API only asks once a Studio job needs one. So the row promises a state that does not exist yet.

That is mostly invisible and occasionally very confusing. The first image after choosing a model waits for a process start plus the 33 s to first image the packaged build was measured at, with no explanation. Worse, sdcppSpec() returns null — silently — when the binary is not staged or a file of the build is missing from disk, so a half-installed model reads "In use" forever and every image fails. The route the hard-coded list used reported the server's state, and that reporting was dropped when image models moved into the catalog.

Where

What done looks like

  • An image row says something true about the server: that the model is chosen and will start when it is needed, or that it is running, or that it cannot start because a file or the binary is missing.
  • The last of those is the one that matters most, because today it is indistinguishable from working.
  • There is no existing seam for this. GET /llm/providers only covers llama.cpp — providers/REGISTRY holds it alone — so you will have to decide where the answer comes from: a route beside /llm/image/local/runtime, an extension of it, or an sd.cpp entry in the provider list. Pick one and say why; adding a provider entry for a thing that is not a Generator is the option most likely to cost more than it saves.
  • Whatever you add must not start sd-server just to ask. Lazy start is deliberate: the process holds one model and Studio pays for it only when it needs one.
  • Delete the Known gaps line from docs/architecture/local-models/catalog.md in the same PR, and update its On the screen image bullets and studio.md if what the screen claims changes.

How to verify

surfsense_local/backend/tests/integration/llm/test_local_image_runtime.py covers the runtime route, tests/unit/llm/providers/sdcpp/test_serving.py covers the probe, and download-image-models.test.tsx covers the screen. The repo is TDD: write the failing test first.

bash
cd surfsense_local/backend
uv run pytest -m unit
uv run pytest -m integration
uv run ruff check .
cd surfsense_local/frontend
pnpm test

If you touch the Electron side, also cd surfsense_local/electron, pnpm test and pnpm typecheck.

Before you start

Read CONTRIBUTING.md, the local model catalog doc and the Studio doc, which owns when an image is actually generated. React work follows the frontend-workflow skill and interface strings the translate skill, both in AGENTS.md. Open your PR against dev, not main. Comment here to claim this.