aider icon indicating copy to clipboard operation
aider copied to clipboard

feat: Add --map-cache-dir to change the base directory for .aider.tags.cache.v3

Open coredevorg opened this issue 11 months ago • 14 comments

The patch makes the root directory for .aider.tags.cache.v3 configurable through an additional argument --map-root or AIDER_MAP_ROOTenvironment variable.

This becomes important if your project lives on a CIFS mount and you encounter:

Tags cache error: database is locked
Unable to use tags cache at /mnt/.../.aider.tags.cache.v3, falling back to memory cache
Cache recreation error: [Errno 11] Resource temporarily unavailable: 'cache.db'

With the --map-root parameter, the cache directory can be moved to local device to avoid the problem.

coredevorg avatar Jan 19 '25 17:01 coredevorg

So this is the directory where the map cache DB is stored? might want to make the command more explicit to avoid confusion with the root of the repository map itself, e.g. due to --subtree-only option

Finndersen avatar Jan 30 '25 17:01 Finndersen

Yes, you are right @Finndersen, it's the directory where the repomap cache .aider.tags.cache.v3 is located and has nothing to do with the repository itself. The option is related to an existing option group Repomap settings. So I'm fine with --map-root in this context, but if you have a better name for the option, let me know...

coredevorg avatar Jan 31 '25 05:01 coredevorg

Maybe something like --map-cache-dir would be more appropriate to avoid ambiguity

Finndersen avatar Jan 31 '25 09:01 Finndersen

Changed the argument name according to a suggestions from @Finndersen to less ambiguous --map-cache-dir

coredevorg avatar Feb 01 '25 06:02 coredevorg

@coredevorg i still think --map-root is misleading because this change is about the map cache file location, not the root directory of the repo map itself. How about --map-cache-root? Although "root" is often used to refer to a base directory which is expected to contain subdirectories. If it's just a directory for a single file to be located in, then "dir" is probably more appropriate

Finndersen avatar Feb 07 '25 16:02 Finndersen

Sorry for the confusion, @Finndersen. Unfortunately it's not just the name of the argument in args.py and main.py but the variable is used via **kwargs in the other modules. My quick-and-dirty hack to change the name of the argument has broken the patch so I have to revert because I need the patched aider in my environment. If you really want to change the name, it needs a more in depth refactoring and testing. I won't be able to take a closer look at it for at least 2 weeks. And, btw, it's really the root directory for the cache subdirectory .aider.tags.cache.v3 containing the cache.db.

coredevorg avatar Feb 08 '25 06:02 coredevorg

Ok, well I still think the user interface/API design should probably be priority. Would --map-cache-root make sense? Just because theoretically there could be an argument/param for configuring the root of the repo map itself, so I think it would be backing ourselves into a corner if we used --map-root for this

Finndersen avatar Feb 08 '25 08:02 Finndersen

Certainly a very much needed improvement, right now I am getting harried by stream of "Unable to use tags cache at" errors for various reasons (likely related to 'bad' default location) - and it looks like the memory cache does not persist between queries at all, Aider is recomputing it for every request.

nktl avatar Feb 26 '25 12:02 nktl

Fixed merge conflicts to be compatible with v0.81.1 and updated sources with a clean commit.

coredevorg avatar Apr 08 '25 14:04 coredevorg

Hi @paul-gauthier , any chance to get these minor (but important for some environments) enhancements merged? Let me know, if I can help in any way...

coredevorg avatar Apr 10 '25 04:04 coredevorg

fix: moved the --map-root argument into the correct group "Repomap settings"

coredevorg avatar Apr 10 '25 16:04 coredevorg

Can't wait for this to be merged!

Quick question @coredevorg , where would you recommend to configure .aider.tags.cache.v3 path. Would it be your home directory?

will-rest avatar Apr 17 '25 08:04 will-rest

I'm using a a directory structure like

Develop/
├── aider-map-cache
│   └── project
│       └── .aider.tags.cache.v4
│           └── cache.db
└── cifs-mount
    └── project
        ├── .aider.chat.history.md
        ├── .aider.conf.yml
        ├── .aider.input.history
        ├── .git
        └── .vscode

and an configuration .aider.conf.yml with

map-cache-dir: ~/Develop/aider-map-roots/project

coredevorg avatar Apr 17 '25 09:04 coredevorg

Hi @will-rest , following the suggestion of @Finndersen I changed the argument name to --map-cache-dir and updated the PR with a clean commit. Maybe this will accelerate approval and merge.

coredevorg avatar Apr 22 '25 14:04 coredevorg

Just updated my local 0.84 build with the patch without any problems. @Finndersen / @paul-gauthier : Any chance to get the extension integrated into the aider core? Anything I can do make this happen?

coredevorg avatar Jun 06 '25 17:06 coredevorg

Hey @coredevorg apologies I'm not a formal maintainer of the project so might need someone else to approve

Finndersen avatar Jun 06 '25 20:06 Finndersen

updated patch to resolve merge conflicts with v0.84.1

coredevorg avatar Jun 08 '25 04:06 coredevorg