Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

existing folder contents overridden when /add dirname/ in aider --yes #599

Closed
VictorBargains opened this issue May 8, 2024 · 3 comments
Closed
Labels
question Further information is requested

Comments

@VictorBargains
Copy link

Issue

I had just had chat_gpt refactor my aider-made code, and make tests for it, and wanted to go back and start running those tests via the aider /run loop. I had previously made new files, made a tests folder, and in vs code dragged them into that folder. Then in the terminal I went back to aider and switched from the single-file to multi-file context, including the subfolder of tests I tried to add. Since I was in --yes mode, it appears to have assumed it needed to create a new blank tests folder. I don't know why it did that or why it crashed, but now my tests folder is empty and I don't have those test files in vs code anymore.

I acknowledge that I Should Have committed my own new files first so I wasn't asking aider to operate on uncommitted changes... and I can just copy/paste the files from chatgpt again.. so it's no big loss, just maybe this is an avoidable bug.

─────────────────────────────────────────────────────────────────────────────────────────────────────
chatgpt.py> /drop chatgpt.py

Removed chatgpt.py from the chat
─────────────────────────────────────────────────────────────────────────────────────────────────────
> /add page_splitter.py main.py document_parser.py tests/

No files matched 'tests/'. Do you want to create 
C:\Users\vandersen\source\repos\SMWParser\design_tools\docx_splitter\tests? yes
Added C:\Users\vandersen\source\repos\SMWParser\design_tools\docx_splitter\document_parser.py to the 
chat
Added C:\Users\vandersen\source\repos\SMWParser\design_tools\docx_splitter\main.py to the chat
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "C:\Users\vandersen\source\repos\SMWParser\design_tools\docx_splitter\env\Scripts\aider.exe\__main__.py", line 7, in <module>
  File "C:\Users\vandersen\source\repos\SMWParser\design_tools\docx_splitter\env\Lib\site-packages\aider\main.py", line 402, in main
    coder.run()
  File "C:\Users\vandersen\source\repos\SMWParser\design_tools\docx_splitter\env\Lib\site-packages\aider\coders\base_coder.py", line 476, in run
    new_user_message = self.run_loop()
                       ^^^^^^^^^^^^^^^
  File "C:\Users\vandersen\source\repos\SMWParser\design_tools\docx_splitter\env\Lib\site-packages\aider\coders\base_coder.py", line 503, in run_loop
    return self.commands.run(inp)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\vandersen\source\repos\SMWParser\design_tools\docx_splitter\env\Lib\site-packages\aider\commands.py", line 133, in run
    return self.do_run(matching_commands[0][1:], rest_inp)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\vandersen\source\repos\SMWParser\design_tools\docx_splitter\env\Lib\site-packages\aider\commands.py", line 107, in do_run
    return cmd_method(args)
           ^^^^^^^^^^^^^^^^
  File "C:\Users\vandersen\source\repos\SMWParser\design_tools\docx_splitter\env\Lib\site-packages\aider\commands.py", line 421, in cmd_add
    content = self.io.read_text(abs_file_path)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\vandersen\source\repos\SMWParser\design_tools\docx_splitter\env\Lib\site-packages\aider\io.py", line 165, in read_text
    with open(str(filename), "r", encoding=self.encoding) as f:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
PermissionError: [Errno 13] Permission denied: 'C:\\Users\\vandersen\\source\\repos\\SMWParser\\design_tools\\docx_splitter\\tests'
(env) 

Version and model info

Aider v0.32.0
Models: gpt-4-1106-preview with udiff edit format, weak model gpt-3.5-turbo
Git repo: .git with 2 files
Repo-map: using 1024 tokens
VSCode terminal detected, pretty output has been disabled.
Use /help to see in-chat commands, run with --help to see cmd line args

@VictorBargains
Copy link
Author

VictorBargains commented May 8, 2024

Possibly unrelated... maybe another thing to smooth over?

aider --yes tests/* *.py
tests/__pycache__ is a directory, not provided alone.
Provide either a single directory of a git repo, or a list of one or more files.  

it worked to do tests/*.py instead but maybe this kinda thing can just be ignored and the other files can still be loaded?

@paul-gauthier paul-gauthier added the question Further information is requested label May 16, 2024
@paul-gauthier
Copy link
Owner

Thanks for trying aider and filing this issue.

I can not reproduce this error:

$ aider --yes

No git repo found, create one to track GPT's changes (recommended)? y
Git repository created in the current working directory.
Added .aider* to .gitignore
Aider v0.35.1-dev
Models: gpt-4o with diff edit format, weak model gpt-3.5-turbo
Git repo: .git with 0 files
Repo-map: using 1024 tokens
Use /help to see in-chat commands, run with --help to see cmd line args
──────────────────────
> /add subdir/

No files matched 'subdir/'. Do you want to create /Users/gauthier/tmp/subdir-bug/subdir? yes
/Users/gauthier/tmp/subdir-bug/subdir: is a directory
Unable to read /Users/gauthier/tmp/subdir-bug/subdir
──────────────────────
> /exit

$ ls -l subdir/
total 0
-rw-r--r--  1 gauthier  staff  0 May 16 08:58 file-in-subdir.txt

The fact that you got a PermissionError also makes me think aider wasn't able to do anything to your tests/ folder. Aider doesn't ever try and delete files.

Are you able to reproduce this bug?

@paul-gauthier
Copy link
Owner

I'm going to close this issue for now, but feel free to add a comment here and I will re-open or file a new issue any time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants