Summary
SuggestionStore.SaveUnlocked writes to <file>.tmp then File.Move to the final path. There is no try/finally cleanup — if File.Move throws (e.g. file system error, anti-virus interference), the .tmp file is orphaned. Repeated failures accumulate orphan .tmp files in the .cdidx/ directory.
Evidence
src/CodeIndex/Cli/SuggestionStore.cs:236-246 — temp write + Move sequence with no cleanup on exception.
Impact
- Slow disk leak in
.cdidx/ on systems with intermittent FS issues.
- Confusing
.tmp files that look like in-progress writes long after the failure.
Proposed direction
- Wrap the temp write/move in
try { write; move } catch { try { File.Delete(tmpPath); } catch { } throw; } (or equivalent finally with existence check).
- Optional: at startup, sweep
<.cdidx>/*.tmp files older than N seconds.
Repro env
- Branch:
main @ 2ee912d (release v1.21.0)
Summary
SuggestionStore.SaveUnlockedwrites to<file>.tmpthenFile.Moveto the final path. There is no try/finally cleanup — ifFile.Movethrows (e.g. file system error, anti-virus interference), the.tmpfile is orphaned. Repeated failures accumulate orphan.tmpfiles in the.cdidx/directory.Evidence
src/CodeIndex/Cli/SuggestionStore.cs:236-246— temp write + Move sequence with no cleanup on exception.Impact
.cdidx/on systems with intermittent FS issues..tmpfiles that look like in-progress writes long after the failure.Proposed direction
try { write; move } catch { try { File.Delete(tmpPath); } catch { } throw; }(or equivalent finally with existence check).<.cdidx>/*.tmpfiles older than N seconds.Repro env
main@ 2ee912d (release v1.21.0)