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

Cody: Running recipies with a huge selection truncates without the user being aware of it #53920

Closed
philipp-spiess opened this issue Jun 22, 2023 · 8 comments · Fixed by #53932 or #54025
Labels
bug An error, flaw or fault that produces an incorrect or unexpected result, or behavior. cody/vscode cody

Comments

@philipp-spiess
Copy link
Contributor

When you select a lot of code and run a recipe, you cat no answer.

Repro:

  • Open and select all of cmd/frontend/internal/app/updatecheck/client.go
  • Run the code smell recipe
  • Observe no answer

Expected behavior:

  • Show an error that too much text is selected
@philipp-spiess philipp-spiess added bug An error, flaw or fault that produces an incorrect or unexpected result, or behavior. cody cody/vscode labels Jun 22, 2023
@deepak2431
Copy link
Contributor

@philipp-spiess Created a PR for this. The issue was just with the smell code recipe. When we were calculating the truncatedText, we were passing the wrong token input MAX length, which was causing this behaviour.
All other recipes work fine with larger input too, as they have the truncatedText calculated correctly.

@philipp-spiess
Copy link
Contributor Author

@deepak2431 You're an absolute hero!

@deepak2431
Copy link
Contributor

Thanks a lot :)

philipp-spiess pushed a commit that referenced this issue Jun 22, 2023
This PR closes #53920.

## Test plan
Tested it manually for larger inputs, and it works fine.
@philipp-spiess
Copy link
Contributor Author

I’m going to reopen this for a different change. We should add a user-facing warning somehow when the selection is truncated just so we know what's going on. This is far less critical though than the original issue :)

@philipp-spiess philipp-spiess changed the title Cody: Running recipies with a huge selection breaks silently Cody: Running recipies with a huge selection truncates without the user being aware of it Jun 22, 2023
@deepak2431
Copy link
Contributor

@philipp-spiess Got it. I can handle that in the next PR. Just a question, the warning message should be displayed as a VSCode message, or should it be displayed in the webview?

@philipp-spiess
Copy link
Contributor Author

@deepak2431 Hmm what do you think? I think in the web view it might be less confusing since it opens anyways.

@deepak2431
Copy link
Contributor

@philipp-spiess As I can see in the current implementation, any warning/error message is displayed using the VSCode editor context. So, I think that would be good for this too!

As in Webview, a new message will appear at the top while the response is generated, so in terms of UX, I don't think it's good behaviour. Just my thoughts!

@philipp-spiess
Copy link
Contributor Author

@deepak2431 Yeah makes sense I agree!

ErikaRS pushed a commit that referenced this issue Jun 22, 2023
This PR closes #53920.

## Test plan
Tested it manually for larger inputs, and it works fine.
sanderginn pushed a commit that referenced this issue Jun 23, 2023
This PR closes #53920.

## Test plan
Tested it manually for larger inputs, and it works fine.
philipp-spiess pushed a commit that referenced this issue Jun 26, 2023
This PR closes #53920

Changes made:
1. Added warning message for each long truncated text
2. Fixed the args of token length for some of the recipes

## Test plan
Tested manually for long code snippets.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An error, flaw or fault that produces an incorrect or unexpected result, or behavior. cody/vscode cody
Projects
None yet
2 participants