Repository navigation
Conversation
Gate offline_access acquisition behind Desktop's development/preview feature switch while keeping renewal independent of that switch. Browser sign-in validates the returned credential shape and waits for secure persistence before announcing success. Legacy credentials remain readable; duplicate and cancelled authorization callbacks cannot publish or restore an account. Make AccountsStore the single-renderer credential authority. Persist rotating access/refresh pairs and expiration metadata in one versioned OS secure-store record, never plaintext account state. Share one proactive exchange at the inclusive ten-minute boundary, reread current session state, serialize writes, and retire obsolete sessions before sign-out or replacement. Keep token aliases for long-lived API clients without redirecting obsolete clients to another account. Preserve fresh credentials when older profile requests complete. Classify temporary failures separately from permanent rejection: temporary failures retain credentials and use a short retry cooldown; rejected or malformed replacement credentials persist a reauthentication marker and emit one recovery notification. A failed secure write never releases the new access token. Attempt to revoke unused replacement pairs after storage failure or concurrent sign-out. Sanitize credential-store errors and treat non-JSON gateway failures as temporary outages, not invalid credentials. Resolve credentials for every managed API request and associate 401 handling with the token actually sent. Ignore superseded-token failures and preserve explicitly anonymous public-repository requests. Refresh Git/Git LFS credentials before delivery, return ephemeral Basic credentials when Git advertises support, and redact encoded credentials from development logs. Use the Copilot SDK's on-demand session provider with its longer validity margin without exporting refresh tokens. Route private-image credential requests from the main process back to the credential authority over typed, bounded, sender-checked IPC. Reject stale replies, sign-out races, and failed refreshes without using cached stale credentials. Propagate header-filter cancellation through OrderedWebRequest. Replace the invalidated-token dialog with a sign-in-again action that explains local work is unaffected. Validation: all 148 focused OAuth, lifecycle, API/sign-in, Git/Copilot, image IPC, and recovery-dialog tests pass. Race tests cover concurrent consumers, sign-out during exchange and storage, account replacement, stale 401s, and cancelled sign-in. A correctness review identified anonymous fallback handling, now fixed and covered. yarn lint:fix ran; changed-file lint comparison adds no diagnostics over the branch baseline. Local TypeScript 6.0.3 still reports the existing DDS ArrayBuffer error, independently reproduced against the original branch; broader build/lint environment issues remain outside this change. Co-authored-by: Copilot <[email protected]>
Address the mixed-margin race identified in the adversarial review of #22918. Copilot requests at least 61 minutes of remaining validity, while API and Git callers normally require only ten. Previously, the latter callers could receive the old access token while a Copilot-triggered exchange was already rotating and invalidating that credential pair. Check the session's shared refresh promise before taking the still-valid credential shortcut. All callers now wait for the same exchange and durable credential write, regardless of their individual validity margins. Retirement and sign-in-required checks still take precedence, and normal callers outside the refresh window remain unchanged when no rotation is running. Add regression cases with a token valid for another 30 minutes, an in-flight 61-minute request, and concurrent API and account-token consumers. Verify that no caller settles early, that successful callers receive only the replacement token, and that a failed exchange reaches all waiting callers rather than leaking the old token. Both tests failed before the change with two callers settling prematurely. Validation: all 23 account-token lifecycle tests pass; yarn lint:fix passes. No commits in the existing PR stack were rewritten. Co-authored-by: Copilot <[email protected]>
Fix the persistence-failure recovery stall identified in #22918. After GitHub rotated a credential pair, an unsuccessful secure-store write previously awaited remote revocation before invalidating the local session. A stalled DELETE left every refresh waiter blocked, and a rejected cleanup could bypass sign-in recovery entirely. Mark the session as requiring sign-in, publish the tokenless account, and persist the blocked credential record before starting best-effort cleanup. Run unused-token revocation outside the credential request's completion path. Apply the same cleanup path to replacements arriving after sign-out or retirement so network cleanup cannot hold those callers open either. Give unused-token cleanup a 30-second deadline and forward its AbortSignal through deleteToken and the shared HTTP request helper to fetch. Race the deadline independently of cancellation so an uncooperative transport cannot keep cleanup pending indefinitely. Clear timers on completion and report unsuccessful or rejected cleanup with a sanitized warning, without replacing the actionable persistence error. Regression tests first reproduced missing recovery during a stalled DELETE, missing warnings for unsuccessful cleanup, and raw cleanup errors escaping instead of the storage failure. Coverage now verifies prompt emission, the persisted blocked record, release of concurrent callers before cleanup finishes, continued rejection of unusable credentials, the exact 30-second cancellation boundary, and timer disposal after failed cleanup. Validation: 50 lifecycle, HTTP, and OAuth authentication tests pass; yarn lint:fix and yarn compile:dev pass. Existing optional-signal-free HTTP and token-revocation callers retain their behavior. Co-authored-by: Copilot <[email protected]>
Address the recovery dead end found in #22918. Invalidated accounts remain in Desktop so local repositories and identity associations are not discarded, and background failures intentionally show the recovery dialog only once. Dismissing that dialog previously left account settings with only Sign out, forcing users to remove the account before they could recover. Display a persistent Sign in again action beside Sign out whenever an account has no usable access token. Reuse the existing sign-in dialogs without deleting the retained account. Carry the selected Enterprise account's HTML endpoint through Preferences into the dispatcher so users return to the correct host; keep new Enterprise sign-ins endpoint-free and avoid passing button click events as endpoint arguments. Make recovery the preferred initial action for a blocked GitHub.com account, restore the existing Sign out focus behavior after successful authentication, and preserve sign-out availability throughout. Add spacing for the two actions in narrow settings layouts. Background prompt deduplication is unchanged, so repeated failed work does not repeatedly interrupt local activity. Add UI regressions for dismissed-dialog recovery, durable blocked state after restart, GitHub.com and Enterprise sign-in routing, multiple Enterprise hosts, successful reauthentication removing the recovery action, focus behavior, and unaffected empty-account sign-in actions. Before the implementation, the new recovery checks failed because no Sign in again button existed. Validation: all 33 targeted lifecycle and recovery UI tests pass. yarn lint:fix, yarn lint, and yarn compile:dev pass. Full unit/UI suite: 1,973 passed, one skipped, and the same four pre-existing Git push/bare-repository failures under the injected safe.bareRepository=explicit policy. No real OAuth or cross-platform E2E run was performed. Co-authored-by: Copilot <[email protected]>
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
🟡 Changes recommended
Cancelled or failed sign-ins can leave an unpersisted OAuth credential pair active without any later cleanup path.
Get a fresh assessment by requesting another Copilot review.
Review effort: Balanced
Findings: 1
Open (1)
What changed in this PR
Integrates coordinated OAuth token renewal throughout GitHub Desktop.
Changes:
- Adds secure rotating-credential storage and renewal coordination.
- Supplies fresh tokens to API, Git, images, and Copilot.
- Adds persistent sign-in recovery UI and regression coverage.
| File | Description |
|---|---|
app/src/lib/account-credential.ts |
Serializes secure credential pairs. |
app/src/lib/api.ts |
Resolves fresh API tokens. |
app/src/lib/authenticated-image-token-handler.ts |
Handles image-token IPC. |
app/src/lib/feature-flag.ts |
Gates short-lived token acquisition. |
app/src/lib/http.ts |
Supports request cancellation. |
app/src/lib/ipc-shared.ts |
Adds image-token channels. |
app/src/lib/oauth-token.ts |
Classifies gateway failures. |
app/src/lib/stores/accounts-store.ts |
Coordinates credential lifecycle. |
app/src/lib/stores/app-store.ts |
Integrates recovery events. |
app/src/lib/stores/copilot-store.ts |
Refreshes Copilot credentials. |
app/src/lib/stores/sign-in-store.ts |
Persists OAuth credentials safely. |
app/src/lib/trampoline/trampoline-credential-helper.ts |
Refreshes Git credentials. |
app/src/main-process/app-window.ts |
Exposes main web contents. |
app/src/main-process/authenticated-image-filter.ts |
Authorizes private images. |
app/src/main-process/authenticated-image-token-resolver.ts |
Coordinates image-token requests. |
app/src/main-process/main.ts |
Wires image authentication IPC. |
app/src/main-process/ordered-webrequest.ts |
Propagates request cancellation. |
app/src/ui/index.tsx |
Installs credential providers. |
app/src/ui/invalidated-token/invalidated-token.tsx |
Adds recovery messaging. |
app/src/ui/preferences/accounts.tsx |
Adds reauthentication controls. |
app/src/ui/preferences/preferences.tsx |
Preserves Enterprise endpoints. |
app/styles/ui/_preferences.scss |
Spaces recovery buttons. |
app/test/unit/account-token-lifecycle-test.ts |
Tests token lifecycle races. |
app/test/unit/authenticated-image-filter-test.ts |
Tests image filtering. |
app/test/unit/authenticated-image-token-handler-test.ts |
Tests renderer IPC handling. |
app/test/unit/authenticated-image-token-resolver-test.ts |
Tests resolver security and timing. |
app/test/unit/ipc-contract-test.ts |
Verifies new IPC channels. |
app/test/unit/oauth-authentication-test.ts |
Tests OAuth integration. |
app/test/unit/oauth-token-test.ts |
Tests gateway failure handling. |
app/test/unit/refresh-token-consumers-test.ts |
Tests Git and Copilot consumers. |
app/test/unit/ui/accounts-test.tsx |
Tests settings recovery actions. |
app/test/unit/ui/invalidated-token-test.tsx |
Tests recovery dialog behavior. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Merge short-lived-tokens-1-oauth after its two separately committed review fixes. Preserve all original protocol, integration, and lifecycle-fix commits rather than rewriting published history. The integration branch already contained the same request-body narrowing and HTTP classification corrections. Git retains those identical changes and adds the new 24-case protocol regression matrix from PR #22917. No runtime code changes are introduced by this merge; the previous integration regressions and HTML gateway test remain intact. Standalone protocol validation before merging: 89 tests pass, compilation and lint pass, and the full suite has only the four known Git-policy failures. The merged stack will be validated again before publishing. Co-authored-by: Copilot <[email protected]>
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]>
Make the existing bounded unused-token cleanup available to sign-in flows that have received OAuth credentials but have not fetched a user profile. Revocation only requires an API endpoint and an access token, so accepting a complete Account unnecessarily tied cleanup to successful account discovery. Accept Pick<Account, 'endpoint' | 'token'> in deleteToken and AccountsStore.revokeUnusedToken, and document the latter as a public cleanup operation for credentials that were never installed. Keep its 30-second cancellation deadline, sanitized failure reporting, and nonblocking caller contract unchanged. Existing renewal and sign-out callers remain structurally compatible. Exercise real cleanup requests for GitHub.com and Enterprise API endpoints before any account exists. Verify the DELETE destination and token body, one request, no installed accounts, and cleared timeout after success. Existing stalled/rejected cleanup and credential lifecycle coverage continues to pass. Validation: 45 lifecycle and OAuth authentication tests pass; yarn lint:fix and yarn compile:dev pass. This establishes the shared cleanup interface without changing sign-in ownership behavior yet. Co-authored-by: Copilot <[email protected]>
Keep ownership of exchanged credentials in SignInStore until AccountsStore accepts them. A cancelled browser flow, failed profile lookup, or unsuccessful secure-store write must not abandon a known live credential with no remaining cleanup owner. Record the issued access token immediately after exchange and use a finally block to revoke it on every unpublished exit. Reuse the shared 30-second bounded cleanup without awaiting remote revocation, so cancellation and actionable sign-in errors are not delayed or replaced by cleanup failures. Requests that never return credentials do not trigger revocation. Transfer ownership as soon as addAccount returns a non-null account, before checking whether the sign-in flow is still current. AccountsStore can emit updates while publishing the account, so a synchronous cancellation at that point must not cause SignInStore to revoke already installed credentials. Cleanup always targets the credential captured by the abandoned flow, never a newer account's token. Extend authentication tests to observe real DELETE requests. Cover cancellation during exchange, profile lookup and secure storage; profile and keychain failures; successful publication; cancellation during publication; a replacement account installed before an abandoned exchange finishes; failed exchange without credentials; stalled cleanup at the exact 30-second boundary; and both rejected and unsuccessful cleanup. Nine cleanup assertions failed before the implementation and now pass. Validation: all 79 targeted sign-in, authentication and lifecycle tests pass. yarn lint:fix, yarn lint and yarn compile:dev pass. Full unit/UI suite: 2,007 passed, one skipped, and the same four pre-existing Git push/bare-repository failures under safe.bareRepository=explicit. No live OAuth or OS secure-store validation was performed. 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]>
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Sign-out can revoke a stale access token while leaving a concurrently renewed credential active.
Get a fresh assessment by requesting another Copilot review.
Review effort: Balanced
Findings: 1
Open (1)
Resolved since last review (1)
Ensure sign-out revokes the credential actually retired by AccountsStore. AppStore previously read an account snapshot through getAll and then separately awaited removeAccount. A concurrent OAuth renewal could publish a replacement between those steps, leaving sign-out to delete the stored replacement but revoke only the obsolete access token. Return the current Account from removeAccount, capturing it immediately before session retirement with no intervening await. AppStore uses that returned snapshot for remote revocation instead of performing its own lookup. Rotation that completes before retirement is therefore covered by sign-out; rotation that completes after retirement remains covered by the existing unused-replacement cleanup. Return null when the requested identity is absent or no longer matches, preventing stale removal requests from revoking another account. Preserve the captured credential if secure-store deletion fails so local error reporting does not suppress remote cleanup. Keep the snapshot stable while queued writes permit a subsequent sign-in to install a different credential. Add a deterministic AppStore regression that lets renewal finish after the former lookup but before actual removal, then verifies that DELETE receives the replacement access token. Cover failed secure-store deletion, absent or different identities, and a replacement installed while deletion is pending. All four new tests failed before the change; existing late-renewal and sign-out persistence tests continue to pass. Validation: 66 targeted account lifecycle, account storage, OAuth authentication and consumer tests pass. yarn lint:fix, yarn lint and yarn compile:dev pass. Full unit/UI suite: 2,011 passed, one skipped, and the same four pre-existing Git push/bare-repository failures under safe.bareRepository=explicit. No live OAuth validation was performed. 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]>
Bring the shared OAuth and Copilot record guard forward from the protocol PR. Preserve the integration changes while keeping the refactor owned by the first PR in the stack. Co-authored-by: Copilot <[email protected]>
Restore the invalid-token recovery contract for permanently unusable sessions. When GitHub rejects rotation, returns unusable replacement credentials, or secure persistence fails, retire the current account and clear its secure credential before reporting that sign-in is required. Notify the UI as soon as retirement is visible so the user gets the existing immediate sign-in prompt; declining leaves the account signed out rather than in a persistent account-settings recovery state. Share the atomic retirement path with explicit sign-out so late refreshes cannot restore an invalidated account. Keep transient network and service failures on the retry path. Preserve the prior 401 behavior by attempting bounded revocation of the rejected access token, while ignoring stale 401s that refer to a token already replaced by renewal. Use the previous Yes/No invalidation dialog and the regular sign-in choices after dismissal. Clean up sign-in-required markers written by earlier preview builds on startup without changing the existing behavior for legacy accounts whose secure-store entry is simply missing. Surface secure-deletion failures while leaving the account removed. Cover permanent rejection, malformed replacement, failed persistence, invalid 401s, restart migration, secure-deletion failure, and the old recovery UI. Validation on the standalone integration branch: 69 focused tests pass; yarn compile:dev succeeds. On the full stack, 2,020 tests pass, one skips, and four established Git-policy baseline tests fail; yarn lint and yarn markdownlint pass. Co-authored-by: Copilot <[email protected]>
Permanent OAuth renewal failure now signs out the account and uses the existing invalid-token dialog. Account settings therefore needs no per-account Enterprise endpoint callback or extra wrapper for its Add GitHub Enterprise account action. Restore the original account-settings and preferences callbacks, so both components match their pre-feature behavior. Keep the signed-out account-settings regression coverage, but use the original zero-argument Enterprise sign-in callback in its fixture. Verify 44 focused UI and account-lifecycle tests, yarn compile:dev, and yarn lint. The full suite has 2,020 passing tests, one skip, and the same four established Git-policy failures. Co-authored-by: Copilot <[email protected]>
The signed-out recovery flow leaves one action per account row. Remove the narrow-screen spacing rule that existed only for the former Sign in again and Sign out button pair, restoring the preferences stylesheet to its pre-feature content. The account-settings component also matches its pre-feature behavior. Its dedicated test now rechecks original sign-in options and focus rather than changed UI; remove it while retaining account lifecycle tests for persistent sign-out and dialog tests for the Yes/No recovery prompt. Validation: 41 focused lifecycle and recovery-dialog tests pass; yarn compile:dev and yarn lint pass. Full suite: 2,017 pass, one skipped, four established Git-policy failures. Co-authored-by: Copilot <[email protected]>
Keep AppStore responsible only for presenting the invalidated-token dialog. Register the API invalidation callback beside the shared token provider in renderer startup, so AccountsStore owns stale-token checks, account retirement, and error reporting without subscribing every short-lived test store to a process-wide API event.\n\nRename the store's sign-in-required event to onTokenInvalidated for both API rejections and permanently unusable rotating credentials. Give API listeners a cleanup function and release test subscriptions, preventing old test stores from responding to later 401s.\n\nCover end-to-end API-to-store invalidation and callback error propagation. Focused tests, compile:dev, and lint pass; the full suite has only the four previously established Git-policy failures. Co-authored-by: Copilot <[email protected]>
| response = await listener(details) | ||
| if (response.cancel === true) { | ||
| break | ||
| return response |
There was a problem hiding this comment.
break stopped later filters, but execution then reached return details in ordered-webrequest.ts. That dropped { cancel: true }, so Electron could still send request.
return response stops filters and passes cancellation back to Electron. This matters when authenticated-image-filter.ts cancels request after credential refresh fails or account changes.
Extract the request state held by the image token resolver into a private IPendingImageTokenRequest interface. Keep the same sender, endpoint, and completion callback contract without changing request behavior. Co-authored-by: Copilot <[email protected]>
Rename the private image-account interface to IImageEndpointToken and list its session identity before endpoint and token fields. No runtime behavior changes. Co-authored-by: Copilot <[email protected]>
Use IImageOriginEntry for each origin's session-bound token, call the lookup map imageOrigins, and name its active value entry. Restore the original field ordering while keeping image request behavior unchanged. Co-authored-by: Copilot <[email protected]>
Do not request offline_access from GitHub Enterprise Server during the short-lived-token preview. No GHES version currently supports refreshable OAuth credentials, so leave the existing browser flow and legacy scopes in place until a supported version can be gated explicitly. Continue opting in GitHub.com and hosted ghe.com sign-ins, and keep renewal of already-issued credential pairs independent of acquisition. Cover preview-enabled and preview-disabled scopes across GitHub.com, GHES, and ghe.com. Regression test failed for GHES before this change and passes afterward. Co-authored-by: Copilot <[email protected]>
Remove the per-session 30-second retry cooldown so a user can retry fetch or other authenticated work as soon as the service recovers. Keep in-flight renewal sharing for simultaneous callers and retain credentials after transient failures. Preserve the actionable connection guidance from the removed cooldown branch on the original failure instead of exposing a generic token-request error. Cover an immediate fail-then-successful-retry without a sign-in prompt, and require concurrent callers to receive the same helpful temporary error. Focused lifecycle and consumer tests pass. Co-authored-by: Copilot <[email protected]>
The image-token IPC listener depends only on a resolver callback, not an AccountsStore-shaped object. Accept the callback directly, pass the bound arrow method from renderer startup, and simplify handler tests without changing IPC or credential behavior. Co-authored-by: Copilot <[email protected]>
Remove the API-layer requestOAuthToken wrapper: it only translated the API endpoint to its HTML origin before calling exchangeOAuthToken. Keep that translation at the sign-in call site and leave the shared exchange/refresh request helper in oauth-token.ts unchanged.\n\nUpdate the GHES exchange test to exercise the explicit endpoint conversion and preserve its credential metadata assertions. This leaves one public authorization-code exchange entry point without changing network or sign-in behavior.\n\nValidation: focused OAuth and sign-in tests pass; development compile and lint:fix pass. Full suite reports 2,021 passing, one skipped, and four previously observed Git-policy failures. Co-authored-by: Copilot <[email protected]>
Rename the constructor flag to describe the shared account-token handling it controls: resolving and refreshing stored tokens and reporting their rejection. Document why newly issued sign-in credentials and the public-repository fallback instead use their supplied token without borrowing a signed-in account's state. Co-authored-by: Copilot <[email protected]>
Rename the four per-endpoint maps to say what they index and why they exist: - sessions -> sessionsByEndpoint: the signed-in session for each endpoint (account, credential pair, renewal state). - tokenSessions -> sessionsByToken: maps every access token a session issued back to that session, so long-lived API clients holding an older token copy still resolve the current token after rotation. - writes -> credentialWriteQueues: per-endpoint promise chain that serializes secure-storage saves and deletes. - versions -> sessionGenerations: per-endpoint counter bumped when a session is replaced or removed; async sign-in steps compare it to discard stale results. Local 'version' variables become 'generation' to match. Add a short doc comment to each field. No behavior change. Co-authored-by: Copilot <[email protected]>
AccountsStore had grown two jobs: maintaining the persisted account list (its original purpose) and running the short-lived credential lifecycle. The second half owned four endpoint/token maps, refresh deduplication, rotation, rejected-token classification, bounded revocation, and a per-endpoint secure-storage write queue with a generation guard, all interleaved with list management. Move that lifecycle into a new CredentialSessions class (app/src/lib/credential-sessions.ts): - sessionsByEndpoint, sessionsByToken, credentialWriteQueues and sessionGenerations now live there, together with validToken, rotate, invalidateToken, revokeUnusedToken and the write queue. - restore() installs credentials read at startup; add() saves and installs a new sign-in, returning null when superseded or no longer current; retire() and delete() back account removal. - getFreshToken() and trackToken() replace the direct session access that getAccountWithFreshToken and profile refresh used, so AccountsStore no longer sees session objects. - AccountRequiresSignInError and refreshMargin move with it. AccountsStore keeps the account list, startup loading, keychain error reporting and events. It supplies an ICredentialSessionsDelegate: requireSignIn removes the account (retiring its session synchronously), emits token-invalidated and deletes stored credentials; onTokenRenewed updates the listed account's token and saves. Its public API and constructor are unchanged, so existing lifecycle tests exercise the refactor as-is. Drop the per-session 'notified' flag: requireSignIn only proceeds for the endpoint's current session and retires it immediately, so a second notification for the same session was already unreachable. Add credential-sessions-test.ts covering the class without AccountsStore: single renewal shared by concurrent callers and stale-token resolution, pass-through of foreign tokens, sign-out on rejected renewal, dropping a superseded sign-in, trackToken after retirement, and invalidation of current versus obsolete tokens. Co-authored-by: Copilot <[email protected]>
The callback passed from SignInStore.resolveOAuthRequest through AccountsStore.addAccount to CredentialSessions.add was called isCurrent, which did not say what was current. It reports whether this browser sign-in attempt is still the one the dialog is waiting for: the store is still on the Authentication step with the same oauthState captured when the callback arrived. It turns false when the user cancels, restarts sign-in, or the flow moves on, and the attempt is then abandoned: nothing is published, a just-saved keychain entry is deleted, and the unused token is revoked. Rename it to isSignInAttemptActive in all three places and document what it means where it is created and where it is accepted. No behavior change. Co-authored-by: Copilot <[email protected]>
SignInStore passed isSignInAttemptActive down through AccountsStore.addAccount into CredentialSessions.add so a sign-in cancelled while its secure-storage write was queued or in progress could skip the write, delete the just-saved entry, and have its token revoked. development never cancels at that stage: the sign-in flow checks once whether it is still active before handing the account to AccountsStore, and addAccount then always completes. Keep that behavior to keep this change focused. Drop the callback from addAccount and CredentialSessions.add; SignInStore still checks the attempt after the code exchange, after profile lookup, and after addAccount returns, and still revokes credentials abandoned before they are handed over. A cancellation during the save now leaves the account signed in without reporting success to the dismissed dialog, as in development. The generation guard in CredentialSessions.add stays, so a save superseded by another sign-in or a sign-out is still skipped. Tests: remove the AccountsStore test for a cancelled login after storage, and turn the sign-in test for cancellation during secure storage into one asserting the credential is kept and not revoked. Co-authored-by: Copilot <[email protected]>


Description
Development/preview browser sign-in requests renewable OAuth credentials for GitHub.com and GitHub Enterprise Cloud. GHES retains access-only OAuth scopes until a supported server version can be gated; existing accounts and legacy credentials continue to work. Credentials stay paired in secure storage. Desktop renews them before API, Git/Git LFS, Copilot, and private-image operations; concurrent consumers share renewal. Abandoned sign-in credentials and sign-out races are cleaned up without exposing refresh tokens. Temporary renewal failures retain the account, report connection guidance, and allow the next authenticated operation to retry immediately. Rejected or unusable credentials sign the user out and immediately offer Yes/No reauthentication. Declining leaves the account signed out.
Stack
Validation
yarn compile:devandyarn lintpass.Screenshots
Recovery-dialog screenshots are not yet captured.
Release notes
Notes: no-notes