Conversation
Register .copilot in TokenAccountSupportCatalog with environment-based injection (COPILOT_API_TOKEN), matching the existing env key used by ProviderConfigEnvironment and ProviderTokenResolver. Uses requiresManualCookieSource: false since Copilot authenticates via OAuth, not cookies. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add fetchGitHubUsername(token:) static method that calls GET /user with the OAuth token to retrieve the GitHub login. Used for auto-labeling token accounts during the multi-account add flow and migration. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace single-token storage (settings.copilotAPIToken) with multi-account storage via addTokenAccount(). After OAuth, fetches GitHub username via /user and plan name via copilot_internal/user to build a "username (Plan)" label. Detects duplicate accounts by username prefix and refreshes the token instead of creating duplicates. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace single-token secure field and login buttons with an "Add Account" button that triggers OAuth device flow. The generic token accounts section (account list, picker, remove, paste fallback) appears automatically now that Copilot is in the TokenAccountSupportCatalog. Migration from config apiKey is triggered via observeSettings(). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
When copilotAPIToken exists in config but no token accounts exist, migrate the token to a ProviderTokenAccount with a fallback label and clear the config key. An async Task enriches the label with the GitHub username via /user. Migration is idempotent — guarded by checking that token accounts are empty. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…e tests Cover the token account catalog entry (injection type, env override), config-to-account migration (happy path, idempotent, no-op cases), and environment precedence (token account overrides config API key). Uses Swift Testing framework with InMemory stores matching existing patterns. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ount Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace the tab-style account switcher with stacked usage cards so each account's quota is visible at once. Fix a race where switching accounts rebuilt the menu before the async refresh completed, showing stale data. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 67f244ab7e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4dadf7cb32
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Summary
Refine Copilot multi-account support and UI. Similar to #613
This keeps legacy single-account Copilot configs working via
apiKey, fixes re-auth so existing accounts are updated in place, scopes stacked multi-account cards to Copilot only and improves the settings/menu-bar account actions.UI
Changes
apiKeyfallback for existing single-account usersValidation
./Scripts/compile_and_run.shNote
pnpm checkstill hits a pre-existing unrelated SwiftLintfile_lengthviolation inSources/CodexBar/StatusItemController+Menu.swift.