Repository navigation
Conversation
mrtrotl
marked this pull request as ready for review
November 14, 2026 10:16
This branch has not been 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.
A macOS maintenance wake can send a rotating refresh token, go back to sleep before receiving its replacement, and then retry the consumed token. The IdP rejects that retry with
invalid_grant, leaving the desktop client logged out.Keep a bounded macOS idle/network power activity alive through the refresh and asynchronous Keychain write. Reacquire the activity immediately before the token POST so slow discovery cannot exhaust the protection budget. On limited power with all online displays asleep, defer renewal without clearing credentials or consuming a retry attempt; AC-powered headless renewal remains possible. Other platforms use a no-op activity.
Validation
Limits
The assertions use public macOS APIs and expire after 60 seconds. Forced sleep, critical battery, network loss, unplugging during an exchange, and an exchange outlasting that bound can still lose a response. On battery with sleeping displays, background synchronization may wait for display wake after the existing access token expires. This change prevents the observed maintenance-wake scenario; it does not make arbitrary OAuth response loss recoverable.
Raw HTTP logs contain credentials and are not attached. The incident was correlated locally across client HTTP logs, IdP issuance metadata, and macOS power logs. The patched client has subsequently been installed on the reporting Mac: the existing account renewed its token with HTTP 200 and all four configured folders completed synchronization successfully, with no Keychain write errors. Production IdP configuration is unchanged. Overnight maintenance-wake acceptance is still pending.