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++
runtime start: check the engine package before any process exists; a changed file is refused with exit 5 and its name
Niko1221347d255eaa93
diff --git a/strata_control/runtime.py b/strata_control/runtime.pyindex d054d6523..82efb440a 100644--- a/strata_control/runtime.py+++ b/strata_control/runtime.py@@ -380,6 +380,25 @@ def _start_candidate(name: str) -> tuple[dict, str]:return plan, digest+def _engine_preflight(plan: dict) -> None:+ """Refuse a start before any process exists when the run config names its engine as a component and the package for this+ PC is missing or fails its integrity check (every file's SHA-256). The server checks again when it starts the engine; this+ check makes the refusal the first thing the user sees, with the file named, instead of a log line behind 'server_exited'."""+ try:+ cfg = json.loads(Path(plan["source_config"]).read_text(encoding="utf-8-sig"))+ except (OSError, ValueError, KeyError, TypeError):+ return+ if not isinstance(cfg, dict):+ return+ from strata_control import engine_component+ if not engine_component.is_reference(cfg.get("exe")):+ return+ try:+ engine_component.expand(cfg["exe"], cfg)+ except engine_component.EngineMissing as exc:+ raise ProfileError(str(exc), exc.exit_code) from None++def _check_start_candidate(name: str, expected_profile_revision: str | None,expected_source_sha256: str | None) -> tuple[dict, str]:plan, digest = _start_candidate(name)@@ -403,6 +422,7 @@ def start(name: str, *, wait: float = 300, shutdown_timeout: float = 30,not re.fullmatch(r"[0-9a-f]{64}", expected_source_sha256)):raise ProfileError("expected source digest must be 64 lowercase hex characters")plan, _ = _check_start_candidate(name, expected_profile_revision, expected_source_sha256)+ _engine_preflight(plan)_, _, log_path = _paths(name)flags = os.O_WRONLY | os.O_CREAT | os.O_APPENDif hasattr(os, "O_NOFOLLOW"):diff --git a/tests/terminal/test_component_start.py b/tests/terminal/test_component_start.pyindex 94e2f717f..42ce5c679 100644--- a/tests/terminal/test_component_start.py+++ b/tests/terminal/test_component_start.py@@ -156,12 +156,13 @@ class ComponentStart(unittest.TestCase):body[100] ^= 0xFF # same size; only the full hash sees it(folder / library).write_bytes(bytes(body))code, result = self._cli("runtime", "start", "--profile", "app", "--wait", "20", "--shutdown-timeout", "2")- self.assertNotEqual(code, 0)+ self.assertEqual(code, 5, result) # the refusal is the first thing the user sees: no host, no server+ self.assertFalse(result["ok"])self.assertFalse((self.root / "ran.txt").exists(), "a package with a changed library must not run")- log = self.root / "runtime" / "app.server.log"- text = (log.read_text(errors="replace") if log.exists() else "") + json.dumps(result)- self.assertIn("integrity check", text)- self.assertIn(library, text)+ self.assertIn("integrity check", json.dumps(result))+ self.assertIn(library, json.dumps(result))+ self.assertIn("not started", json.dumps(result))+ self.assertIsNone(runtime._read_state("app"), "no runtime host may exist after the refusal")def test_no_engine_is_a_notice_and_starts_nothing(self):code, result = self._cli("runtime", "start", "--profile", "app", "--wait", "20", "--shutdown-timeout", "2")