Repository navigation
fix(cli): Refresh tokens with a corrupt issued_at - #1648
Merged
Merged
Conversation
A stored issued_at at or after expires_at made the remaining-lifetime ratio Infinity (or flipped its sign), so proactive refresh was skipped until the token actually expired. Fall back to the default lifetime when the stored lifetime is not positive, and share the ratio between refreshToken and the API client so they cannot drift. Ports the remaining fix from getsentry/cli#1200. Co-Authored-By: BYK <[email protected]>
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
BYK
approved these changes
Oct 23, 2026
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Ports the token-lifetime fix that was left out of #1609 (from getsentry/cli#1200).
If a stored
issued_atis at or afterexpires_at, the remaining-lifetime ratio comes out asInfinity(zero lifetime) or flips sign. WithInfinity,refreshTokenand the API client skip proactive refresh, and the token only refreshes after it has already expired.The original PR clamped the lifetime to
Math.max(1, …). That doesn't fix it: dividing the remaining milliseconds by 1ms still gives a huge ratio for any unexpired token, so refresh is still skipped. Instead, when the stored lifetime isn't positive, this falls back toDEFAULT_TOKEN_LIFETIME_MS, the same fallback used whenissued_atis missing.refreshTokenandfetchWithRetryeach computed the ratio inline. They now sharegetRemainingLifetimeRatio, so the two can't drift apart. Valid rows behave the same as before.The project-cache read TTL from the original PR is still out of scope, per the archive note.
via BYK.
--
View Junior Session in Sentry