Skip to content

fix: Catch all exceptions from _run_lean to prevent UnboundLocalError#4

Merged
haasonsaas merged 1 commit into
mainfrom
fix/lean-prover-unbound-result
Apr 11, 2026
Merged

fix: Catch all exceptions from _run_lean to prevent UnboundLocalError#4
haasonsaas merged 1 commit into
mainfrom
fix/lean-prover-unbound-result

Conversation

@haasonsaas
Copy link
Copy Markdown
Contributor

Summary

  • Catches all exceptions from _run_lean, not just TimeoutExpired, preventing UnboundLocalError when e.g. UnicodeDecodeError occurs from non-UTF-8 lean output
  • Returns INCONCLUSIVE result instead of crashing

Addresses Sentry review feedback on #3.

Test plan

  • 288 tests pass
  • CI lint clean
  • CI green

🤖 Generated with Claude Code

If _run_lean raises something other than TimeoutExpired (e.g.
UnicodeDecodeError from non-UTF-8 lean output), the result variable
was unbound, crashing at cache.put() and return. Now catches all
exceptions with an INCONCLUSIVE result.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@cursor
Copy link
Copy Markdown

cursor Bot commented Apr 11, 2026

PR Summary

Low Risk
Low risk: only broadens error handling around Lean invocation to prevent crashes; behavior change is limited to returning an INCONCLUSIVE ProofResult (and logging) for unexpected exceptions.

Overview
Prevents LeanProver.prove_specification from crashing when _run_lean raises non-timeout exceptions (e.g., decode/subprocess issues) by catching all exceptions, logging the failure, and returning a non-proven ProofResult with solver_status=INCONCLUSIVE.

Timeout handling and caching behavior are unchanged; unexpected failures now produce a structured result with elapsed time and the exception message instead of propagating.

Reviewed by Cursor Bugbot for commit 96f10ab. Bugbot is set up for automated code reviews on this repo. Configure here.

@haasonsaas haasonsaas merged commit 73c3128 into main Apr 11, 2026
12 checks 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.

1 participant