Copilot Chat shows "Sign in to use GitHub Copilot" modal when chat activates before the token source is ready
- Dominant language
- TypeScript
- Stars
- 193k
- Forks
- 42.4k
- PR merge metrics
- PR metrics pending
Description
Type: Bug
VS Code Version: 1.136.1 (a44adf7f53e00964ab890f9f8758a334f1fc15bc, x64)
OS Version: Windows 11 Pro 10.0.26200
Copilot plan: business seat (`copilot_for_business_seat_quota`)
## What happens
Several times a day, the modal "Sign in to use GitHub Copilot" (Continue with GitHub / Google / Apple)
appears on top of the editor. I am signed in the whole time, and the logs show Copilot successfully
acquiring a valid business-seat token seconds after the dialog appears. The dialog is never retracted.
This looks like an ordering problem in the entitlement UI rather than a credential-storage problem:
Copilot Chat activates, finds no token source yet, and something fires the sign-in modal in that window;
the token then arrives and nothing dismisses the dialog.
## Logs
`GitHub Copilot Chat.log`, from a normal startup:
```
09:21:45.882 [info] ConversationFeature: Waiting for copilot token or BYOK model to activate conversation feature
09:21:45.882 [warning] [LanguageModelAccess] LanguageModel/Embeddings are not available without a Copilot token source
09:21:45.882 [info] [CopilotCLIModels] Skipping model fetch since there is no Copilot token source
09:21:47.217 [info] Got Copilot token for
09:21:47.275 [info] copilot token sku: copilot_for_business_seat_quota
09:21:51.332 [info] Got Copilot token for
09:21:51.347 [info] AuthenticationService: firing onDidAuthenticationChange from handleAuthChangeEvent identity change. Has token: true
09:21:51.347 [info] copilot token sku: copilot_for_business_seat_quota
```
There is a ~1.4 s window (09:21:45.882 → 09:21:47.217) in which chat is active with no token source.
After 09:21:47 the log contains no error, no 401/403, and no further auth failure — yet the modal was
still on screen.
`GitHub Authentication.log` over the same period shows the OAuth sessions are intact throughout:
```
09:21:50.750 [info] Getting sessions for read:user,user:email...
09:21:50.750 [info] Got 1 sessions for read:user,user:email...
09:21:50.747 [info] Getting sessions for all scopes...
09:21:50.747 [info] Got 7 sessions for all scopes...
```
`read:user,user:email` is Copilot's scope set and it resolves to a session. There is no
`Removing session no longer found in keychain`, no `Dropped N session(s)`, and no re-login in this log.
## What I ruled out
- **Credential storage / session loss.** 7 sessions are read back and verified from secret storage,
including Copilot's scope set. Nothing is evicted.
- **Token expiry or SSO session expiry.** The token is never rejected; no 401/403 anywhere in the logs.
- **Multi-window session-id churn.** Only one VS Code window was open. (When several windows *are* open,
a login in one rewrites every session id and the others log
`Removing session no longer found in keychain` — that produces similar prompts, but it is not what
happened here.)
- **BYOK.** No BYOK provider configured, so this is not #320537 / #335347.
## Steps to reproduce
I do not have a deterministic repro — it happens on a normal start a few times a day, presumably when
chat activation wins the race against the token source. It may be easier to reproduce with a slow or
high-latency connection to the entitlement endpoint, or by delaying the token fetch.
## Expected
Either the sign-in modal is not shown until the token source has had a chance to resolve, or it is
dismissed automatically once `Got Copilot token` / `Has token: true` arrives.
## Related
- #333139 — "Need to sign in every time I start VS Code" (macOS, `info-needed`). Same visible symptom,
but reported as sessions not persisting; here the sessions *do* persist, so it may be a different cause.
- #331773 — "It always asks to 'Sign in to use GitHub Copilot' in new tab" (macOS native tabs, `info-needed`).
- #322626 — chat appearing signed-out in untrusted workspaces (fixed); similar class of spurious prompt.
Contributor guide
Assessment
This issue has not been assessed yet.