fix: code-review findings in local-search caching + fuzzy#24
Merged
KrystianNowakowski merged 1 commit intoJun 8, 2026
Merged
Conversation
- #1: char cap skips (continue) an over-budget definition instead of break, so smaller later definitions are still cached - #2: ambiguous bare names (min/map/insert/...) cached only on a qualified reference, avoiding false positives when the proof used a Mathlib/core identifier - #4: injected <local-definitions> block is bounded to a fraction of the model input budget, dropping whole trailing entries (verbatim source never chopped) - #7: warn when the local-search tool is present but its searcher can't be recovered (used-definition caching silently disabled) - #8: normalize the fuzzy query once per search instead of per declaration Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Addresses the high-effort code review of the WS1+WS2 local-search work. Fixes the three substantive findings plus two cheap ones; the rest were lower-severity (and the reported
str.formatbrace crash was refuted —str.formatdoes not re-scan replacement values).break→continue(accumulate_used_definitions): an over-budget definition no longer aborts the loop, so smaller later definitions the proof used still get cached._used_in_code+_AMBIGUOUS_BARE_NAMES): a local decl with a ubiquitous simple name (min/map/insert/…) is cached only when its qualified name appears in the code — avoids cachingFoo.minjust because the proof used Mathlib'smin. Distinctive names (e.g.extract_min) still cache from a bare reference, preserving recall foropened names._render_used_definitions): the<local-definitions>block is bounded to a fraction of the model's input window, dropping whole trailing entries (verbatim Lean source is never chopped) with an omission note — consistent with the existing build-output truncation._find_local_searcher): warns when the local-search tool is configured but its searcher can't be recovered, so the caching feature degrading to a no-op is visible._score_name): the fuzzy query is normalized once per search instead of once per declaration.392 unit tests pass (7 new), ruff clean. New tests cover the continue-not-break cap, the ambiguous-vs-qualified-vs-distinctive caching cases, and the injection budget (drop-trailing / keep-all / empty).
🤖 Generated with Claude Code
Note
Medium Risk
Changes what definitions are cached and how much context the proposer sees each iteration; behavior is intentional but can affect proof quality on name collisions or large caches.
Overview
Hardens local-search used-definition caching and how those definitions are fed back into the proposer.
Caching (
accumulate_used_definitions) now uses_used_in_codeinstead of bare identifier matching: ubiquitous simple names (min,map,insert, …) are cached only when the qualified name appears in the proof, while distinctive names still match bare references. When the char budget is exceeded, an oversized entry is skipped (continue) rather than stopping the loop, so later smaller defs can still be added.Proposer prompt:
_render_used_definitionscaps the<local-definitions>block to roughly ¼ ofmax_input_tokens(char proxy), dropping whole trailing entries with an omission note instead of dumping the full cache.Ops / perf:
_find_local_searcherlogs a warning if the local-search tool is configured but theLocalLeanSearcherinstance cannot be recovered. Fuzzy search normalizes the query once per file scan via_score_name.Unit tests cover budget rendering, continue-on-oversize, and ambiguous vs qualified caching.
Reviewed by Cursor Bugbot for commit 95413be. Bugbot is set up for automated code reviews on this repo. Configure here.