Skip to content

Make doctor crash-proof and inspect tolerant of incomplete runs - #13

Merged
iodriller merged 1 commit into
mainfrom
claude/repo-analysis-bugs-gaps-bte7ko
Jun 22, 2026
Merged

Make doctor crash-proof and inspect tolerant of incomplete runs#13
iodriller merged 1 commit into
mainfrom
claude/repo-analysis-bugs-gaps-bte7ko

Conversation

@iodriller

@iodriller iodriller commented Jun 22, 2026

Copy link
Copy Markdown
Owner

Summary

End-to-end bug audit of the recently enabled features (reproducible run metadata, validation, normalization, viewer fidelity, doctor, inspect/EpisodeSummary, stored warnings, duration/naming fixes). Found two real bugs — both robustness/UX in the new diagnostics commands — and fixed them minimally; everything else verified correct.

B1 — doctor could crash instead of reporting a failed check

collect_doctor_checks ran each check unguarded. _examples_check connects PyBullet and steps, so in a broken/headless environment it raised and the command died with a raw traceback — exactly when a user runs doctor to diagnose a broken env. Now each check runs through a _safe guard that turns any exception into a warn row.

B2 — inspect raw-tracebacked on a missing/incomplete run

inspect called runs.load_run, which unconditionally reads creature.json (which inspect never uses), so a nonexistent path or a run dir / trace.json without a sibling creature.json (a documented input) raised FileNotFoundError instead of the friendly exit-2 every other command gives. Now it loads only the trace (+ optional task.json) via the existing _load_spec/_load_task_for_trace helpers.

Verified OK (no change)

Hash idempotence under normalization, summarize_episode safety (≥1 part, strict zips), duration/metric-name consistency, stored-warnings correctness, save_run(task=...) threading, and the motor-limit boundary.

Verification

  • ruff check, ruff format --check, pytest all green — 131 tests (+3).
  • Hand-verified: doctor with a throwing check → warn row, no crash; inspect /tmp/does-not-exist → exit 2; inspect on a dir containing only trace.json → summarizes (duration 3.00, final score).

End-to-end audit of the recently added features surfaced two robustness/UX
bugs in the new diagnostics commands (rest verified OK):

- doctor: collect_doctor_checks ran each check unguarded, so a throwing check
  (e.g. a broken PyBullet/headless env in _examples_check) crashed the command
  with a raw traceback — exactly when it should diagnose the failure. Each check
  now runs through a `_safe` guard that turns an exception into a `warn` row.
- inspect: it called runs.load_run, which unconditionally reads creature.json
  (which inspect never uses), so a missing path or a run dir / trace.json
  without a sibling creature.json raised a raw FileNotFoundError. It now loads
  only the trace (+ optional task.json) via the friendly _load_spec /
  _load_task_for_trace helpers: missing path exits 2; a creature-less run dir
  still summarizes.

Tests: doctor stays crash-free when a check raises (returns a warn row);
inspect exits 2 on a missing path and summarizes a trace-only run dir. All
green: ruff, ruff format --check, pytest (131).

https://claude.ai/code/session_01EcH4uu86dMEDrd6TzyAExd
@iodriller
iodriller merged commit 235d779 into main Jun 22, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants