fix(app): settle the start state before answering and report failed stops

service_start now moves the controller to starting before it returns
(Controller::start_in_background), so a stop right after it cancels the
start and a second start is refused instead of the start running late.
service_restart stops, then starts the same way.

Stopping Strata now confirms the server is gone: `launch --stop` is ended
after 2 minutes with everything it started, then the port must stop
listing a model. A server still answering makes the LLM failed with the
reason, and Services::stop / Running::stop return it, so the controller
shows failed instead of stopped (also for a cancelled start that could
not clear the server). A stop command that fails while nothing answers
counts as stopped.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
javis-bot
2026-11-12 17:51:11 +09:00
parent 5c510bb602
commit 41026a1eff
5 changed files with 295 additions and 74 deletions

View File

@@ -96,8 +96,12 @@ The dashboard's start and stop buttons, and the app binary itself, run the servi
starting; `restart` is stop then start. A start that fails leaves nothing running. A stop while
starting cancels the start (the LLM's model download or load stops and its server is cleared) and
ends in `stopped` without an error; if the start finished anyway, what came up is stopped again.
The screens' `service_start` and `service_restart` return at once and the start runs in the
background (the first start downloads the model); the dashboard shows how it goes. Starting reads the
The screens' `service_start` and `service_restart` return as soon as the state is `starting`
(restart stops first) and the start runs in the background (the first start downloads the model);
the dashboard shows how it goes, a stop right after the answer cancels the start and a second start
is refused. A stop that cannot confirm everything ended (the LLM's server still answers) ends in
`failed` with the reason, not `stopped`; a start (Strata's `--restart`) can follow. The same goes
for a cancelled start that could not clear the server. Starting reads the
settings and the stored token again, so saved changes take effect on the next start. Each start
gets a new dashboard fed by that run's events; `stop` ends the feeding (and waits for it) before
the dashboard is forgotten, so an event queued before the stop, or sent by an earlier run, never
@@ -182,8 +186,12 @@ start it first, so nothing answers before the brain can, and stop it last.
replaces a server left with other choices; the same choices are reused. `--parallel` is 1 (faster
on a 16 GB card, M0) and 2 when a chat channel answers every message, so its answers do not wait
behind voice answers. Pictures are off until something in v2 sends one. Stopping the services
runs `strata launch --stop`; so does a failed or cancelled start, so nothing half-started keeps
graphics memory. Not installed: the start fails and says to run the install.
runs `strata launch --stop` (ended after 2 minutes, with everything it started) and then checks
that the port no longer lists a model; so does a failed or cancelled start, so nothing
half-started keeps graphics memory. Stopped means nothing answers any more (a stop command that
fails while nothing answers counts as stopped); a server still answering makes the LLM `failed`
with the reason, and the stop or the start reports it. Not installed: the start fails and says to
run the install.
- **A server the app does not start**: with `llm.url` (an OpenAI-compatible `/v1` address, in the
settings file only) the app starts nothing; that server must list a model within 30 seconds.
- **Settings**: `llm.context` (default 32768 tokens per request, 4096-262144) and `llm.port`
@@ -256,7 +264,10 @@ service starter, a stop while starting (cancelled, or finished and stopped again
(launch arguments from the settings and inside the data folder, the second request slot for a chat
channel answering everything, the download percentage, the brain's settings file, a given server
used without Strata, Strata missing, a fake Strata that reports progress, returns, serves and is
stopped, is cancelled during its download and cleared, or fails with its last line; the brain's
stopped, is cancelled during its download and cleared, or fails with its last line, a stop that
fails or hangs while the server still answers (failed, not off) and one that fails while nothing
answers (off); a background start that is starting at once, so a stop right after it cancels it
and a second start is refused, also through the admin commands; a failed stop reported as failed; the brain's
config loaded without writing to the home folder, `tests/test_config_db_path.py`); the dashboard from made-up events (captions replaced and cleared, latency stages
and medians, an answer matched to its asker's final, missed requests without text); the admin
commands (first run: folder then token, the token never returned whole, the wizard resumed at its