繁體中文

新功能

Codex 狀態列看得到分支與已用 token

你在終端機裡連續做了幾輪工作,想知道自己在哪個 Git 分支、這個工作階段(session,一次開啟到結束的工作過程)已用了多少 token(AI 處理文字的計量單位)?Codex 的狀態列(終端機最底下那行摘要)現在多了 git-branch 和 used-tokens,設定檔裡的區段也由五個增為七個。它像車上的儀表板:分支和已用 token 會同列顯示,但表板零件只能選 Codex 內建項目;不能接像 Claude Code 那樣的指令掛鉤,所以文字、顏色與 · 分隔符號都由 Codex 決定,也不能加進度條或重設倒數。5h 則要等 Codex 真的拿到含五小時視窗的限流快照才會出現。

新功能

更新或移除狀態列,不會誤蓋你的原始設定

你以前用 usage 裝過 Codex 狀態列,後來想換新版或移除它,原本自己設的狀態列不該被舊版 usage 的清單冒充。現在 usage 認得自己歷來發過的區段組合,遇到舊組合會原地升級,不會把它另存成你的原始設定,也不會碰既有備份。移除時同樣接受所有舊組合;回復設定仍是先寫回找回的內容,再刪備份。啟動時還會檢查舊組合並自動更新,但只比對 usage 發過的組合,使用者自訂狀態列與已是新版的設定都不動。像寄物櫃管理員看得懂哪張標籤是店家舊款,換新標籤時不會把舊標籤誤收成你的私人物品。

問題修復

測試不會再改到開發者真正的 Codex 設定

開發者跑完整套測試時,原本不該拿自己的 ~/.codex/config.toml 當測試材料。先前啟動時的自我修復會讀這個真實設定檔,但測試沒有把路徑換掉;因此測試可能改寫開發者的 Codex 設定,連驗證自我修復日誌的結果也會隨那台電腦的狀態改變。現在自動套用的 fixture(每個測試先準備好的共用環境)會把 Codex 設定檔與兩個備份路徑全指向暫存資料夾,和原本已隔離的日誌資料夾一致。這像舞台彩排不再借用真實控制室的開關:演員怎麼測,都只影響臨時布景。

English

FEATURE

Codex status line now shows branch and token use

After several rounds in your terminal, you may want to know both your Git branch and how many tokens this session has used. Codex's status line now adds git-branch and used-tokens, taking the segment list in its config from five to seven. Think of it as a car dashboard: those readings can sit together, but only Codex's built-in gauges fit. Unlike Claude Code, it has no command hook, so Codex controls wording, colors, and the · separator; it cannot show a progress bar or reset countdown. The 5h reading stays hidden until Codex has a rate-limit snapshot that contains a five-hour window.

FEATURE

Status-line upgrades and removal preserve your original setup

If you installed a Codex status line with usage before, then upgrade or remove it, an older usage list should not masquerade as the status line you originally configured. Usage now recognizes every segment set it has shipped. It upgrades an older set in place instead of backing it up as yours, and leaves an existing backup alone. Removal accepts those older sets too; restoring still writes recovered settings before deleting the backup. At startup, usage also upgrades old sets automatically, but matches only sets it shipped, leaving both your custom line and a current set untouched. It is like a locker attendant who recognizes an old store label and replaces it without mistaking it for your personal property.

BUGFIX

Tests no longer touch a developer's real Codex settings

When a developer runs the full test suite, their own ~/.codex/config.toml should never become test material. Startup self-healing read that real file, but tests did not override its path. A test run could therefore rewrite a developer's Codex configuration, while an unrelated assertion about the self-heal log also depended on that machine's state. An autouse fixture (shared setup applied before every test) now points the Codex config and both backup paths to a temporary directory, matching the already-isolated log directory. It is like a stage rehearsal no longer borrowing switches from the real control room: every experiment affects only temporary scenery.

原始 CHANGELOG

Original changelogCodex 狀態列看得到分支與已用 token
**Codex's status line now shows the Git branch and the session's token count.** The segment set usage writes into `~/.codex/config.toml` grew from five entries to seven, adding `git-branch` and `used-tokens`, so a session reads `usage · main · 5h 39% left · weekly 50% left · Context 95% left · 12.3K used · gpt-5.6-sol high`. Codex's status line accepts only its own built-in segments — there is no command hook like Claude Code's, which is why the wording, the colors and the ` · ` separator are Codex's own and why a progress bar or a reset countdown cannot be rendered on that side. The `5h` segment is omitted until Codex holds a rate-limit snapshot that actually contains a five-hour window.
Original changelog更新或移除狀態列,不會誤蓋你的原始設定
**Upgrading the segments no longer files usage's own older set as your original status line.** `_setup_codex()` backed up whatever it found before overwriting, which was correct for a status line you configured yourself but wrong for one an earlier version of usage installed: changing the segment set would have written the previous usage-installed list into `~/.codex/usage-backup.json`, and a later removal would have "restored" that instead of your real configuration — silently overwriting the only copy of it. Segment sets that usage has shipped are now recognized as its own and upgraded in place, leaving any existing backup untouched.
**Removing the Codex status line works on installs still holding an older segment set.** The removal path required an exact match against the current segments, so anyone who had not re-run setup was told the status line was not usage's and nothing happened. Every set usage has shipped is now accepted; the restore sequence itself is unchanged, including writing the recovered configuration before deleting the backup.
**The new segments apply without pressing anything.** Startup self-healing upgrades a status line that still holds a set from an earlier version of usage. It only ever matches those sets — a status line you configured yourself, and one already on the current set, are both left alone.
Original changelog測試不會再改到開發者真正的 Codex 設定
**Tests can no longer reach the real `~/.codex/config.toml`.** The self-healing path above reads that file, and no test overrode the path constant, so a full test run on a developer's machine rewrote their own Codex configuration and made an unrelated assertion about the self-heal log depend on the state of that machine. An autouse fixture now points the Codex configuration and both backup paths at a temporary directory, matching how the log directory is already isolated.