Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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: 1 addition & 1 deletion .codex-plugin/plugin.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "codex-multi-auth",
"version": "2.1.13-beta.0",
"version": "2.1.13-beta.1",
"description": "Install and operate codex-multi-auth for the official @openai/codex CLI with multi-account OAuth rotation, switching, health checks, and recovery tools.",
"interface": {
"composerIcon": "./assets/codex-multi-auth-icon.svg"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ codex-multi-auth doctor --json

## Release Notes

- Current prerelease: [docs/releases/v2.1.13-beta.0.md](docs/releases/v2.1.13-beta.0.md) — install via `npm i -g codex-multi-auth@beta`
- Current prerelease: [docs/releases/v2.1.13-beta.1.md](docs/releases/v2.1.13-beta.1.md) — install via `npm i -g codex-multi-auth@beta`
- Current stable: [docs/releases/v2.1.12.md](docs/releases/v2.1.12.md)
- Previous stable: [docs/releases/v2.1.11.md](docs/releases/v2.1.11.md)
- Earlier stable: [docs/releases/v2.1.10.md](docs/releases/v2.1.10.md)
Expand Down
2 changes: 1 addition & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Public documentation for the `codex-multi-auth` Codex CLI multi-account OAuth ma

| Document | Focus |
| --- | --- |
| [releases/v2.1.13-beta.0.md](releases/v2.1.13-beta.0.md) | Current prerelease notes (install via `npm i -g codex-multi-auth@beta`) |
| [releases/v2.1.13-beta.1.md](releases/v2.1.13-beta.1.md) | Current prerelease notes (install via `npm i -g codex-multi-auth@beta`) |
| [releases/v2.1.12.md](releases/v2.1.12.md) | Current stable release notes |
| [releases/v2.1.11.md](releases/v2.1.11.md) | Prior stable release notes |
| [releases/v2.1.10.md](releases/v2.1.10.md) | Earlier stable release notes |
Expand Down
71 changes: 71 additions & 0 deletions docs/releases/v2.1.13-beta.1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# v2.1.13-beta.1

Beta prerelease that adds multi-workspace support for a single email: one
OpenAI/Google account that belongs to more than one ChatGPT workspace (for
example a personal Plus workspace and a business/team workspace), each a distinct
quota pool keyed by its `org_id`. Ships the issue #491 work so users with such
accounts can register, distinguish, switch, and rotate between workspaces.

This is a **prerelease** and also carries the pinned-account 503 diagnostic from
v2.1.13-beta.0. Stable `v2.1.13` will land once the issue #486 root cause is
identified and patched.

## Install

```bash
npm i -g codex-multi-auth@beta
```

## Accounts

### Fixes

- Account `workspaces` and `currentWorkspaceIndex` now survive a load
round-trip. The strict V3 storage schema (`AccountMetadataV3Schema`) did not
declare these fields, so Zod stripped them on every read; login captured the
workspaces and wrote them to disk, but the next load wiped them. This is the
root cause of workspace labels appearing empty after login and of two
same-email accounts being indistinguishable.
- `formatAccountLabel` surfaces the active workspace name, so same-email accounts
in different workspaces stay distinguishable, for example
`Account 1 ([Personal Plus], user@gmail.com, id:g-AAAA)`. All prior label
formats are preserved when no workspace is tracked.

### Features

- `status` / `list` now list every workspace beneath an account that tracks more
than one, marking the active workspace and flagging disabled ones.
- New `workspace <account> [workspace]` command: with only an account index it
lists that account's workspaces; with a workspace index it sets the active
workspace and persists it.
- `login --org <org_id>` (and `--org=<id>`) binds a login to a specific
workspace/org. It reuses the `CODEX_AUTH_ACCOUNT_ID` override that every login
resolver already honors, scoped to the invocation and restored afterward, so a
second workspace can be registered on demand instead of always resolving to the
default org.
Comment on lines +41 to +45
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 login --org env-var mutation is a concurrency risk

the notes say the impl sets process.env.CODEX_AUTH_ACCOUNT_ID, does the login, then restores it. node is single-threaded but async — if two login --org calls overlap on the event loop (e.g. a cli invocation racing an in-process retry), the second call can read the first call's value or clobber the restore, assigning the wrong workspace to the wrong account. a scoped parameter passed through the call chain would eliminate the risk entirely. also worth checking: the exception path — if the login resolver throws before the restore runs, the env var stays mutated for the rest of the process lifetime, which on windows could also affect any child-process token writes that inherit the env.

Prompt To Fix With AI
This is a comment left during a code review.
Path: docs/releases/v2.1.13-beta.1.md
Line: 41-45

Comment:
**`login --org` env-var mutation is a concurrency risk**

the notes say the impl sets `process.env.CODEX_AUTH_ACCOUNT_ID`, does the login, then restores it. node is single-threaded but async — if two `login --org` calls overlap on the event loop (e.g. a cli invocation racing an in-process retry), the second call can read the first call's value or clobber the restore, assigning the wrong workspace to the wrong account. a scoped parameter passed through the call chain would eliminate the risk entirely. also worth checking: the exception path — if the login resolver throws before the restore runs, the env var stays mutated for the rest of the process lifetime, which on windows could also affect any child-process token writes that inherit the env.

How can I resolve this? If you propose a fix, please make it concise.

Fix in Codex


## Release Hygiene

### Tests

- Schema round-trip preservation and a workspace-load regression that locks the
fix in place.
- Label disambiguation coverage and `formatWorkspaceLines` output coverage
(active marker, disabled annotation, indentation).
- Nine `workspace`-command cases (list, switch, persistence, already-active
no-op, disabled rejection, out-of-range and non-numeric indices).
- `login --org` argument parsing and missing-value handling.
Comment on lines +50 to +57
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 missing vitest coverage for env-var restore under failure

the test list covers argument parsing and missing-value handling for login --org, but doesn't mention a case where the login resolver throws mid-flight and we verify CODEX_AUTH_ACCOUNT_ID is still restored to its prior value (or undefined). given the mutation pattern described above, a regression here would silently corrupt subsequent logins in the same process without any test catching it.

Prompt To Fix With AI
This is a comment left during a code review.
Path: docs/releases/v2.1.13-beta.1.md
Line: 50-57

Comment:
**missing vitest coverage for env-var restore under failure**

the test list covers argument parsing and missing-value handling for `login --org`, but doesn't mention a case where the login resolver throws mid-flight and we verify `CODEX_AUTH_ACCOUNT_ID` is still restored to its prior value (or `undefined`). given the mutation pattern described above, a regression here would silently corrupt subsequent logins in the same process without any test catching it.

How can I resolve this? If you propose a fix, please make it concise.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Fix in Codex


## Known Gaps

- The issue #486 503 root cause (doctor reports all green, runtime still returns
503) is **not** fixed by this prerelease.
- Whether a real two-workspace login returns both orgs in one token or one at a
time is unconfirmed. Both paths are supported (the `workspace` command for the
former, `login --org` for the latter); a sanitized `accounts.json` from a real
two-workspace account would confirm which path users hit.

## Refs

- Issue #491 — `[feature] Support registering multiple workspaces for the same email`
- PR #493 — `feat: support multiple workspaces for the same email (#491)`
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "codex-multi-auth",
"version": "2.1.13-beta.0",
"version": "2.1.13-beta.1",
"description": "Codex CLI multi-account OAuth manager with account switching, health checks, runtime rotation, diagnostics, and recovery tools for @openai/codex",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
Expand Down