Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
f9482b4
feat(auth): prompt for recovery on startup
ndycode Mar 12, 2026
d1a763a
Merge branch 'git-plan/02-backup-restore-manager' into git-plan/03-st…
ndycode Mar 12, 2026
d756d0a
fix(auth): harden startup recovery prompt flow
ndycode Mar 13, 2026
cedc3e9
Merge branch 'git-plan/02-backup-restore-manager' into git-plan/03-st…
ndycode Mar 13, 2026
4832de2
fix(auth): harden startup recovery flows
ndycode Mar 13, 2026
ef42d0d
fix(auth): avoid prereading injected backup restores
ndycode Mar 13, 2026
8eba086
fix(auth): keep startup recovery non-fatal
ndycode Mar 13, 2026
dd11f35
fix(storage): keep injected backup listing resilient
ndycode Mar 13, 2026
dcd1bac
fix(auth): address latest review follow-ups
ndycode Mar 13, 2026
6c1370b
fix(auth): reuse startup recovery assessments
ndycode Mar 13, 2026
a786c40
fix(auth): tighten startup recovery follow-ups
ndycode Mar 13, 2026
350187d
fix(auth): redact startup prompt failures
ndycode Mar 13, 2026
8b1843c
fix(auth): harden startup recovery prompt flow
ndycode Mar 13, 2026
e53a45b
fix(auth): reuse startup recovery state on retry
ndycode Mar 13, 2026
357ec0b
Merge branch 'git-plan/02-backup-restore-manager' into git-plan/03-st…
ndycode Mar 13, 2026
ac13c0a
Merge git-plan/02-backup-restore-manager into git-plan/03-startup-rec…
ndycode Mar 13, 2026
d155fc4
fix(auth): redact restore failures and cover stat retry path
ndycode Mar 13, 2026
8ddfe38
Merge remote-tracking branch 'origin/git-plan/02-backup-restore-manag…
ndycode Mar 14, 2026
e280be8
Merge remote-tracking branch 'origin/git-plan/02-backup-restore-manag…
ndycode Mar 14, 2026
5d278d0
test(auth): cover empty startup recovery menu path
ndycode Mar 14, 2026
8d7d09d
fix(auth): tighten startup recovery regressions
ndycode Mar 14, 2026
1bfed78
test(auth): cover zero-actionable startup recovery branches
ndycode Mar 14, 2026
cd85db2
Merge remote-tracking branch 'origin/git-plan/02-backup-restore-manag…
ndycode Mar 14, 2026
8380de6
fix(auth): harden startup restore manager
ndycode Mar 14, 2026
011aa0c
fix(auth): remove dead startup recovery branch
ndycode Mar 14, 2026
b37cb57
Merge remote-tracking branch 'origin/git-plan/02-backup-restore-manag…
ndycode Mar 14, 2026
142f4f1
fix(auth): address startup recovery review follow-ups
ndycode Mar 14, 2026
192e4e3
Merge branch 'origin/git-plan/02-backup-restore-manager' into git-pla…
ndycode Mar 14, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ Expected flow:
4. Return to the terminal when the browser step completes.
5. Confirm the account appears in the saved account list.

If interactive `codex auth login` starts with zero saved accounts and recoverable named backups in your `backups/` directory, the login flow will prompt you to restore before opening OAuth. Confirm to launch the existing restore manager; skip to proceed with a fresh login. The prompt is suppressed in non-interactive/fallback flows and after same-session `fresh` or `reset` actions.

Verify the new account:

```bash
Expand Down
2 changes: 2 additions & 0 deletions docs/troubleshooting.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ If the account pool is still not usable:
codex auth login
```

If `codex auth login` starts with no saved accounts and recoverable named backups are present, you will be prompted to restore before OAuth. This prompt only appears in interactive terminals and is skipped after same-session fresh/reset flows.

---

## Verify Install And Routing
Expand Down
6 changes: 6 additions & 0 deletions docs/upgrade.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,12 @@ After source selection, environment variables still override individual setting
For day-to-day operator use, prefer stable overrides documented in [configuration.md](configuration.md).
For maintainer/debug flows, see advanced/internal controls in [development/CONFIG_FIELDS.md](development/CONFIG_FIELDS.md).

### Startup Recovery Prompt

Interactive `codex auth login` now offers named-backup recovery before OAuth only when the session starts with zero saved accounts and at least one recoverable named backup.

The prompt is intentionally skipped in fallback/non-interactive login paths and after same-session `fresh` or `reset` actions so an intentional wipe does not immediately re-offer restore state.

---

## Legacy Compatibility
Expand Down
6 changes: 5 additions & 1 deletion lib/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ export function isNonInteractiveMode(): boolean {
return false;
}

export function isInteractiveLoginMenuAvailable(): boolean {
return !isNonInteractiveMode() && isTTY();
}

export async function promptAddAnotherAccount(
currentCount: number,
): Promise<boolean> {
Expand Down Expand Up @@ -259,7 +263,7 @@ export async function promptLoginMode(
return { mode: "add" };
}

if (!isTTY()) {
if (!isInteractiveLoginMenuAvailable()) {
return promptLoginModeFallback(existingAccounts);
}

Expand Down
Loading