#1653

[BUG] A damaged run record crashes the resume listing for healthy runs

Opensamirhvbropened 3d ago

Describe the bug

One damaged or incompatible run can prevent Strix from listing all prior runs, including healthy ones. strix -n --resume raises an uncaught UnicodeDecodeError or TypeError instead of showing the normal run-name help. The interactive resume picker reads the same summaries.

There are two gaps in the existing best-effort reader:

  • Invalid UTF-8 in either run.json or vulnerabilities.json bypasses _load_json()'s JSON/I/O fallback.
  • A JSON object such as {"targets_info": 123} parses successfully, but _describe_target() tries to iterate the number.

Malformed JSON and non-object run records already receive empty/default summaries. These cases should follow that same policy, while healthy sibling runs stay visible.

To Reproduce

On current main 09536cf1481731c790995bd8060db19a3b75ff48, with frozen Python dependencies, this setup-only probe creates temporary records and calls the same listing used by the CLI. No credentials, LLM, Docker or scan target are used:

LITELLM_MODE=PRODUCTION LITELLM_LOCAL_MODEL_COST_MAP=True STRIX_TELEMETRY=0 uv run --frozen python - <<'PY'
import json
import os
import tempfile
from pathlib import Path
from strix.interface.cli_args import resume_run_list_message

with tempfile.TemporaryDirectory() as directory:
    os.chdir(directory)
    healthy = Path("strix_runs/healthy_1111")
    damaged = Path("strix_runs/damaged_2222")
    healthy.mkdir(parents=True)
    damaged.mkdir()
    (healthy / "run.json").write_text(json.dumps({"status": "completed"}), encoding="utf-8")
    for payload in (b"\xff", b'{"targets_info": 123}'):
        (damaged / "run.json").write_bytes(payload)
        try:
            print(resume_run_list_message("Prior runs"))
        except (UnicodeDecodeError, TypeError) as error:
            print(type(error).__name__, str(error))
PY

Actual: UnicodeDecodeError for the first record and TypeError: 'int' object is not iterable for the second. Neither listing reaches the healthy run.

Expected behavior

List healthy runs normally, retaining the existing unknown/default summary behavior for unreadable metadata. When targets_info is not an array, use the existing workspace/instruction fallback. This should not rewrite artifacts or claim that a damaged run itself can be resumed successfully.

System Information:

  • OS: macOS, arm64
  • Strix: current main 09536cf1481731c790995bd8060db19a3b75ff48, package 1.7.0
  • Python: 3.12.14; frozen uv.lock
  • LLM: none; offline fixtures only

Additional context

I checked the all-state PR/issue inventory, including the existing resume work #1421, #1450 and #1621. #1621 concerns restoring the API-spec mount after a run is selected; this failure occurs earlier, while enumerating runs. A small reader-validation fix with CLI and summary regressions is in preparation.

Activity

0

No activity yet.