aider
aider copied to clipboard
Unstable repomap breaks caching when nothing has changed
Issue
I'm learning how to minimize costs with aider's caching. A big part of this is ensuring the read-only files and repo-map do not change between subsequent invocations unless I want them to.
# I want these to share cache for read-only files and repomap.
# They won't share cache for writable files since that's lumped with the prompt, which is different. But repomap should be identical.
aider <flags> <fileA> -m 'Try ABC'
aider <flags> <fileA> -m 'Try alternative XYZ'
Unfortunately, repomap generation appears to be non-deterministic because it changes between subsequent invocations even when nothing has changed.
Reproduction
Do this in a large repository so that repomap exceeds map-tokens and needs to be summarized.
First add *.txt to .aiderignore so that creation of repo-map-*.txt can't affect the repomap. Then generate repomap twice in a row:
$ aider --show-repo-map --encoding utf-8 --no-pretty > repo-map-1.txt
$ aider --show-repo-map --encoding utf-8 --no-pretty > repo-map-2.txt
Or with a read-only file:
$ aider --show-repo-map --encoding utf-8 --no-pretty --read CONVENTIONS.md > repo-map-3.txt
$ aider --show-repo-map --encoding utf-8 --no-pretty --read CONVENTIONS.md > repo-map-4.txt
Diff the output of the two adjacent invocations, ignoring the Updating repo map ⠋ logs which are not part of the repomap.
When not specifying any writable files, I see differences in the set of files it chooses to include in the repomap. When I specify --read, I see it including method A in the first repomap, omitting it in place of method B in the second.
These differences go away when I specify a very large --map-tokens so that it's not summarized.
Version and model info
aider: running from git clone of 9789668ca4d14d3b6c24e56f3fe956147ea78039 model: N/A, since the repro above does not talk to any model