-
Notifications
You must be signed in to change notification settings - Fork 209
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
bug: currentDir context is not shown in UI #2548
Comments
I've updated the original with root cause and proposed fixes. Hoping that can mean a swift fix from someone :) |
Note this hardcoding-not-matching seems to happen in at least one other place: getCurrentDirFilteredContext(). So that will have to change as well. Might be worth verifying that there aren't more places with this problem. |
@Bruno-DaSilva hey there, thank you so much for the detailed report! I am working on a PR that would address this issue, will keep you posted here! |
hahaha you were already working on it before I reported, I see. Wonderful. Thanks for picking this up, @abeatrix! |
This PR includes the following changes: - Moves commands and custom commands away from recipes. - Addresses issue detailed in #2548 - Removes `SimpleChatRecipeAdapter` - Removes `executeRecipe` from SimpleChatPanelProvider and ChatManager - Removes the `custom-prompts` recipe which was used for commands and custom commands - Runs `executeCommand` from top level in `main.ts` and turns it into a vscode command - Fixes issue where all context is showing up as `via embeddings` - Adds range to editor context for commands RE: #1984 - Updates to execute all edit commands in CommandRunner so that we won't need to rely on sidebar view to execute fixup or custom commands recipes. ## Test plan <!-- Required. See https://sourcegraph.com/docs/dev/background-information/testing_principles. --> All the current tests for chat, commands, and custom commands should still pass and work correctly. 1. Run the explain command - [ ] from sidebar - [ ] from left-click menu - [ ] from chat 2. Run the doc command - [ ] from sidebar - [ ] from left-click menu - [ ] from chat 3. Run a custom command - [ ] from sidebar - [ ] from left-click menu - [ ] from chat 4. Run an edit command - Make sure context for each command is showing up correctly ## Demo https://github.com/sourcegraph/cody/assets/68532117/7e4d9118-9a0a-48cd-823a-af2646e52357 #### Before - context for test command are now showing up in context list ![image](https://github.com/sourcegraph/cody/assets/68532117/9471dcee-cdce-499a-8eae-caf7dd3ce607) #### After - Context sources for commands + Context for text command are showing up correctly - Context for commands include range ![image](https://github.com/sourcegraph/cody/assets/68532117/c95b4407-98c4-47af-a288-76fce10a0d5e)
@Bruno-DaSilva This should be fixed on the latest pre-release version. Can you give that a try and let us know if that doesn't work, please? 🙇♀️ |
This looks like it's working on the pre-release version! Thanks for the quick fix 🙌 I'll leave it to you to close this issue (dunno if your definition of done includes waiting for full release) |
This PR includes the following changes: - Moves commands and custom commands away from recipes. - Addresses issue detailed in #2548 - Removes `SimpleChatRecipeAdapter` - Removes `executeRecipe` from SimpleChatPanelProvider and ChatManager - Removes the `custom-prompts` recipe which was used for commands and custom commands - Runs `executeCommand` from top level in `main.ts` and turns it into a vscode command - Fixes issue where all context is showing up as `via embeddings` - Adds range to editor context for commands RE: #1984 - Updates to execute all edit commands in CommandRunner so that we won't need to rely on sidebar view to execute fixup or custom commands recipes. <!-- Required. See https://sourcegraph.com/docs/dev/background-information/testing_principles. --> All the current tests for chat, commands, and custom commands should still pass and work correctly. 1. Run the explain command - [ ] from sidebar - [ ] from left-click menu - [ ] from chat 2. Run the doc command - [ ] from sidebar - [ ] from left-click menu - [ ] from chat 3. Run a custom command - [ ] from sidebar - [ ] from left-click menu - [ ] from chat 4. Run an edit command - Make sure context for each command is showing up correctly https://github.com/sourcegraph/cody/assets/68532117/7e4d9118-9a0a-48cd-823a-af2646e52357 list ![image](https://github.com/sourcegraph/cody/assets/68532117/9471dcee-cdce-499a-8eae-caf7dd3ce607) - Context sources for commands + Context for text command are showing up correctly - Context for commands include range ![image](https://github.com/sourcegraph/cody/assets/68532117/c95b4407-98c4-47af-a288-76fce10a0d5e)
Version
v1.0.4
Describe the bug
When using the
currentDir
context option, eg. when running the generate-tests command (/test
), the list of files used for context is incomplete. None of the files generated by the currentDir context are shown. Yet, if you examine the debug promptCompletion output, the context files are there..Expected behavior
The UI that shows the list of files sent as context should contain the files from the currentDir context option.
![fixed2](https://private-user-images.githubusercontent.com/8520801/293904754-3bb8da6c-fddc-4924-982b-72b3726bd527.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3Lmd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DYyMyUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDA2MjNUMTk0MTA4WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9ZDgyZWFmMjEyMDU2ODE1ZjEyODIwZDExNWFkYTVjYzE4YmQ3MDQ2ZjI4NGQwM2UzNjRkNGU3ZjFjYjIyOTQxZiZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.wUGcuateRbDaf0Zbt5VPwNqRdwGESA5dj6C6iB2PQI4)
Here's what it looks like with one of the below fixes applied:
Additional context
To be clear, I'm talking about this UI Component:
![Screen Shot 2024-01-03 at 6 01 37 AM](https://private-user-images.githubusercontent.com/8520801/293896000-f5034237-a978-4ec6-baca-eb7fc709e34a.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTkxNzE5NjgsIm5iZiI6MTcxOTE3MTY2OCwicGF0aCI6Ii84NTIwODAxLzI5Mzg5NjAwMC1mNTAzNDIzNy1hOTc4LTRlYzYtYmFjYS1lYjdmYzcwOWUzNGEucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDYyMyUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDA2MjNUMTk0MTA4WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9NmJmMjQ4YWEyMTZjNDAyOTExZmNkMjM5MTVkZjdjMGY1NjZiOTBiMjkzYzk5YWEyYzllOWU5OWU3NWY0YmM4NSZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.QAT9g90MD_0DHveQ1i7nh8ixhoi9s55wnaO3HW47Oac)
Why this happens:
After some debugging within the extension, I found the prompt message generated for currentDir context files is hardcoded in here:
cody/lib/shared/src/chat/prompts/vscode-context/helpers.ts
Line 358 in 52a3187
EDIT: also in getCurrentDirFilteredContext().
Yet, the SimpleChatRecipeAdapter calls
contextMessageToContextItem(message)
:cody/vscode/src/chat/chat-view/SimpleChatRecipeAdapter.ts
Lines 96 to 101 in 52a3187
which strips the prompt messages down to the file information so long as they match these strings:
cody/vscode/src/chat/chat-view/chat-helpers.ts
Line 172 in 52a3187
cody/vscode/src/chat/chat-view/chat-helpers.ts
Line 180 in 52a3187
cody/vscode/src/chat/chat-view/chat-helpers.ts
Line 188 in 52a3187
And otherwise returns
undefined
.Well, as you can see, the currentDir prompt string doesn't match any of these. Thus all files from this context are filtered out and don't appear in the UI.
Proposed Fixes:
Codebase context from file path
to the prompt templates file and then add it to thestripContextWrapper()
function in chat-helpers.ts, ORThe text was updated successfully, but these errors were encountered: