fix(m0): keep Strata's engine log when an LLM start fails

The first gaming-PC run failed the recommended model with only Strata's
one-line reason ("no CUDA-capable device"), which is the picture
reader's side message, not the cause. The engine log stayed on the PC.

A launch that does not become ready now copies the newest
*.engine.log (scrubbed, last 200 KB) into logs/, which the results zip
already packs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
javis-bot
2026-11-10 07:04:38 +09:00
parent ff9b868e62
commit dc2e709d31
2 changed files with 34 additions and 0 deletions

View File

@@ -157,3 +157,24 @@ def test_strata_launch_that_fails_is_not_ready_even_if_a_server_answers(tmp_path
s = llm.Strata(tmp_path, tmp_path / "strata.log")
monkeypatch.setattr(s, "supported_flags", lambda: set())
assert s.launch(llm.PRESETS["fast"], 32768, parallel=1)["ready"] is False
def test_failed_strata_launch_keeps_the_engine_log_for_the_zip(tmp_path, monkeypatch):
# Strata's one-line reason can be misleading (the picture reader's "no CUDA-capable device"),
# so the engine's own log must reach the results zip, which packs logs/*.log.
monkeypatch.setattr(llm, "run_logged", lambda *a, **k: 6)
logs = tmp_path / "logs"
logs.mkdir()
s = llm.Strata(tmp_path, logs / "strata_recommended.log")
monkeypatch.setattr(s, "supported_flags", lambda: set())
engine_dir = tmp_path / "strata" / "localappdata" / "Strata" / "launch"
engine_dir.mkdir(parents=True, exist_ok=True)
home = str(Path.home())
(engine_dir / "q2_0-32k.engine.log").write_text(
f"loading {home}/model.gguf\ncudaMalloc failed: out of memory\n", encoding="utf-8")
assert s.launch(llm.PRESETS["recommended"], 32768, parallel=1)["ready"] is False
kept = [p for p in logs.glob("*.log") if p.name != "strata_recommended.log"]
assert len(kept) == 1
text = kept[0].read_text(encoding="utf-8")
assert "out of memory" in text
assert home not in text