Skip to content

fix: Don't cache timeout/error results in LeanProver#5

Merged
haasonsaas merged 2 commits into
mainfrom
fix/lean-prover-no-cache-timeout
Apr 11, 2026
Merged

fix: Don't cache timeout/error results in LeanProver#5
haasonsaas merged 2 commits into
mainfrom
fix/lean-prover-no-cache-timeout

Conversation

@haasonsaas
Copy link
Copy Markdown
Contributor

Summary

  • Move cache.put inside the try block so only actual lean execution results (success/type-check failure) get cached
  • Timeout and unexpected errors are transient — caching them permanently prevents retries
  • Matches CoqProver behavior

Addresses Bugbot review on #3.

Test plan

  • 288 tests pass
  • CI lint clean

🤖 Generated with Claude Code

Only cache results from successful lean invocations (success or
type-check failure). Timeout and unexpected errors are transient and
should not permanently prevent retries for the same spec.

Matches CoqProver behavior where cache.put is inside the try block.

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 control-flow change limited to LeanProver.prove_specification, preventing transient timeout/unexpected-error results from being written to ProofCache while leaving successful/typecheck-failure caching unchanged.

Overview
Adjusts LeanProver.prove_specification to return immediately on subprocess.TimeoutExpired and other exceptions instead of assigning to result and falling through.

This ensures only actual Lean execution outcomes are cached via ProofCache.put, and transient timeouts/unknown failures no longer poison the cache and block retries.

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

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix is ON, but it could not run because the spend limit has been reached. To enable Bugbot Autofix, have a team admin raise the spend limit in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit da8e4e1. Configure here.

Comment thread formal_verification/lean_prover.py Outdated
cache.put inside try was covered by the broad except Exception,
meaning a cache error would discard a valid proof result and return
INCONCLUSIVE. Since both except branches return early, cache.put
safely goes after the try/except block — only reached with a valid
result from _run_lean.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@haasonsaas haasonsaas merged commit 44a3326 into main Apr 11, 2026
11 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