vscode-pull-request-github
vscode-pull-request-github copied to clipboard
Extension gets rate limited in a many-repo setup: http forbidden response when adding reviewer after creating pull request
Type: Bug
- run vscode flatpak
- install gh pull requests extension
- authenticate to github
- integrated terminal: git push
- integrated terminal: click link to create pr
- extension widget appears: click to create pull request
- pull request preview appears: click to add reviewer
- get 403 error toast
Extension version: 0.88.1 VS Code version: Code 1.89.1 (dc96b837cf6bb4af9cd736aa3af08cf8279f7685, 2024-05-07T05:16:23.416Z) OS version: Linux x64 6.8.0-76060800daily20240311-generic Modes:
System Info
| Item | Value |
|---|---|
| CPUs | 12th Gen Intel(R) Core(TM) i5-12600K (16 x 4453) |
| GPU Status | 2d_canvas: enabled canvas_oop_rasterization: disabled_off direct_rendering_display_compositor: disabled_off_ok gpu_compositing: enabled multiple_raster_threads: enabled_on opengl: enabled_on rasterization: enabled raw_draw: disabled_off_ok skia_graphite: disabled_off video_decode: enabled video_encode: disabled_software vulkan: disabled_off webgl: enabled webgl2: enabled webgpu: disabled_off |
| Load (avg) | 2, 2, 1 |
| Memory (System) | 62.56GB (34.63GB free) |
| Process Argv | --ms-enable-electron-run-as-node --extensions-dir=/home/kbingham/.var/app/com.visualstudio.code/data/vscode/extensions --add /home/kbingham/Sites/netfoundry/bin/test-build-linux-docker.bash --crash-reporter-id aa778439-0ba0-4494-b7f6-45df1086173f |
| Screen Reader | no |
| VM | 8% |
| DESKTOP_SESSION | pop |
| XDG_CURRENT_DESKTOP | Unity |
| XDG_SESSION_DESKTOP | pop |
| XDG_SESSION_TYPE | x11 |
A/B Experiments
vsliv368cf:30146710
vspor879:30202332
vspor708:30202333
vspor363:30204092
vscoreces:30445986
vscod805cf:30301675
binariesv615:30325510
vsaa593cf:30376535
py29gd2263:31024239
c4g48928:30535728
azure-dev_surveyone:30548225
962ge761:30959799
pythongtdpath:30769146
welcomedialog:30910333
pythonidxpt:30866567
pythonnoceb:30805159
asynctok:30898717
pythontestfixt:30902429
pythonregdiag2:30936856
pythonmypyd1:30879173
pythoncet0:30885854
h48ei257:31000450
pythontbext0:30879054
accentitlementsc:30995553
dsvsc016:30899300
dsvsc017:30899301
dsvsc018:30899302
cppperfnew:31000557
dsvsc020:30976470
pythonait:31006305
666c4381:31064718
chatpanelt:31048053
dsvsc021:30996838
01bff139:31013167
pythoncenvpt:31062603
a69g1124:31058053
dvdeprecation:31061160
pythonprt:31056678
dwnewjupyter:31046869
26j00206:31048877
Can you share the output from GitHub Pull Request?
Sure, @alexr00. github-pull-request-ext-output.txt
Thanks! Are you able to add a reviewer on github.com in that repo?
Yes. I only encounter the problem when I try to add a reviewer with the extension.
@qrkourier are you using a Codespace, or is this local development?
Local only
Hmm, there goes that theory. We've had issues with the auth token in Codspaces before.
I see you have a multi-repo workspace open. Do you use the same GitHub login for each of those repos? Maybe we're somehow trying to use the wrong account to set the reviewer. Could you try signing out of GitHub in VS Code (from the Account icon in the activity bar), reload, then sign back in again?
Thanks for your patience with these questions.
I signed out of GitHub in VS Code by mousing to bottom-left and unfolding the accounts widget. I then tried to create a new PR in the usual way: do git push in the integrated terminal, ctrl-left-click the "Create a pull request ... by visiting ..." link in the terminal, then completing the PR in the extension's sidebar.
Typically, the finished PR is then opened in a tab, and I would then encounter the 403 error when attempting to further modify the PR, e.g., add a reviewer.
This time the 403 presented immediately after submitting the form in the sidebar, so the tab was opened but never loaded. It's stuck displaying "loading..."
Upon navigating to the repo in GitHub.com I see the PR was created, so the 403 seems to have recurred immediately after successfully creating the PR, and prevented the extension from loading it in a VS Code tab.
Here's the extension output from the last few minutes. I attempted to include the lines beginning at the moment when I became re-authenticated, assuming the lines above that wouldn't be interesting.
Oops, I forgot to answer your question. Yes, I am using only a single GitHub account with this VS Code workspace.
I think I've found the reason this happens:
Fetching default branch failed: HttpError: You have exceeded a secondary rate limit.
The secondary rate limit happens when your account makes too many GitHub API requests in a short period of time. Give your many-repo setup, the extension is making many API requests. I'll need to see if there are places I can dramatically reduce this.
How many repos do you have open? 15?
Thank you for clarifying it's a resource constraint that may be worked around by limiting the count of folders added to the VS Code workspace that represent GitHub repositories.
The repositories I use most frequently in VS Code are GitHub repositories.
It's not difficult to add and remove folders in the workspace, and it's convenient for full-indexing to have 10-40 repos open simultaneously, system resources permitting.
I'll make sure to report back if I can't reproduce this issue while working with fewer GitHub repos in VS Code.
Idea: parse the rate limit message from the log to provide an informative toast or retry behavior?
Hi @qrkourier! Are you able to verify if this fix works? You can do so by getting the latest pre-release version of the extension and trying it there. We want to make sure we get this bug verified, and the fix is correct, before we release this to stable especially given a complex setup. Thanks!
I was able to assign a reviewer in several recent attempts!
Thanks for verifying!