microsoft / microsoft/vscode

vscode.dev not switching to new branch for repo in private emu org

Open
#330,607 3 comments 0 reactions 1 assignee Claimed by @osortega View on GitHub
Dominant language
TypeScript
Stars
193k
Forks
42.4k
PR merge metrics
PR metrics pending

Description

Does this issue occur when all extensions are disabled?: Yes

Version: 1.133.0
Commit: a5b500951314efd502d07465bd138dfbd714a960
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/151.0.0.0 Safari/537.36
Embedder: vscode.dev

**Steps to Reproduce / Description:**

- Working in a Repository within a private Organization using my EMU account
- Launching vscode.dev by pressing "." on repository main branch
- vscode.dev opens, i trust set to trust the repository and make sure that i'm logged in using my account to vscode.dev (by clicking the accounts button on the menu, says that i'm logged in using my emu account)
- clicking source button on bottom left, window opens to top of window that allows me to create a new branch
- selecting "create new branch" and entering branch name that contains "letters, "-", "_", integers only". **NO** spaces, no slashes or any other characters
- vscode.dev asks me if i want to switch to the new branch, which i confirm
- Problem: vscode.dev tries to load the new branch briefly (you can see it in the url) but immediately bounces back to main (url changes back to main)
- the branch itself gets created, you can see it under branches in webinterface
- if i click the source button again in vscode.dev then i can see the branch listed in the top window. i can also click it, but same behaviour as described above repeats
- if i do this a couple of times and / or reload vscode.dev, then at some point it will switch to the new branch

**Troubleshooting I performed:**

- the above seems odd, so I used chromes developer tools to see what actually happens
- on the initial branch creation from within vscode there are two requests being send from vscode.dev to api.github.com that look like this
```
Request URL
https://api.github.com/repos///git/extract-ref/HEAD
Request Method
GET
Status Code
403 Forbidden
```
githubs repsone:
```
{
"message": "API rate limit exceeded for . (But here's the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.)",
"documentation_url": "https://docs.github.com/rest/overview/resources-in-the-rest-api#rate-limiting"
}
```
the request does not contain any auth information (even though i am logged in using my github account, see above). So somehow vscode.dev sends unauthenticated requests to github which are than throttled -> switch to new branch doesn't work.

When I try to switch to the new branch manually over and over again, then at some point my request is not throttled and will go though by chance.. (when rate limit is not exceeded).

What happens than is that the request to api.github.com still doesn't contain any auth information and instead of getting a 403 it will get a 404 repsonse (which is okay, because unauthenticated request to a repo in a private org should fail). However, in the 404 case, vscode.dev is able to switch to the new branch...

to sum up there are 2 cases:
a) vscode.dev sends unauthenticated request to api.github.com -> 403 throttles cause of rate limit -> switch to new branch doesn't work
b) vscode.dev send unauthenticated request to api.github.com -> 404, cause rate limit not exceeded at the time -> switch to new branch works

what I would expect is that the request contains auth information (like all the others that are sent) and switch to new branch works all the time.

++

It's my first time reporting something here. Please let me know if details are missing.

++

I've looked for duplicate issues, but can only find one where the condition is that "/" are within the branch name. That is not the case here.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.