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

@generate mode doesn't know the name of the pinned context file #2010

Open
kgilpin opened this issue Sep 21, 2024 · 2 comments
Open

@generate mode doesn't know the name of the pinned context file #2010

kgilpin opened this issue Sep 21, 2024 · 2 comments
Assignees
Labels
bug Something isn't working navie-plan

Comments

@kgilpin
Copy link
Contributor

kgilpin commented Sep 21, 2024

When using the @generate command, Navie doesn't know the name of the pinned file.

You can see how, in this screenshot, I have pinned a context file called "official.py".

Then I've asked a typical code generation question. Navie outputs code snippets referring to `/path/to/your/script.py' rather than the pinned file.

Screen Shot 2024-09-21 at 10 20 39 AM

It will also propose (correct) changes to the wrong file name:

Screen Shot 2024-09-21 at 2 10 46 PM

See also

--

  • When the context is provided to the navie package, it should include the file names and file contents.
  • @generate mode should observe and use the file names provided in the pinned context.
  • It may be useful to add some type information to the context / aka codeSelection. It can be an arbitrary blob, but in many cases, such as when the user is pinning context, it has defined structure.
Copy link

github-actions bot commented Sep 21, 2024

Title: Update Navie to Recognize and Use Pinned Context File Names in @generate Mode

Problem: When using the @generate command, Navie has trouble identifying the actual names of pinned context files. It ends up using placeholders like /path/to/your/script.py instead of utilizing the actual file names provided by the user, such as "official.py". This results in confusing and potentially incorrect code generation output.

Analysis: The root cause of this issue seems to be the lack of a direct mapping or recognition mechanism within Navie's @generate mode that ties pinned file contexts to their respective names. When users pin files for context, Navie should be able to link the content with its file name and correctly suggest changes or generate code pertaining to that file. Upon inspecting the current context handling, Navie appears to treat pinned context as generic text blobs without any associated metadata, such as file names.

To resolve this, the system requires enhancements in how contexts are processed and used. Adjustments to data structures or handling logic that allow inclusion and recognition of metadata, like filenames, are necessary. This kind of structured information will enable Navie to correlate the specific content, intended file references, and context needed for precise code generation.

Proposed Changes:

  1. Navie Context Handling Improvements:

    • Update the context processing module in the navie package to not only receive but also store metadata alongside content. Specifically, ensure that file names and paths are included when contexts are pinned.
  2. Enhance @generate Logic:

    • Modify the generate-agent.ts file to incorporate logic that parses and uses the enhanced context structure. When executing the @generate command, ensure it checks for file name metadata within the provided contexts and uses this information to populate file paths correctly in code snippets and proposals.
  3. Agent Integration:

    • Update the integration within the Agent class definitions of plan-agent and generate-agent to use the enhanced context structure, ensuring it correctly identifies file name metadata during interaction events.
  4. Update the Classification Service:

    • Adjust the classification-service.ts to recognize when the user pins files, and ensure this is communicated back to the relevant processing functions to maintain integrity between the context and executions by the agents.
  5. Documentation Updates:

    • Amend sections within the user guides found in using-navie.md to appropriately reflect the functionality of recognized pinned context files. Include examples to demonstrate the process and expected outcomes with accurate file names.

This approach will align the @generate functionality with user expectations and enhance usability, ensuring the code generation process accurately reflects user-pinned contexts and avoids erroneous file references.

@dustinbyrne
Copy link
Contributor

In the first image, no code snippets are found. The instructions referencing a file are included as part of the code snippet prompt description, which will not be included in the absence of code snippets:
https://github.com/getappmap/appmap-js/blob/main/packages/navie/src/services/apply-context-service.ts#L103-L110

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working navie-plan
Projects
None yet
Development

No branches or pull requests

4 participants