Qwen3.8-Flash-Next on any consumer hardware: one-click install for Windows / Linux. Strata inference engine, OpenAI/Anthropic API on localhost, optional image input.
C++
retune stops its own server first; engine update gives one next step when the launch holds the card (E07/H04/H06)
Niko12210530a1f7c279
diff --git a/strata_cli/launch/runner.py b/strata_cli/launch/runner.pyindex 2f153f966..9092f75b2 100644--- a/strata_cli/launch/runner.py+++ b/strata_cli/launch/runner.py@@ -1147,6 +1147,7 @@ class Runner:"--name", (s.name or self.name))if s.tune_allow_small:argv.append("--allow-small-differences")+ self.stop_own_server_for_tuning()self.emit("tune", "Tuning for the best speed. Close other heavy programs while it measures.", 0)p = self._spawn(argv)out_lines: list[str] = []@@ -1182,6 +1183,26 @@ class Runner:s.tuned_at = time.strftime("%Y-%m-%d")self.emit("tune", f"Tuning result: {word}. {sentence}", 100, level="info" if word in ("faster", "already fastest") else "warn", word=word)+ restart_after = True # run(start=False) measures only: nothing starts the model again++ def stop_own_server_for_tuning(self) -> None:+ """The measuring engine needs the card, so this launch's own server (the same profile) is stopped first and `start()` brings it back with+ the result (E07). Other engines are never touched here; the tuner says plainly when another program holds the card."""+ from strata_control import runtime+ from strata_control.profiles import ProfileError+ try:+ serving = runtime.status(self.profile).get("state") in ("ready", "starting")+ except Exception: # noqa: BLE001 - no state to read: nothing of ours is running+ return+ if not serving:+ return+ self.emit("tune", "Stopping the model to measure; it starts again afterwards." if self.restart_after+ else "Stopping the model to measure.", 0)+ try:+ runtime.stop(self.profile, timeout=120)+ except ProfileError as e:+ raise LaunchError(f"The running model could not be stopped to measure: {e}.", "Run `strata launch --stop` first, then measure again.", 6) from None+def stored_tuning(self) -> dict | None:"""The tuning result stored for this launch's model, choices and computer (the active preset of its slot in the shared presets store,which the start applies), or None. A result whose computer changed in a way that matters (a different card, processor or memory,@@ -1432,6 +1453,7 @@ class Runner:return ""def run(self, *, start: bool = True) -> Result:+ self.restart_after = starttry:self.check_own_files() # a wrong --model-path is said before the engine is downloadedself.ensure_engine()diff --git a/strata_cli/update_cmd.py b/strata_cli/update_cmd.pyindex 613ec3025..31b87df24 100644--- a/strata_cli/update_cmd.py+++ b/strata_cli/update_cmd.py@@ -243,6 +243,8 @@ def _maybe_wait(a, ctx, machine: bool) -> None:if not serving:returnnames = ", ".join(item.get("profile", "an engine") for item in serving)+ if any(str(item.get("profile", "")).startswith("launch-") for item in serving):+ return # Strata's own launch: run_update says the one next step (stop the model first) instead of askingif machine or not sys.stdin.isatty():return # run_update raises Busy (exit 7) with the same namesanswer = input(f"{names} is serving. Wait for it to stop and then update? [y/N] ").strip().lower()diff --git a/strata_control/updater.py b/strata_control/updater.pyindex 2b9723fac..f558a6c12 100644--- a/strata_control/updater.py+++ b/strata_control/updater.py@@ -59,10 +59,17 @@ class UpdateError(RuntimeError):self.exit_code = exit_code+LAUNCH_NEXT_STEP = "Stop the model first (`strata launch --stop`), then run `strata update` again. Nothing was changed."++class Busy(UpdateError):"""An engine is serving, so nothing was installed or switched."""def __init__(self, serving: list[dict]):+ if any(str(item.get("profile", "")).startswith("launch-") for item in serving):+ super().__init__("Strata's own launch is using the graphics card. " + LAUNCH_NEXT_STEP, 7)+ self.serving = serving+ returnnames = ", ".join(item.get("profile", "an engine") for item in serving) or "an engine"super().__init__(f"{names} is serving. Stop it (or wait until it is idle) and run the update again; ""the update never replaces or tests an engine while one is serving.", 7)@@ -912,6 +919,12 @@ def update_engine(ctx: Context, feed: feedmod.Feed, state: State) -> dict:try:smoke = runner(stage_root, staged, ctx)except TestStartFailed as exc:+ try: # a model of Strata's own launch holds the card: one next step, not the engine's words+ own = [s for s in ctx.serving() if str(s.get("profile", "")).startswith("launch-")]+ except Exception: # noqa: BLE001+ own = []+ if own:+ raise Busy(own) from Nonesection = state.section("engine")at = (ctx.now or dt.datetime.now(dt.timezone.utc)).isoformat()if not exc.busy: # a busy card says nothing about the engine: the next update tries againdiff --git a/tests/terminal/test_tui_stress.py b/tests/terminal/test_tui_stress.pyindex 2e5afa176..c526782a6 100644--- a/tests/terminal/test_tui_stress.py+++ b/tests/terminal/test_tui_stress.py@@ -84,5 +84,67 @@ class KeptKeyTests(unittest.TestCase):self.assertFalse(any("A new API key was made" in n.line() for n in notes))+from tests.terminal import test_updater, update_fixture as fx # noqa: E402 (shared update fixtures)+from strata_control import updater # noqa: E402+++class OwnLaunchHoldsTheCardTests(test_updater.UpdaterCase):+ """#10 (H04/H06): the engine update says one next step when Strata's own launch holds the card."""++ def test_test_start_failure_with_own_launch_serving_gives_the_next_step(self):+ self.install_current()+ self.publish(("0.1.47", fx.GOOD_ENGINE))+ flag = {"held": False}++ def runner(stage_root, staged, ctx):+ flag["held"] = True+ raise updater.TestStartFailed(staged.version, "CUDA error: out of memory (raw engine text)")++ serving = lambda: [{"profile": "launch-gyro-s-32k", "state": "ready"}] if flag["held"] else []+ out = updater.run_update(self.ctx(test_start=runner, serving=serving), control=False)+ result = out["results"][0]+ self.assertEqual((out["exit_code"], result["status"]), (7, "failed"))+ self.assertIn("strata launch --stop", result["error"])+ self.assertIn("run `strata update` again", result["error"])+ self.assertNotIn("raw engine text", result["error"])++ def test_own_launch_serving_before_the_test_is_also_one_plain_step(self):+ self.install_current()+ self.publish(("0.1.47", fx.GOOD_ENGINE))+ out = updater.run_update(self.ctx(serving=lambda: [{"profile": "launch-gyro-s-32k", "state": "ready"}]), control=False)+ self.assertEqual(out["exit_code"], 7)+ self.assertIn("Stop the model first (`strata launch --stop`)", out["results"][0]["error"])+++class RetuneStopsOwnServerTests(unittest.TestCase):+ """#10 (E07): measuring while the same launch serves stops it first, and says so."""++ def _runner(self, state):+ from strata_cli.launch import settings as S+ from strata_cli.launch.runner import Runner+ class Bare(Runner):+ profile = "launch-x"+ r = Bare.__new__(Bare)+ r.s = S.LaunchSettings(name="x")+ r.restart_after = True+ r.said = []+ r.emit = lambda *a, **k: r.said.append(a[1])+ return r++ def test_serving_profile_is_stopped_and_the_line_is_plain(self):+ r = self._runner(None)+ with mock.patch("strata_control.runtime.status", return_value={"state": "ready"}), mock.patch("strata_control.runtime.stop") as stop:+ r.stop_own_server_for_tuning()+ stop.assert_called_once()+ self.assertEqual(r.said, ["Stopping the model to measure; it starts again afterwards."])++ def test_nothing_is_stopped_when_nothing_serves(self):+ r = self._runner(None)+ with mock.patch("strata_control.runtime.status", return_value={"state": "stopped"}), mock.patch("strata_control.runtime.stop") as stop:+ r.stop_own_server_for_tuning()+ stop.assert_not_called()+ self.assertEqual(r.said, [])++if __name__ == "__main__":unittest.main()