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

Autocomplete: Surface rate limit and other errors #851

Merged
merged 11 commits into from
Aug 31, 2023

Conversation

philipp-spiess
Copy link
Contributor

@philipp-spiess philipp-spiess commented Aug 29, 2023

Closes #634

This PR adds a UI indicator for autocomplete errors. We special case rate limiting errors to provider more information.

  • When a rate limit error is encountered, we show it only once per rate limit interval (the UI indicator will reset with a VS Code restart). When the option is selected in quick pick, we open https://about.sourcegraph.com/blog/increasing-the-completions-rate-limit (the only resource I found that we have for rate limits)
  • When any other (e.g. a network error) is encountered, we show the error message and open the output channel. We also add a new error API similar to the debug one but that will always log errors to the output channel.

ToDo

  • Add a new error API similar to the debug one but that will always log errors to the output channel.
  • Add test cases

Test plan

Screen.Recording.2023-08-29.at.14.04.23.mov

@philipp-spiess philipp-spiess requested review from toolmantim and a team August 29, 2023 12:10
@philipp-spiess philipp-spiess self-assigned this Aug 29, 2023
@philipp-spiess
Copy link
Contributor Author

@toolmantim Please take a look at the attached video if this workflow makes sense for you. I've decided to add it to the same quick pick that the status bar item always opens (which is different from your UI sketches). The rest should be fairly similar.

@philipp-spiess philipp-spiess marked this pull request as ready for review August 29, 2023 12:29
}

const DEFAULT_TEXT = '$(cody-logo-heavy)'
const DEFAULT_TOOLTIP = 'Cody Settings'

const QUICK_PICK_ITEM_CHECKED_PREFIX = '$(check) '
const QUICK_PICK_ITEM_EMPTY_INDENT_PREFIX = '\u00A0\u00A0\u00A0\u00A0 '
const QUICK_PICK_ITEM_EMPTY_INDENT_PREFIX = '\u00A0\u00A0\u00A0\u00A0\u00A0 '
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@toolmantim For me the existing indentation looked a bit too narrow:

Before

Screenshot 2023-08-29 at 14 56 56

After

Screenshot 2023-08-29 at 14 57 25

But maybe that's different for other themes?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Screenshot 2023-08-30 at 10 49 29 Should have added these lines right away so it's clearer what I mean :D

vscode/src/chat/MessageProvider.ts Outdated Show resolved Hide resolved
@@ -1,13 +1,13 @@
import { LRUCache } from 'lru-cache'
import * as vscode from 'vscode'

import { isAbortError, isRateLimitError } from '@sourcegraph/cody-shared/src/sourcegraph-api/errors'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💜

vscode/src/services/StatusBar.ts Outdated Show resolved Hide resolved
Copy link
Contributor

@toolmantim toolmantim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!

I put up a quick docs addition in sourcegraph/sourcegraph#56304 so we can link to there in stead of the blog.

@philipp-spiess
Copy link
Contributor Author

@toolmantim @valerybugakov Quick update: I decided to only surface rate limiting errors for now until we resolve https://sourcegraph.slack.com/archives/C05AGQYD528/p1693473094573439?thread_ts=1693471486.690459&cid=C05AGQYD528

This would be too much spam otherwise and definitely not a loveable experience

@philipp-spiess philipp-spiess enabled auto-merge (squash) August 31, 2023 10:48
@philipp-spiess philipp-spiess merged commit 68040d3 into main Aug 31, 2023
9 checks passed
@philipp-spiess philipp-spiess deleted the ps/autocomplete-error-reporting branch August 31, 2023 10:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Autocomplete: Expose rate limiting and other errors to users
3 participants