Skip to content

Commit 8f472a8

Browse files
authored
Merge pull request #15 from HOOLC/feat/watch-eta-and-desktop-switching
[codex] add watch eta and harden managed desktop switching
2 parents fedb7a4 + d2b89f7 commit 8f472a8

18 files changed

+2947
-172
lines changed

README.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,17 @@ Global flags: `--help`, `--version`, `--debug`
5858

5959
Use `--json` for machine-readable output and `--debug` for stderr diagnostics.
6060

61-
- `codexm current` shows the active account. It uses the running managed Desktop session when available, falls back to local `auth.json`, and warns if those differ. Add `--refresh` to include current quota usage.
62-
- `codexm list` refreshes quota data before printing, shows the current managed account above the table, marks current rows with `*`, and includes top-level `current` plus per-row `is_current` fields in JSON mode. The default table shows normalized `CURRENT SCORE`; add `--verbose` for normalized `1H SCORE`, raw 5H/1W breakdown, and plan ratio details.
61+
### Account management
62+
6363
- `codexm add <name>` creates a new managed account without changing the active `~/.codex/auth.json`. By default it uses the built-in browser ChatGPT login flow; add `--device-auth` for device-code login on remote/headless machines. `--with-api-key` reads an API key from stdin, for example `printenv OPENAI_API_KEY | codexm add work-api --with-api-key`.
64+
- `codexm current` shows the active account. Add `--refresh` to include current quota usage.
65+
- `codexm list` refreshes saved accounts before printing, shows which row is current with `*`, and summarizes availability, score, ETA, usage, and reset times. Add `--verbose` for more quota detail. In the default table, unavailable accounts use a red row background, low remaining quota values use bold yellow/red text, and reset times within one hour get a cyan `(Xm)` suffix.
66+
67+
### Desktop mode
68+
6469
- `codexm launch` starts Codex Desktop with current auth, switches first when you pass a saved account name, or picks the best saved account with `codexm launch --auto`. Add `--watch` to keep a detached watcher running after launch. Run `codexm launch` from an external terminal if you need to restart Desktop.
65-
- `codexm switch`, `codexm switch --auto`, and auth-changing `codexm launch` flows share a cross-process lock under `~/.codex-team/locks/switch.lock` so only one auth-changing operation runs at a time. If the lock is busy, the CLI reports the lock path and the owning command; `watch` skips that cycle instead of queueing behind an in-flight switch.
70+
- `codexm switch`, `codexm switch --auto`, and auth-changing `codexm launch` only let one auth-changing operation run at a time. If another switch is already in progress, the CLI tells you and asks you to retry later.
71+
- `codexm switch --force` and `codexm switch --auto --force` try to apply the auth change to the running managed Desktop immediately. If that fails, codexm closes the managed Desktop so it does not keep running on the old account.
6672
- `codexm watch` watches the managed Codex Desktop session, prints quota updates, and by default auto-switches when the active account is exhausted. Use `--no-auto-switch` for read-only watching. `--detach` runs it in the background; use `--status` and `--stop` to inspect or stop it.
6773

6874
Unknown commands and flags fail fast; when there is a close match, `codexm` suggests it.

docs/internal/codex-runtime-channels.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ README 只保留用户可见行为;这里记录设计意图和实现边界。
122122

123123
- 需要知道 Desktop 当前 loaded threads 里是否还有 active thread
124124
- 需要在受管 Desktop 上发送 `codex-app-server-restart`
125+
- 如果受管 Desktop 当前 runtime 已经是目标账号,则跳过这次 refresh,不做无意义 restart
125126

126127
这两个动作都是 Desktop 运行态动作,不是一次性读取动作。
127128

docs/superpowers/specs/2026-04-07-codexm-launch-design.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ codexm launch [account] [--json]
105105
统一使用 macOS 的 `open` 启动 Codex Desktop,并附带固定的远程调试端口参数:
106106

107107
```bash
108-
open -na /Applications/Codex.app --args --remote-debugging-port=9223
108+
open -na /Applications/Codex.app --args --remote-debugging-port=39223
109109
```
110110

111111
设计原因:
@@ -116,7 +116,7 @@ open -na /Applications/Codex.app --args --remote-debugging-port=9223
116116

117117
### 5.2 端口策略
118118

119-
本次固定使用单一端口常量,例如 `9223`
119+
本次固定使用单一端口常量,例如 `39223`
120120

121121
暂不做用户配置,原因是:
122122

0 commit comments

Comments
 (0)