Skip to content

docs: describe refresh-token rollout and recovery [9/10] - #22919

Merged
sergiou87 merged 6 commits into
developmentfrom
short-lived-tokens
Oct 7, 2026
Merged

sergiou87 merged 6 commits into
developmentfrom
short-lived-tokens

Conversation

@sergiou87

@sergiou87 sergiou87 commented Sep 23, 2026 •

Copy link
Copy Markdown
Member

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 gh remain out of scope.

Stack

Merge in order, starting with 1. Each PR builds, passes tests, and keeps production behavior on its own.

  1. auth: add OAuth refresh-token protocol primitives [1/10] #22917 - OAuth protocol primitives
  2. auth: handle rejected API tokens in AccountsStore [2/10] #22937 - Token invalidation in AccountsStore
  3. auth: add versioned secure-storage format for credentials [3/10] #22938 - Versioned credential storage
  4. auth: coordinate OAuth token renewal in AccountsStore [4/10] #22939 - Coordinated token renewal
  5. auth: hand Git fresh credentials [5/10] #22940 - Git credentials
  6. auth: resolve private image tokens through the renderer [6/10] #22941 - Private images
  7. auth: let Copilot sessions renew GitHub tokens [7/10] #22942 - Copilot SDK sessions
  8. auth: request refreshable OAuth tokens at sign-in [8/10] #22943 - Sign-in with refreshable tokens (behind flag)
  9. docs: describe refresh-token rollout and recovery [9/10] #22919 - Rollout and recovery documentation (this PR)
  10. auth: log automatic sign-outs [10/10] #22959 - Log automatic sign-outs

Validation

  • yarn markdownlint, yarn compile:dev, and yarn lint pass.
  • Full stack: 2,021 pass, one skipped, four pre-existing Git-policy failures.
  • Live-platform validation remains required before rollout.

Release notes

Notes: no-notes

@sergiou87
sergiou87 added this pull request to stack #22920 September 23, 2026 07:24
sergiou87 added a commit that referenced this pull request Sep 23, 2026
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]>
Copilot AI balanced review requested due to automatic review settings September 23, 2026 07:53

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

sergiou87 added a commit that referenced this pull request Sep 23, 2026
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]>
sergiou87 added a commit that referenced this pull request Sep 23, 2026
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]>
sergiou87 added a commit that referenced this pull request Sep 23, 2026
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]>
@sergiou87 sergiou87 changed the title docs: describe refresh-token rollout and recovery [3/3] docs: describe refresh-token rollout and recovery [9/9] Sep 28, 2026
@sergiou87
sergiou87 removed this pull request from stack #22920 September 28, 2026 09:00
@sergiou87
sergiou87 changed the base branch from short-lived-tokens-2-integration to short-lived-tokens-8-sign-in September 28, 2026 09:00
@sergiou87
sergiou87 added this pull request to stack #22944 September 28, 2026 09:00
@sergiou87
sergiou87 marked this pull request as ready for review September 28, 2026 15:59
@sergiou87
sergiou87 requested a review from a team as a code owner September 28, 2026 15:59
@sergiou87 sergiou87 changed the title docs: describe refresh-token rollout and recovery [9/9] docs: describe refresh-token rollout and recovery [9/10] Oct 2, 2026
niik
niik previously approved these changes Oct 2, 2026

@niik niik left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@williammartin
williammartin removed their request for review October 6, 2026 14:14
@sergiou87
sergiou87 force-pushed the short-lived-tokens branch 3 times, most recently from 1e47267 to 48bb91e Compare October 7, 2026 13:16
Base automatically changed from short-lived-tokens-8-sign-in to development October 7, 2026 14:56
sergiou87 and others added 6 commits October 7, 2026 16:56
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.
@sergiou87
sergiou87 merged commit f97587d into development Oct 7, 2026
9 checks passed
@sergiou87
sergiou87 deleted the short-lived-tokens branch October 7, 2026 15:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants