Skip to content

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++

setup --update: skip a strata-*.json that is no model config instead of KeyError: 'args' (#549)

Niko1221d295c45634a8
diff --git a/setup.py b/setup.py
index eee211599..f1495bf4f 100644
--- a/setup.py
+++ b/setup.py
@@ -2429,8 +2429,25 @@ def find_in(roots: list, rel: str):
# ------------------------------------------------------------------------------------------------ start
+def model_config(path: Path) -> bool:
+ """#549: a model's run config (a JSON object with "exe" and "args"). Any other strata-*.json in the folder (a
+ file of the user's own, a cut-off one) is skipped with a warning naming it instead of stopping setup."""
+ try:
+ cfg = json.loads(path.read_text(encoding="utf-8-sig"))
+ if isinstance(cfg, dict) and cfg.get("exe") and isinstance(cfg.get("args"), list):
+ return True
+ why = 'no "exe" or "args"'
+ except OSError as e:
+ why = e.strerror or str(e)
+ except ValueError:
+ why = "not valid JSON"
+ warn(f"skipped {path.name} ({why}): it is not a Strata model config")
+ return False
+
+
def installed_configs():
- return sorted(ROOT.glob("strata-*.json"), key=lambda p: p.stat().st_mtime, reverse=True)
+ return [p for p in sorted(ROOT.glob("strata-*.json"), key=lambda p: p.stat().st_mtime, reverse=True)
+ if model_config(p)]
def source_version() -> str:
@@ -2545,6 +2562,7 @@ def update_install(have: list, a) -> int:
setup needs a newer one (MIN_ENGINE; a compiled engine when its source changed), each installed model's config
upgrades and its draft subset. No question is asked and the model files are not touched; a model still running
keeps its engine (update_installed_engine says to close it and run this again)."""
+ have = [p for p in have if model_config(p)] # #549: a strata-*.json that is no model config is skipped
if not have:
say(" No model is installed in this Strata folder yet: run START-HERE.bat (Linux: ./setup.sh) to set it up -")
say(" it finds an earlier install's model files next to it and reuses them.")
diff --git a/tools/test_setup_update.py b/tools/test_setup_update.py
index 56a330829..d1908d458 100644
--- a/tools/test_setup_update.py
+++ b/tools/test_setup_update.py
@@ -69,6 +69,29 @@ class Update(unittest.TestCase):
m.assert_not_called()
self.assertIn("START-HERE.bat", out)
+ def test_a_json_that_is_no_model_config_is_skipped(self):
+ """#549: a strata-*.json without "args" (not written by setup) stopped update.sh with KeyError: 'args'."""
+ with tempfile.TemporaryDirectory() as d:
+ p = self.config(Path(d))
+ other = Path(d) / "strata-notes.json"
+ other.write_text(json.dumps({"note": "mine"}), encoding="utf-8")
+ broken = Path(d) / "strata-cut.json"
+ broken.write_text("{\"args\": [", encoding="utf-8")
+ rc, pip, eng, dv, start, call, out = self.run_update([other, broken, p])
+ self.assertEqual(rc, 0, out)
+ self.assertIn('skipped strata-notes.json (no "exe" or "args"): it is not a Strata model config', out)
+ self.assertIn("skipped strata-cut.json (not valid JSON)", out)
+ dv.assert_called_once() # the real model is still refreshed
+ self.assertIn("Qwen IQ3_S: up to date", out)
+ self.assertIn("Strata is updated", out)
+
+ def test_installed_configs_lists_only_model_configs(self):
+ with tempfile.TemporaryDirectory() as d:
+ p = self.config(Path(d))
+ (Path(d) / "strata-notes.json").write_text("{}", encoding="utf-8")
+ with mock.patch.object(setup, "ROOT", Path(d)), contextlib.redirect_stdout(io.StringIO()):
+ self.assertEqual(setup.installed_configs(), [p])
+
def test_main_update_never_starts(self):
with tempfile.TemporaryDirectory() as d:
p = self.config(Path(d))