Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
e9fe149
feat(auth): add backup restore manager
ndycode Mar 12, 2026
c10e66b
test(auth): cover backup restore manager flow
ndycode Mar 12, 2026
bd8060b
fix(auth): harden named backup restore paths
ndycode Mar 13, 2026
7443074
Merge branch 'git-plan/01-reset-safety' into git-plan/02-backup-resto…
ndycode Mar 13, 2026
f5f3945
fix(storage): cover restore backup edge cases
ndycode Mar 13, 2026
c659e72
fix(auth): harden backup restore follow-up
ndycode Mar 13, 2026
11f8c45
fix(storage): guard backup restore edge cases
ndycode Mar 13, 2026
bf93df9
fix(auth): close backup restore review gaps
ndycode Mar 13, 2026
d12e6da
fix(auth): refresh restore eligibility before confirm
ndycode Mar 13, 2026
a0544ff
fix(storage): honor null restore snapshots
ndycode Mar 14, 2026
17d943e
fix(auth): bound restore assessment concurrency
ndycode Mar 14, 2026
d832af8
fix(storage): surface backup scan failures
ndycode Mar 14, 2026
a21b017
test(auth): harden restore concurrency regression
ndycode Mar 14, 2026
f5a3e00
fix(auth): harden backup restore discovery
ndycode Mar 14, 2026
65ee48c
fix(auth): harden backup restore edge cases
ndycode Mar 14, 2026
a12a748
fix(storage): reject invalid named backup entries
ndycode Mar 14, 2026
ee7a402
fix(auth): close restore review follow-ups
ndycode Mar 14, 2026
c6ce2b7
fix(auth): close remaining restore review gaps
ndycode Mar 14, 2026
348ac7f
fix(auth): tighten restore eligibility edges
ndycode Mar 14, 2026
5d85159
fix(storage): reuse assessed backup paths
ndycode Mar 14, 2026
1208639
fix(auth): align restore confirm flow
ndycode Mar 14, 2026
7f6870d
fix(auth): harden restore path guards
ndycode Mar 14, 2026
9ebc86e
fix(auth): tighten backup restore edge cases
ndycode Mar 14, 2026
da40e70
fix(storage): preserve duplicate-only metadata updates
ndycode Mar 14, 2026
b107ba8
fix(storage): align restore assessment with import semantics
ndycode Mar 14, 2026
72b4367
fix: close remaining backup restore review gaps
ndycode Mar 14, 2026
a80c1e3
fix: reuse listed backups during restore assessment
ndycode Mar 14, 2026
edd1dc6
test: harden win32 stat retry coverage
ndycode Mar 14, 2026
28ab430
test: guard win32 platform spy cleanup
ndycode Mar 14, 2026
58e3fd0
fix restore review regressions
ndycode Mar 14, 2026
082b061
fix backup restore review followups
ndycode Mar 14, 2026
da5c402
fix restore review follow-ups
ndycode Mar 14, 2026
bd0e944
fix restore path guard follow-ups
ndycode Mar 14, 2026
5a08e64
fix(auth): close remaining restore review gaps
ndycode Mar 14, 2026
620d2a6
refactor(storage): inline backup candidate cache usage
ndycode Mar 14, 2026
4b779ca
fix(storage): tighten restore retry safeguards
ndycode Mar 14, 2026
94c18b8
fix(auth): harden restore containment checks
ndycode Mar 15, 2026
0ad61da
fix(storage): harden backup root validation
ndycode Mar 15, 2026
16cc8d3
fix(storage): close remaining restore review gaps
ndycode Mar 15, 2026
a57e226
fix(storage): harden final restore review gaps
ndycode Mar 15, 2026
47f1789
fix(storage): tighten restore containment races
ndycode Mar 15, 2026
f80823b
fix(storage): close restore review gaps
ndycode Mar 15, 2026
24029c3
fix(storage): harden restore validation checks
ndycode Mar 15, 2026
8d61d29
fix(storage): tighten restore fallback path handling
ndycode Mar 15, 2026
35eb932
fix(storage): share named-backup restore path
ndycode Mar 15, 2026
c623b22
fix(cli): clarify restore follow-up contracts
ndycode Mar 15, 2026
6605d4d
fix(storage): clarify restore assessment counters
ndycode Mar 15, 2026
b5e438f
fix(storage): separate transient backup validation errors
ndycode Mar 15, 2026
61a466b
fix(cli): fail direct restore command on restore errors
ndycode Mar 15, 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/reference/commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ Compatibility aliases are supported:
| `codex auth switch <index>` | Set active account by index |
| `codex auth check` | Run quick account health check |
| `codex auth features` | Print implemented feature summary |
| `codex auth restore-backup` | Open the backup restore picker directly |

---

Expand Down Expand Up @@ -111,6 +112,7 @@ codex auth report --live --json
Repair and recovery:

```bash
codex auth restore-backup
codex auth fix --dry-run
codex auth fix --live --model gpt-5-codex
codex auth doctor --fix
Expand Down
6 changes: 6 additions & 0 deletions docs/reference/public-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ Compatibility policy for Tier B:
- Existing exported symbols must not be removed in this release line.
- Deprecated usage may be documented, but hard removals require a major version transition plan.

Current additive compatibility note:

- `importAccounts()` now returns `{ imported, total, skipped, changed }` at runtime.
- The exported `ImportAccountsResult` type keeps `changed` optional so older callers modeling the legacy shape remain source-compatible.
- New callers should read `changed` to distinguish duplicate-only no-ops from metadata-refresh writes.

### Tier C: Internal APIs

Internal APIs are any non-exported internals and implementation details not covered by Tier A or Tier B.
Expand Down
14 changes: 14 additions & 0 deletions docs/reference/storage-paths.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ Override root:
| --- | --- |
| Unified settings | `~/.codex/multi-auth/settings.json` |
| Accounts | `~/.codex/multi-auth/openai-codex-accounts.json` |
| Named backups | `~/.codex/multi-auth/backups/<name>.json` |
| Accounts backup | `~/.codex/multi-auth/openai-codex-accounts.json.bak` |
| Accounts WAL | `~/.codex/multi-auth/openai-codex-accounts.json.wal` |
| Flagged accounts | `~/.codex/multi-auth/openai-codex-flagged-accounts.json` |
Expand Down Expand Up @@ -56,6 +57,7 @@ Backup metadata:
When project-scoped behavior is enabled:

- `~/.codex/multi-auth/projects/<project-key>/openai-codex-accounts.json`
- `~/.codex/multi-auth/projects/<project-key>/backups/<name>.json`

`<project-key>` is derived as:

Expand Down Expand Up @@ -100,6 +102,17 @@ Rules:
- `.rotate.`, `.tmp`, and `.wal` names are rejected
- existing files are not overwritten unless a lower-level force path is used explicitly

Restore workflow:

1. Run `codex auth login`.
2. Open the `Recovery` section.
3. Choose `Restore From Backup`.
4. Pick a backup and confirm the merge summary before import.

Direct entrypoint:

- Run `codex auth restore-backup` to open the same picker without entering the full login dashboard first.

---

## oc-chatgpt Target Paths
Expand All @@ -115,6 +128,7 @@ Experimental sync targets the companion `oc-chatgpt-multi-auth` storage layout:
## Verification Commands

```bash
codex auth login
codex auth status
codex auth list
```
Expand Down
11 changes: 11 additions & 0 deletions lib/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ export type LoginMode =
| "check"
| "deep-check"
| "verify-flagged"
| "restore-backup"
| "cancel";

export interface ExistingAccountInfo {
Expand Down Expand Up @@ -233,6 +234,14 @@ async function promptLoginModeFallback(
) {
return { mode: "verify-flagged" };
}
if (
normalized === "u" ||
normalized === "backup" ||
normalized === "restore" ||
normalized === "restore-backup"
) {
return { mode: "restore-backup" };
}
if (normalized === "q" || normalized === "quit")
return { mode: "cancel" };
console.log(UI_COPY.fallback.invalidModePrompt);
Expand Down Expand Up @@ -287,6 +296,8 @@ export async function promptLoginMode(
return { mode: "deep-check" };
case "verify-flagged":
return { mode: "verify-flagged" };
case "restore-backup":
return { mode: "restore-backup" };
case "select-account": {
const accountAction = await showAccountDetails(action.account);
if (accountAction === "delete") {
Expand Down
Loading