Skip to content

Commit 44a3326

Browse files
haasonsaasclaude
andauthored
fix: Don't cache timeout/error results in LeanProver (#5)
* fix: Don't cache timeout/error results in LeanProver 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> * fix: Move cache.put after try/except to avoid swallowing valid results 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> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 73c3128 commit 44a3326

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

formal_verification/lean_prover.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ def prove_specification(self, spec: FormalSpec) -> ProofResult:
114114
result = self._run_lean(lean_code, start_time, spec)
115115
except subprocess.TimeoutExpired:
116116
logger.warning("Lean proof timeout for: %s", spec.spec_text)
117-
result = ProofResult(
117+
return ProofResult(
118118
spec=spec,
119119
proven=False,
120120
proof_time_ms=self.timeout_seconds * 1000,
@@ -126,7 +126,7 @@ def prove_specification(self, spec: FormalSpec) -> ProofResult:
126126
)
127127
except Exception as exc:
128128
logger.error("Lean proof attempt failed: %s", exc)
129-
result = ProofResult(
129+
return ProofResult(
130130
spec=spec,
131131
proven=False,
132132
proof_time_ms=(time.time() - start_time) * 1000,

0 commit comments

Comments
 (0)