You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Race condition in token validation when choosing between multiple GHES #10014
PAT token input saves are saved and debounced through syncForm, so a pending save could run after the selector had loaded another domain's values. The callback then read the updated form but wrote it through the previous domain's storage instance.
Doubtful. The delay 300ms, you can hardly paste a token and make a domain change before that's done even if you tried.
A separate validation race also occurred. The selected host changed before its PAT finished loading. The validation effect sent the previous PAT to the new host via both getTokenInfo and tokenUser, resulting in two HTTP 401 responses. Validation ran again with the correct PAT after storage loading completed.
Validation has nothing to do with data being saved to the form, so it most certainly can't be the cause of it.
Sounds like the title of this issue doesn't match the contents.
The component's host attribute is updated immediately, triggering a fetch request with the stale input value
OptionsSync takes a moment to read from storage, set the input value and trigger an input event
I don’t think this caused data loss but it definitely causes one extra fetch.
Assuming that Svelte is handling these promises correctly, it shouldn't really cause issues other than a visual flicker caused by the token being sent to the wrong instance.
Thanks for the really quick reply. I wasn't expecting one on the weekend. I think I got too blindsided by my experience in #8428.
You're right - the persistence was absolutely fine; only the token validator was showing an invalid status. I'll update the title, description, and reproduction to be consistent with this.
The bug is in the token validator's async lifecycle. A domain change can start validation with the previous domain's token, and that stale request can finish after the correct validation and overwrite the <span> with invalid.
Adding a guard to check the previous results seems to have fixed it 😄
changed the title [-]Person Access Token aren't persisted for multiple GHES[/-][+]Race condition when validating tokens domain selector has 2+ GHES[/+]on Aug 29, 2026
changed the title [-]Race condition when validating tokens domain selector has 2+ GHES[/-][+]Race condition in token validation when domain selector has 2+ GHES[/+]on Aug 29, 2026
changed the title [-]Race condition in token validation when domain selector has 2+ GHES[/-][+]Race condition in token validation when choosing between multiple GHES[/+]on Aug 29, 2026
@fregante I noticed labeled this "under discussion". Are there any other points to discuss? Unfortunately, I can't upload a video for the issue because it would expose the corporate domain hosts.
Otherwise, I can put up a PR for this after further testing this week.
PR welcome. What's up for discussion is how to fix it and whether it's worth it. A simple debounce would work already but I don't want to lose the immediate feedback when pasting a token.
Activity
qasic commentedon Aug 29, 2026
fregante commentedon Aug 29, 2026
No direct OptionsSync access allowed. The plan is to improve OptionsSync itself to allow widget updates and remove the additional glue.
So either this is fixed in OptionsSync or some more glue is added to avoid race conditions.
fregante commentedon Aug 29, 2026
Doubtful. The delay 300ms, you can hardly paste a token and make a domain change before that's done even if you tried.
Validation has nothing to do with data being saved to the form, so it most certainly can't be the cause of it.
Sounds like the title of this issue doesn't match the contents.
fregante commentedon Aug 29, 2026
I think what you're seeing is this:
hostattribute is updated immediately, triggering a fetch request with the staleinputvalueinputvalue and trigger aninputeventI don’t think this caused data loss but it definitely causes one extra fetch.
Assuming that Svelte is handling these promises correctly, it shouldn't really cause issues other than a visual flicker caused by the token being sent to the wrong instance.
qasic commentedon Aug 29, 2026
Thanks for the really quick reply. I wasn't expecting one on the weekend. I think I got too blindsided by my experience in #8428.
You're right - the persistence was absolutely fine; only the token validator was showing an invalid status. I'll update the title, description, and reproduction to be consistent with this.
The bug is in the token validator's async lifecycle. A domain change can start validation with the previous domain's token, and that stale request can finish after the correct validation and overwrite the
<span>withinvalid.Adding a guard to check the previous results seems to have fixed it 😄
[-]Person Access Token aren't persisted for multiple GHES[/-][+]Race condition when validating tokens domain selector has 2+ GHES[/+][-]Race condition when validating tokens domain selector has 2+ GHES[/-][+]Race condition in token validation when domain selector has 2+ GHES[/+][-]Race condition in token validation when domain selector has 2+ GHES[/-][+]Race condition in token validation when choosing between multiple GHES[/+]qasic commentedon Aug 31, 2026
@fregante I noticed labeled this "under discussion". Are there any other points to discuss? Unfortunately, I can't upload a video for the issue because it would expose the corporate domain hosts.
Otherwise, I can put up a PR for this after further testing this week.
fregante commentedon Aug 31, 2026
PR welcome. What's up for discussion is how to fix it and whether it's worth it. A simple debounce would work already but I don't want to lose the immediate feedback when pasting a token.
Fix token validation status race
Fix PAC validation race condition