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

bug: Autocomplete rate limits display inconsistent error messages #2134

Closed
kalanchan opened this issue Dec 6, 2023 · 5 comments · Fixed by #2135
Closed

bug: Autocomplete rate limits display inconsistent error messages #2134

kalanchan opened this issue Dec 6, 2023 · 5 comments · Fixed by #2135
Assignees
Labels

Comments

@kalanchan
Copy link
Contributor

Version

v0.17.1701788840

Describe the bug

This bug has 2 parts to it:

  1. Using the rate limited demo accounts, by design the headers retry-after return back the same time as when the request was made. This causes the error messages to constantly be displayed in the quick pick view
  2. Also using the rate limited demo account, if you hard code the retry time to a regular interval (like 1 day after), the error message does not display anymore after dismissing it once.

Expected behavior

Rate limit error message to only display once, and to display again even after dismissed

Additional context

No response

@philipp-spiess
Copy link
Contributor

Using the rate limited demo accounts, by design the headers retry-after return back the same time as when the request was made. This causes the error messages to constantly be displayed in the quick pick view

Can you clarify what exactly you mean by this?

Also using the rate limited demo account, if you hard code the retry time to a regular interval (like 1 day after), the error message does not display anymore after dismissing it once.

If we don't do that, it will mean that a user will constantly see a warning color in their IDE when they code. Is this a better UX?

@toolmantim
Copy link
Contributor

I think keeping it as the warning color is probably ideal. Same as other autocompletion AI extensions when they're disabled.

@toolmantim
Copy link
Contributor

I think by "This causes the error messages to constantly be displayed in the quick pick view" @kalanchan is referring to the following (from the video in #2135):

Screenshot 2023-12-06 at 9 25 20 pm

@philipp-spiess
Copy link
Contributor

Oh I didn't see the PR! Looking. Thanks @toolmantim :)

@taylorsperry
Copy link
Contributor

Marking as P0 (since this is part of the PLG flow) and "In Progress" given @kalanchan 's PR.

kalanchan added a commit that referenced this issue Dec 8, 2023
Closes #2134 

This bug has 2 parts to it:
1. Using the rate limited demo accounts, by design the headers
`retry-after` return back the same time as when the request was made.
This causes the error messages to constantly be displayed in the quick
pick view
2. Also using the rate limited demo account, if you hard code the retry
time to a later time (like 1 day after), the error message does not
display anymore after being dismissed once.


This PR adds a check to see whether or not the errors have been added in
the `statusBar` and to display the rate limited error if no other
`RateLimitError` is present. This also makes sure the error is only
displayed once, instead of spamming the user if autocomplete keeps
getting triggered.

**Before (bug 1):**


https://github.com/sourcegraph/cody/assets/51868853/de5a963a-a5be-4677-a75c-4f154960a516

**Before (bug2, after hardcoding a later `retry-after` date):**


https://github.com/sourcegraph/cody/assets/51868853/ffcd7748-0827-4fca-b71f-e141112ead97


After: 


https://github.com/sourcegraph/cody/assets/51868853/48078429-59dc-4ad8-a744-efb1e665a689



## Test plan
- login to `https://sourcegraph.com` using the free demo account
([thread](https://sourcegraph.slack.com/archives/C066F85TE80/p1701712911448229?thread_ts=1700694252.150349&cid=C066F85TE80))
- go to any file, trigger autocompletes multiple times and you will see
only 1 error message displayed
- click on the error, dismiss it, and trigger another autocomplete. you
should see another error message displayed
<!-- Required. See
https://docs.sourcegraph.com/dev/background-information/testing_principles.
-->

---------

Co-authored-by: Danny Tuppeny <danny@tuppeny.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants