Recover malformed semantic cache paths by basename

Fixes issue #2973.

group_skipped and the save_semantic_cache write loop now call
_recover_group_path instead of resolving fpath directly, so a group
whose reported source_file never resolves to a real file gets one more
chance: an unambiguous basename match against the already dispatched
allowlist. An ambiguous or genuinely bogus basename still falls
through to the previous skip behavior unchanged, and unscoped callers
(no allowed_source_files) are byte identical to before since recovery
only runs when an allowlist is available.

This stops an incremental run from silently redoing already processed
chunks every time the adaptive retry split path reports a source_file
that a weak or local backend lost track of.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017qfdzgbA5KedGEjD1AayNh
This commit is contained in:
ayushcodes10andClaude Sonnet 5 committed 2026-09-14 16:04:46 +05:30
1 parent 4528666ba6
commit 73f5a66370
1 file changed
+3 -4
+3 -4
View File
@@ -1531,9 +1531,9 @@ def save_semantic_cache(
def group_skipped(fpath: str) -> bool:
"""Mirror the write-loop skip condition for one source_file group."""
p = resolved_source_path(fpath)
cache_path, p = _recover_group_path(fpath)
return not p.is_file() or (
allowed_paths is not None and source_path(fpath) not in allowed_paths
allowed_paths is not None and cache_path not in allowed_paths
)
# Dangling-reference pruning (#1916). A node group is skipped by the write
@@ -1590,8 +1590,7 @@ def save_semantic_cache(
saved = 0
skipped_not_file = 0
for fpath, result in by_file.items():
cache_path = source_path(fpath)
p = resolved_source_path(fpath)
cache_path, p = _recover_group_path(fpath)
if p.is_file():
if allowed_paths is not None and cache_path not in allowed_paths:
warnings.warn(