Skip to content

Commit 49d3ae5

Browse files
committed
Merge branch 'pr-137-head' into release-integration-20260320
# Conflicts: # lib/codex-manager.ts # test/codex-manager-cli.test.ts
2 parents fa11e14 + c3f3e8d commit 49d3ae5

File tree

11 files changed

+2253
-175
lines changed

11 files changed

+2253
-175
lines changed

docs/features.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ User-facing capability map for `codex-multi-auth`.
99
| Capability | What it gives you | Primary entry |
1010
| --- | --- | --- |
1111
| Multi-account dashboard login | Add and manage multiple OAuth identities from one terminal flow | `codex auth login` |
12+
| Onboarding backup restore | Restores the latest named backup or lets you choose a named backup manually when a fresh install or empty pool needs to recover saved accounts fast | `codex auth login` |
1213
| Account dedupe and identity normalization | Avoid duplicate saved account rows | login flow |
1314
| Explicit active-account switching | Pick the current account by index instead of relying on hidden state | `codex auth switch <index>` |
1415
| Fast and deep health checks | See whether the current pool is usable before a coding session | `codex auth check` |

docs/getting-started.md

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,21 @@ codex auth login
4343

4444
Expected flow:
4545

46-
1. The dashboard opens in the terminal.
47-
2. Choose `Add New Account`.
48-
3. Complete the official OAuth flow in your browser.
49-
4. Return to the terminal when the browser step completes.
50-
5. Confirm the account appears in the saved account list.
46+
Backup restore appears as `Restore Saved Backup` under the `Recover saved accounts` heading in the onboarding menu. This flow does not add any new CLI flags or npm scripts.
47+
See upgrade note: [onboarding restore behavior](upgrade.md#onboarding-restore-note).
48+
49+
1. If no accounts are saved yet, the terminal opens directly to the sign-in menu.
50+
2. Choose one of the sign-in options:
51+
- `Open Browser (Easy)` for the normal OAuth flow
52+
- `Manual / Incognito` when you need to paste the callback yourself
53+
- `Restore Saved Backup` under the `Recover saved accounts` heading when the current pool is empty and at least one valid named backup exists under `~/.codex/multi-auth/backups` by default, or under `%CODEX_MULTI_AUTH_DIR%\backups` if you override the storage root with `CODEX_MULTI_AUTH_DIR`
54+
3. If you choose `Restore Saved Backup`, the next menu lets you either:
55+
- load the newest valid backup automatically
56+
- pick a specific backup from a newest-first list
57+
Empty, unreadable, or non-JSON backup sidecar files are skipped, so the menu entry appears only when at least one backup parses successfully and contains at least one account.
58+
4. If you use browser or manual sign-in, complete the official OAuth flow and return to the terminal.
59+
5. If you load a backup, the selected backup is restored, its active account is synced back into Codex CLI auth, and the login flow continues with that restored pool.
60+
6. Confirm the restored or newly signed-in account appears in the saved account list.
5161

5262
Verify the new account:
5363

docs/upgrade.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,16 @@ For maintainer/debug flows, see advanced/internal controls in [development/CONFI
7676

7777
---
7878

79+
## Onboarding Restore Note
80+
81+
`codex auth login` now opens directly into the sign-in menu when the active pool is empty, instead of opening the account dashboard first.
82+
83+
- `Recover saved accounts` appears only when at least one valid named backup exists.
84+
- No new CLI flags or npm scripts were added for this flow.
85+
- The backup root remains `~/.codex/multi-auth/backups` by default, or `%CODEX_MULTI_AUTH_DIR%\backups` when `CODEX_MULTI_AUTH_DIR` is set.
86+
87+
---
88+
7989
## Legacy Compatibility
8090

8191
Legacy files may still be discovered during migration-only compatibility checks.

lib/accounts.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,12 @@ export interface ManagedAccount {
101101
expires?: number;
102102
addedAt: number;
103103
lastUsed: number;
104-
lastSwitchReason?: "rate-limit" | "initial" | "rotation" | "best";
104+
lastSwitchReason?:
105+
| "rate-limit"
106+
| "initial"
107+
| "rotation"
108+
| "best"
109+
| "restore";
105110
lastRateLimitReason?: RateLimitReason;
106111
rateLimitResetTimes: RateLimitStateV3;
107112
coolingDownUntil?: number;

0 commit comments

Comments
 (0)