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

@@ -125,10 +125,23 @@ class Strata:
# Only a successful launch counts: after a failed one, whatever still
# answers on the port is not the model that was asked for.
ready = wait_ready(f"http://127.0.0.1:{PORT}", timeout=1800) if rc == 0 else None
if ready is None:
self.keep_engine_log()
return {"args": scrub(" ".join(args)), "dropped_flags": dropped, "exit": rc,
"command_seconds": round(t_cmd, 1), "ready": ready is not None,
"ready_seconds": round(time.perf_counter() - t0, 1) if ready is not None else None}
def keep_engine_log(self) -> None:
"""Copy the newest engine log (scrubbed, its end) next to our log so the results zip carries it:
Strata's one-line reason can name a side effect, not the cause."""
found = sorted(self.home.rglob("*.engine.log"), key=lambda p: p.stat().st_mtime)
if not found:
return
src = found[-1]
text = src.read_text(encoding="utf-8", errors="replace")[-200_000:]
dest = self.log.with_name(f"{self.log.stem}_engine_{src.name.removesuffix('.engine.log')}.log")
dest.write_text(scrub(text), encoding="utf-8")
def stop(self) -> None:
run_logged(self.cmd("launch", "--stop"), self.log, timeout=300, env=self.env)
time.sleep(3)