Repository navigation
docs: describe refresh-token rollout and recovery [9/10] - #22919
Conversation
Bring the three independently reviewable fixes from short-lived-tokens-2-integration into the existing documentation branch without rebasing or replacing any published commit. PR #22918 retains one new commit per adversarial-review finding; PR #22919 continues to have a documentation-only file diff relative to its implementation base. Update the OAuth lifecycle guide to explain mixed-margin callers joining active rotation, sign-in recovery preceding bounded nonblocking revocation, and the persistent Settings/Preferences account action after dismissing recovery. Include account-settings tests in the documented validation scope. Validation: Markdownlint passes for the updated guide. The merged runtime and tests exactly match the validated PR 2 branch: compilation and lint pass, 33 targeted tests pass, and the full suite has 1,973 passes, one skip, and four existing failures under safe.bareRepository=explicit. Co-authored-by: Copilot <[email protected]>
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The only unresolved feedback is a non-blocking documentation nit.
Review effort: Balanced
Findings: None
What changed in this PR
Documents OAuth refresh-token rollout, renewal, recovery, compatibility, and validation requirements.
Changes:
- Covers credential acquisition, storage, renewal, and consumer integration.
- Documents recovery, downgrade guidance, exclusions, and release validation.
| File | Description |
|---|---|
docs/technical/oauth.md |
Adds refresh-token rollout and recovery documentation. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Carry the updated integration branch into PR #22919 after the standalone fixes on PR #22917. Keep all existing commits and merge ancestry intact, with no rebasing or force-pushing. Only the protocol regression matrix changes relative to the previous documentation-branch tip; runtime behavior and the rollout guide remain unchanged. The documentation branch continues to differ from its PR #22918 base only in docs/technical/oauth.md. Co-authored-by: Copilot <[email protected]>
Integrate the PR #22918 implementation into PR #22919 without rewriting published commits. Document that SignInStore owns issued credentials until AccountsStore accepts them, and that cancellation, profile failure or unsuccessful persistence triggers bounded nonblocking cleanup of unpublished credentials. Keep installed credentials under AccountsStore ownership even when publication causes the sign-in UI to close. The documentation branch's runtime code and tests are identical to the validated implementation branch, and its diff against that branch remains documentation-only. Validation: Markdownlint passes. Implementation validation includes 79 targeted tests, successful compilation and lint, and a full-suite result of 2,007 passed, one skipped and four existing Git-policy failures. Co-authored-by: Copilot <[email protected]>
Carry the tested PR #22918 implementation into PR #22919 without rewriting published history. Explain how session retirement determines ownership of revocation: sign-out handles the credential published before retirement, while renewal cleans up replacements received after retirement. Document that secure-store deletion errors retain the credential snapshot needed for remote revocation. Runtime code and tests exactly match the validated integration branch, and the downstream PR retains a documentation-only diff. Markdownlint passes. Co-authored-by: Copilot <[email protected]>
49fecea to
b4def1a
Compare
niik
left a comment
There was a problem hiding this comment.
This is a strong technical and operational reference. The acquisition gating, GHES/GHE.com distinction, secure-storage ownership, renewal and failure taxonomy, consumer behavior, downgrade constraints, and validation requirements all match the implementation.
Non-blocking follow-ups for the final layer/support guidance: cite the automatic-sign-out log added by #22959, clarify that refresh-token expiry surfaces as ordinary reauthentication, and consider adding post-downgrade recovery instructions for users who did not sign out first.
bf1d246 to
c3e54ce
Compare
1e47267 to
48bb91e
Compare
Add `docs/technical/oauth.md`, the technical reference for short-lived, refreshable OAuth credentials in GitHub Desktop. It covers: - how sign-in requests refreshable tokens behind the feature flag and why GHES keeps access-only scopes, - the versioned secure-storage format and compatibility with existing bare access tokens, - coordinated renewal in `CredentialSessions`: one refresh per session, ordered secure-storage writes, stale-token resolution, and what happens on temporary versus definitive renewal failures, - how rejected credentials sign the account out and how users recover by signing in again, - how each consumer gets fresh tokens: API clients, Git and Git LFS through the credential helper trampoline, private images through sender-checked IPC, and Copilot SDK sessions through the token provider with the SDK's one-hour margin, - rollout and validation boundaries. This is the documentation part of the stack, rebuilt as a single commit on top of the rebased sign-in branch after the earlier PRs merged. Its content is unchanged from the previous history of this branch. Co-authored-by: Copilot <[email protected]>
Sign-ins for the same host are now installed in the order their secure storage saves succeed instead of a later sign-in superseding a pending one. Describe the resulting behavior: the last successful save is the signed-in account in memory and after relaunch, a failed save keeps the current account, and signing out does not cancel a sign-in that is still saving. Co-authored-by: Copilot <[email protected]>
Describe how Desktop keeps running Git operations working across token renewal, now that renewal of a token in use is deferred: - Each Git process holds a lease on the access token it received until it exits, shared with the Git LFS processes it starts, because Git reuses that token for every request and GitHub revokes it as soon as it is renewed. Anyone who needs a leased token renewed waits until it is released, or until it is within a minute of expiring, so during a token's last ten minutes work that needs a renewal can wait for a long Git operation. - On temporary renewal failures, Git operations keep using the current access token while it is unexpired instead of failing. - A Git operation for an account that was signed out, including after a rejected renewal, goes through the same sign-in prompt or authentication error as when no account exists. - The note about requests failing when a pair rotates now applies to API requests; Git operations are only affected if they outlive their token. Co-authored-by: Copilot <[email protected]>
Explain how Desktop's 61-minute validity requirement and the lifetime reported to the SDK share a renewal deadline: subtract the one-minute safety buffer and preserve fractional seconds. Record explicit failure for unknown or insufficient buffered lifetimes rather than inventing metadata. Document provider ownership by the originating credential session, coherent token/expiry snapshots, and permanent retirement across same-user sign-in or access-token-string reuse. A later sign-in requires a newly created client. Keep the remaining limitation explicit: these changes do not give an entire Copilot invocation a token lease, so an already-running SDK request can still be affected by another consumer rotating the pair. Validation: npx --no-install markdownlint docs/technical/oauth.md --config .markdownlint.js --rules .markdownlint-rules.js passed; git diff --check passed.
Describe the credential owner's non-serialized account-session association, including propagation through token, lease, and profile snapshots. Clarify that replacement sign-ins create distinct snapshots and that bound getters reject unknown or retired origins even when access-token text is reused. Ordinary current-account lookup semantics remain intentionally available. Document operation-entry binding before commit-message model discovery, session-bound static authentication after runtime preparation, and quota credential checks across SDK startup. Distinguish metadata's ordinary refresh margin from the longer SDK-session preflight margin. Retain the explicit warning that Copilot does not hold invocation-long token leases. Add live SDK cached-token rollover and long-running invocations to manual rollout validation; mock-boundary tests do not prove native rollover. Validation: - npx --no-install markdownlint docs/technical/oauth.md --config .markdownlint.js --rules .markdownlint-rules.js: passed. - git diff --check: passed.
Explain that commit-message generation and conflict resolution can leave client and SDK session preparation promptly even when Git holds the token lease needed by renewal. Generation can also leave shared model discovery without waiting for that shared work to complete. Cancellation affects only the caller's wait: it neither aborts shared credential renewal/model discovery nor releases another operation's lease. Document cleanup of late clients and sessions, and the distinction between conflict aborts and retryable/transport errors. Keep the existing warning that Copilot has no invocation-long lease and that an already-running SDK request can still fail after token rotation. Native cached- token rollover and long-running invocations still need live rollout validation. Validation: - npx --no-install markdownlint docs/technical/oauth.md --config .markdownlint.js --rules .markdownlint-rules.js: passed. - git diff --check: passed. - Documentation-only change; source behavior is covered by the two preceding cancellation commits and their 98 passing focused tests.
48bb91e to
fc9953d
Compare
Description
Document preview acquisition for GitHub.com and Enterprise Cloud, legacy-scope GHES sign-in until version-gated support becomes available, secure credential ownership, proactive renewal, consumer integration, immediate retry after temporary failures, signed-out reauthentication, downgrade/rollback constraints, and release validation. Invalidated credentials immediately offer Yes/No sign-in; declining leaves the account signed out. Device-bound credentials and credential sharing with
ghremain out of scope.Stack
Merge in order, starting with 1. Each PR builds, passes tests, and keeps production behavior on its own.
Validation
yarn markdownlint,yarn compile:dev, andyarn lintpass.Release notes
Notes: no-notes