Skip to content

fix(prover,#6790): _parse_lean_errors accepts list input — kill run-4 AttributeError crash - #6846

Merged
myia-ai-01 merged 1 commit into
mainfrom
fix/prover-parse-errors-list-crash
Jul 16, 2026
Merged

myia-ai-01 merged 1 commit into
mainfrom
fix/prover-parse-errors-list-crash

Conversation

@myia-ai-01

Copy link
Copy Markdown
Collaborator

Summary

BG run-4 (DEMO 62, GOL nw L2904) died with exit 1 at the preserve/revert gate. Root cause (forensic ai-01 16/07, log ai01_demo62_wt4_1784191816.log):

provers.py:909 -> provers.py:417 _reverify_compiles_clean -> tools.py:127 _parse_lean_errors
AttributeError: 'list' object has no attribute 'split'

_reverify_compiles_clean falls back to the pre-parsed errors LIST when raw_output is empty (rv.get("raw_output", "") or rv.get("errors", "")), and _parse_lean_errors did raw_output.split("\n") unconditionally. The parse happens after the gate's try/except, so the exception escaped and killed the whole run — trace + [BG] postlude lost.

Fix

Defensive normalization at the top of the authoritative parser (single point, all call sites covered): accept str | list | tuple | None — list/tuple joined one entry per line, None -> "". String behavior byte-identical (verified by the existing a-2 tests, untouched and passing).

Tests

  • test_parse_lean_errors_accepts_list_input — direct crash regression: verbatim run-4 errors-list shape parses (2 errors, lines {2860, 12}), tuple parity, None -> [].
  • test_reverify_survives_errors_list_fallback — end-to-end on the exact run-4 rv shape (empty raw_output + errors list): returns False (revert), no crash.
  • Cohort parse_lean_errors or reverify or extract_errors: 10/10 PASS local.

Sequencing

Complements #6845 (grain a-2, merged): a-2 fixed what the parser catches, this fixes what input types it survives. Unblocks BG run-5 (gated on this crash fix per run-4 forensic). Residuals (b) bookkeeping + (c) success semantics stay with po-2026.

See #6790, #1453.

🤖 Generated with Claude Code

… AttributeError crash

BG run-4 (DEMO 62) died with exit 1 at the preserve/revert gate:
_reverify_compiles_clean falls back to the pre-parsed errors LIST when
raw_output is empty (rv.get("raw_output", "") or rv.get("errors", "")),
and _parse_lean_errors did raw_output.split("\n") unconditionally ->
AttributeError: 'list' object has no attribute 'split' (provers.py:417 ->
tools.py:127). The parse happens AFTER the gate's try/except, so the
exception escaped and killed the whole run (trace + [BG] postlude lost).

Fix: normalize input at the top of the authoritative parser — accept
str | list | tuple | None (list/tuple joined one entry per line). All call
sites covered; string behavior unchanged.

Tests: direct crash regression (list/tuple/None inputs) + end-to-end
_reverify_compiles_clean on the exact run-4 rv shape (empty raw_output +
errors list) -> returns False (revert), no crash. Cohort
parse/reverify/extract 10/10 PASS.

Unblocks BG run-5 (was gated on this crash fix). See #6790, #1453.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@myia-ai-01
myia-ai-01 merged commit 8fd1d8b into main Jul 16, 2026
9 checks passed
myia-ai-01 pushed a commit that referenced this pull request Jul 16, 2026
…t (delta) (#6852)

Companion to #6846 (which defended `_parse_lean_errors`). ai-01 review of
the superseded #6848: reduce to the delta not already on main.

The two build-output parsers (`_parse_lean_errors`, `_count_sorries_from_build_output`)
share the same input shape (a `raw_output` string from the verifier result).
#6846 made `_parse_lean_errors` type-safe against a list `errors` fallback;
this applies the identical coercion to `_count_sorries_from_build_output` so
the two parsers' type-contract stays aligned and the helper is robust to any
future caller that passes the `or errors` fallback.

Honest scoping (firsthand): NO current call-site of
`_count_sorries_from_build_output` passes the `or errors` list fallback --
the two `or errors` sites in `compile()` (L1202, L1268) feed
`_parse_lean_errors` (already defended by #6846), not this helper. So this is
defense-in-depth + API consistency, not a fix for an active crash. The active
Run-4 crash (preserve gate) is fully closed by #6846. This delta keeps the
sibling parser from regressing the same class of bug if a caller is ever
refactored to pass the list fallback here.

Verification (firsthand, this machine):
- pytest: new regression `test_count_sorries_from_build_output_type_safe_on_list_input`
  PASS (list coercion, empty -> 0, string path unchanged); full crash-list +
  parser/guard cohort 16/16 PASS; full file 164/166 (2 pre-existing unrelated
  failures: OPENAI_API_KEY env + stale STALE_POST_ABSORPTION Voting.lean #4365).
- LF clean; +40/-1 (15 in tools.py coercion + 26 test), atomic.

Supersedes #6848 (which duplicated the `_parse_lean_errors` coercion now on
main via #6846).

See #6790, See #1453

Co-authored-by: Claude <noreply@anthropic.com>
@jsboige
jsboige deleted the fix/prover-parse-errors-list-crash branch September 2, 2026 13:17
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