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

Unexpected architect mode like behaviour #2677

Open
p-wegner opened this issue Dec 21, 2024 · 3 comments
Open

Unexpected architect mode like behaviour #2677

p-wegner opened this issue Dec 21, 2024 · 3 comments
Labels
question Further information is requested

Comments

@p-wegner
Copy link

Issue

Hi,
I'm not sure if my prompt is just too much for Sonnet or aider actually fails to detect file creation. In my case aider behaves as if run in architect mode. The first response looks legit, but nevertheless the model starts over without aider creating the files.

Command: aider --sonnet --file C:/Users/pwegner/IdeaProjects/KeycloakUI/src/main/kotlin/Main.kt --file C:/Users/pwegner/IdeaProjects/KeycloakUI/build.gradle.kts --file C:/Users/pwegner/IdeaProjects/KeycloakUI/src/main/kotlin/Main.kt --yes --no-suggest-shell-commands --no-pretty --no-fancy-input --no-detect-urls -m $message where $message is

Advanced prompt to create a few md files before starting implementation of a spring boot + react app SYSTEM Create plan files in .coding-aider-plans before making code changes:

SYSTEM File Requirements:

  1. Start plans with [Coding Aider Plan]
  2. Start checklists with [Coding Aider Plan - Checklist]
  3. Checklist items should be atomic and use markdown checkboxes (i.e. - [ ] Taskdescription)
  4. Use consistent naming: feature_name.md, _checklist.md, _context.yaml
  5. Cross-reference files using markdown links

SYSTEM Content Guidelines:

  • Plans: High-level feature descriptions and major implementation details
  • Checklists: Fine-grained implementation steps
  • Context YAML format:

    files:
    • path: full/path/to/file
      readOnly: false

SYSTEM Implementation:

  1. Create/update plan files first

  2. Implement changes step by step

  3. Keep context.yaml current with all needed files
    SYSTEM No plan exists yet. Write a detailed description of the requested feature and the needed changes.
    SYSTEM The main plan file should include these sections: ## Overview, ## Problem Description, ## Goals, ## Additional Notes and Constraints, ## References
    SYSTEM Save the plan in a new markdown file with a suitable name in the .coding-aider-plans directory.

         SYSTEM Create subplans when:
         1. A feature requires changes across multiple distinct components
         2. Implementation involves separate logical phases
         3. Different team members could work on parts independently
         4. A component needs its own detailed planning
         5. Changes affect more than 3-4 files
         SYSTEM Subplan Requirements:
    

SYSTEM 1. Name format: mainplan_subfeature (e.g. authentication_login)
SYSTEM 2. Create all three files per subplan:

  • mainplan_subfeature.md
  • mainplan_subfeature_checklist.md
  • mainplan_subfeature_context.yaml
    SYSTEM 3. Reference format in main plan:

Subplan: Subfeature Name

SYSTEM 4. Add to main checklist: - [ ] Complete subfeature implementation
SYSTEM 5. Subplan checklists need:

  • Atomic tasks with - [ ] checkboxes
  • Implementation-specific details
  • Clear dependency markers
    SYSTEM 6. Ensure the main plan checklist properly delegates actual implementation to the subplans
    SYSTEM Create separate checklist and context.yaml files for the main plan and each subplan to track the progress of implementing the plan.
    SYSTEM For the context.yaml, consider all provided files and add relevant files to the affected context.yaml.
    SYSTEM Only proceed with changes after creating and committing the plan files.
    SYSTEM Ensure that you stick to the defined editing format when creating or editing files, e.g. only have the filepath above search blocks.
    < STRUCTURED MODE> i want to create a fancy ui app for basic keycloak functionality like creating users and assigning roles.
    the app should consist of a server (spring boot 3 backend) with a reactjs frontend
    the compiled frontend should be served by the backend as well as a wrapper api that proxies to keycloaks apis
    define or modify gradle tasks that will use a node gradle plugin to build the frontend and bundle it in the backend jar
    ideally the bootRun task will run a function backend with contained frontent
    developers working with the project should only have to install a suitable jdk, the gradle wrapper gradle plugins will ensure all other dev dependencies are provided
    there is no need for global npm or gradle setup </STRUCTURED MODE>
    SYSTEM Make sure to commit the creation of all plan files and don't start the implementation.
    SYSTEM Never ask Would you like me to proceed with the initial implementation steps?

Instead of actually creating the files, it wants to add an unrelated file (that gets confirmed by -y) and proceeds to basically start over. I know it's lengthy and not the ideal minimal example but here is the chat history aider.chat.history_excerpt.md
Is this a failed edit format?

Version and model info

Aider v0.69.1
Main model: claude-3-5-sonnet-20241022 with diff edit format, infinite output

@paul-gauthier
Copy link
Collaborator

Thanks for trying aider and filing this issue. This doc may be helpful:

https://aider.chat/docs/troubleshooting/edit-errors.html

How many tokens are you sending? What does /tokens tell you after you load up all those files?

@p-wegner
Copy link
Author

The two input files and created files themselves are rather small

Approximate context window usage for claude-3-5-sonnet-20241022, in tokens:

$ 0.0054    1,803 system messages
$ 0.0004      136 repository map                                      use --map-tokens to resize
$ 0.0001       31 src\main\kotlin\Main.kt                             /drop to remove
$ 0.0011      380 .coding-aider-plans\keycloak_ui.md                  /drop to remove
$ 0.0004      128 .coding-aider-plans\keycloak_ui_gradle.md           /drop to remove
$ 0.0002       52 .coding-aider-plans\keycloak_ui_gradle_context.yaml /drop to remove
$ 0.0002       67 .coding-aider-plans\keycloak_ui_context.yaml        /drop to remove
$ 0.0005      159 .coding-aider-plans\keycloak_ui_checklist.md        /drop to remove
$ 0.0004      129 .coding-aider-plans\keycloak_ui_gradle_checklist.md /drop to remove
$ 0.0002       83 build.gradle.kts                                    /drop to remove
==================
$ 0.0089    2,968 tokens total
          197,032 tokens remaining in context window
          200,000 tokens max context window size

and as you can see in the attached chat history, my initial prompt + system prompt + files is only 2.8k Token and aiders first request gets finished with this:

These plan files provide a comprehensive structure for implementing the Keycloak UI application. The main plan is broken down into three subplans focusing on backend, frontend, and Gradle configuration respectively. Each subplan has its own checklist and context files to track implementation progress.

The next step would be to begin implementation following these plans, but I'll wait for your confirmation before proceeding with any code changes.

> Tokens: 2.8k sent, 1.5k received. Cost: $0.03 message, $0.03 session.  
> Add settings.gradle.kts to the chat? (Y)es/(N)o/(D)on't ask again [Yes]: y  

I'll create a comprehensive plan for the Keycloak UI application. Let me create the necessary plan files.

And then it starts over providing the file creation output to create the 6 files, this time successfully creating them:

Would you like me to create the remaining subplans for the backend and frontend components before we proceed with implementation?

> Tokens: 2.9k sent, 1.2k received. Cost: $0.03 message, $0.06 session.  
> .coding-aider-plans/keycloak_ui.md  
> Create new file? (Y)es/(N)o [Yes]: y  
> .coding-aider-plans/keycloak_ui_checklist.md  
> Create new file? (Y)es/(N)o [Yes]: y  
> .coding-aider-plans/keycloak_ui_context.yaml  
> Create new file? (Y)es/(N)o [Yes]: y  
> .coding-aider-plans/keycloak_ui_gradle_setup.md  
> Create new file? (Y)es/(N)o [Yes]: y  
> .coding-aider-plans/keycloak_ui_gradle_setup_checklist.md  
> Create new file? (Y)es/(N)o [Yes]: y  
> .coding-aider-plans/keycloak_ui_gradle_setup_context.yaml  
> Create new file? (Y)es/(N)o [Yes]: y  
> Applied edit to .coding-aider-plans/keycloak_ui.md  
> Applied edit to .coding-aider-plans/keycloak_ui_gradle_setup_checklist.md  
> Applied edit to .coding-aider-plans/keycloak_ui_gradle_setup.md  
> Applied edit to .coding-aider-plans/keycloak_ui_gradle_setup_context.yaml  
> Applied edit to .coding-aider-plans/keycloak_ui_context.yaml  
> Applied edit to .coding-aider-plans/keycloak_ui_checklist.md  
> Commit c73c619 feat: Create initial project planning files for Keycloak UI application

Interestingly, the query to add the (for my request) unrelated settings.gradle.kts seems to be connected to the issue, because providing it initially prevents this 2 request behaviour. The problem is that my prompt is only a template and i would rather not have to add unrelated files that won't even be changed to prevent these kind of issues. Could the problem be related to aiders file request that prevents creation of files within the first turn in the conversation? As far as i see it, the edit format seems to be correct (the output between both turns in the conversation is compareable), but aider seems to fail to detect or apply them somehow.
Thank you for the support! I would really love to use such prompts for a more agentic workflow and without the subplan aspect, this has worked for me for the past 4 months like a charm (creating 3 files to augment the user prompt and track progress)

@github-actions github-actions bot added the question Further information is requested label Dec 22, 2024
@p-wegner
Copy link
Author

I have the strong suspicion that this is really related to the files aider wants to add and it happens for simple prompts too.
c:\users\pwegner\.local\bin\aider --sonnet --file C:/Users/pwegner/IdeaProjects/KeycloakUI/README.md --yes --no-suggest-shell-commands --no-pretty --no-fancy-input --no-detect-urls -m provide an italian version for my README
The first request will not create files (although it uses the edit format properly) and instead finishes with

> Tokens: 4.1k sent, 809 received. Cost: $0.02 message, $0.02 session.  
> Add build.gradle.kts to the chat? (Y)es/(N)o/(A)ll/(S)kip all/(D)on't ask again [Yes]: y  
> Add frontend\package.json to the chat? (Y)es/(N)o/(A)ll/(S)kip all/(D)on't ask again [Yes]: y  
> Add src\main\resources\application.yml to the chat? (Y)es/(N)o/(A)ll/(S)kip all/(D)on't ask again [Yes]: y  

I'll help create an Italian version of the README. I'll create a new file called README.it.md with the translated content.

and start over eventually succeeding with the second request:

I've created an Italian version of the README with all the content translated appropriately. The structure remains the same while the content has been carefully translated to maintain technical accuracy while being natural in Italian.

> Tokens: 4.9k sent, 848 received. Cost: $0.03 message, $0.05 session.  
> README.it.md  
> Create new file? (Y)es/(N)o [Yes]: y  
> Applied edit to README.it.md  
> Commit 8ad29f9 docs: Add Italian README translation  

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