Files
Jason 1f786dadd0 docs(release): expand the Codex session compression section in v4.0.7 notes
Explain how the switch maps to config.toml, when Codex actually compresses
sessions, how resuming and CC Switch's session list and usage handle
compressed rollouts, and what to watch out for (Codex version, startup
notice, turning it off, other tools that read .jsonl). Move it to the top
of the new features.
2026-10-10 18:44:33 +08:00

13 KiB

CC Switch v4.0.7

The third fix release for 4.0 stable

Plus and Team workspaces under the same OpenAI account could not be switched between in 4.0; this release fixes that. Quotas can show "Used" again as in 3.x; switch it under "Settings → General → Appearance". Old Codex sessions can now be compressed from CC Switch, and session management and usage statistics can also read the compressed sessions. Switching between Direct and Routing now also prompts you to restart Codex, and this prompt shows up on Windows for the first time. This release also fixes several miscalculations in usage statistics, including the price of Claude's 1-hour cache writes and cache hits for some relay services. For everything new in 4.0, see the v4.0 release notes.


New

Old Codex sessions can be compressed. Codex records every session in full under ~/.codex/sessions, and with heavy use this directory can grow to tens of GB. Codex has its own compression feature that is still under development and off by default; this release adds a switch for it in CC Switch, and CC Switch can now read the compressed sessions.

  • How to turn it on: Turn on "Compress old Codex sessions" under "Settings → App config → Codex"; next to it, CC Switch shows how much space the sessions and archived_sessions directories currently take up in total. The switch edits Codex's config.toml directly: turning it on writes, under [features], the line local_thread_store_compression = true, and turning it off deletes that line; CC Switch does not store this setting separately.
  • When compression happens: Nothing is compressed right away. Each time Codex starts, it compresses session files untouched for more than 7 days in the background into .jsonl.zst files with the same name, then deletes the originals. In testing, compressed files take about one sixth of the original space.
  • Continuing old sessions: Just continue them in Codex as usual; Codex first decompresses the session back to its original format.
  • In CC Switch: Compressed sessions still appear in the session list, can be viewed and deleted, and their usage is counted as usual, without being counted twice before and after compression. To keep the list quick to open even with many sessions, CC Switch reads only the beginning of each compressed file, so these sessions do not show a preview of their last reply, and their last active time is taken from the file's modification time.
  • Things to note: This needs a recent version of Codex and takes effect after Codex restarts. It is a Codex feature still under development, so once it is on, Codex shows a notice every time it starts. Turning the switch off stops new sessions from being compressed; sessions already compressed stay as they are and are only decompressed when you continue them in Codex. Other tools that read .jsonl session files directly may not be able to read compressed sessions.

Even without this switch, Codex's background service may compress sessions on its own. CC Switch used to recognize only uncompressed session files, so these sessions disappeared from the session list and their usage was not imported; they are now read normally.

Quotas can show "Used". 4.0 changed every quota tier to "x% left". Some people are used to the "x% used" of 3.x, and some want it to match how Codex itself words it, so it is now a setting. Under "Settings → General → Appearance → Quota display", choose "Left" (the default) or "Used"; provider cards, "Accounts" and the tray all follow it. Only the per-tier percentages change; balances, Codex Credits and reset counts always show what is left, and a tier that has run out still shows "Used up". Colors and the "almost out" warning are still based on what is left, so 94% used is orange just like 6% left. The length of the progress bar in the expanded view follows the number shown: 30% used draws 30%.

Switching between Direct and Routing also prompts you to restart Codex. A Codex that is already open keeps using the model list it read at startup. The check used to run only in Aggregation mode, so switching between Direct and Routing gave no prompt even when the model list changed. All three modes are now checked. If you dismiss the prompt and the model list changes again, the prompt comes back.

The prompt to restart Codex now shows up on Windows too. CC Switch used to tell whether Codex was running by reading the system process list, which does not work on Windows, so neither the model list prompt nor the account prompt appeared, and the restart button always said the background service was not running. On Windows, CC Switch now checks whether Codex's background service is running by the process ID the service records itself, and offers the restart button only when it is confirmed to be running. CC Switch cannot see the Codex desktop app or editor extensions on Windows, so whenever the model list or the signed-in account differs from when you last dismissed the prompt, it shows "Codex apps that were open before the switch may still use the previous account or model list"; if those clients are not open, just dismiss the prompt. This prompt does not appear right after upgrading.

Opening "Config directory" from the menu on an app page now scrolls the settings page to that app's entry, and its border flashes twice. Scrolling or clicking yourself during the scroll stops it right away; when reduced motion is turned on in the system, it jumps there directly.

Fixes

  • Plus and Team workspaces under the same OpenAI account could not be switched between in Codex. 4.0 identified Codex's official sign-in by user only, so a different workspace of the same person was treated as "already signed in to this account": auth.json was not rewritten and no restart prompt appeared. Stashed sign-in information was also kept per user, so the several workspaces of one person ended up as a single copy. Sign-ins are now identified by "user + workspace", the same way Codex itself decides whether the account has changed. After upgrading, the stashed sign-in information is sorted out automatically, and workspaces that had been merged away come back on the official cards; accounts that have already signed out are not restored.
  • When a Codex provider's address was written at the top level of config.toml, editing and saving deleted the address. For such configs, the API address showed as empty in the editor; after saving, the address was deleted and Routing reported "Codex Provider 缺少 base_url 配置" (base_url missing); in Direct mode, switching to it also sent requests to OpenAI's official address. The top-level address is now moved into [model_providers.custom], so the editor shows it and saving keeps it. The form no longer generates this layout either.
  • On Windows, when the user name contained Chinese or other non-ASCII characters, upgrading tools on the "Apps" page failed with "The system cannot find the path specified." "Open Terminal" on Claude Code provider cards also could not read the temporary configuration, so Claude Code started with the default configuration without reporting an error; the same happened when the project directory contained Chinese characters. The cause was that the batch files CC Switch generates were written in UTF-8, while cmd.exe read them using the console code page. The upgrade script now switches to UTF-8 first, which only affects its own hidden window; "Open Terminal" does not switch the code page (that would change the settings of your own terminal) and instead no longer writes these paths directly into the batch file.
  • When Codex continued an old third-party session under the official provider, the error told you to restart. When continuing a session, Codex keeps the provider the session was created with, so a third-party session always points to local routing, and restarting Codex does not help. The error now explains that this is an old third-party session and that you need to start a new one; it only tells you to restart when Codex really has not reread its configuration.
  • Claude's 1-hour cache writes were billed at the 5-minute price. A 1-hour cache write costs 2x the input price and a 5-minute one 1.25x; everything used to be billed at the 5-minute price, which undercounted quite a bit. Proxy logs and Claude Code session imports now price them separately.
  • Cache hits showed as 0 for some OpenAI-compatible relay services. Some relays always write cache_read_input_tokens as 0 and put the real hit count in prompt_cache_hit_tokens; CC Switch used to stop looking once it read 0, so cache hits showed as 0 and uncached input was overcounted. It now moves on to the next field when it sees 0. This rule applies when Claude Code is routed to OpenAI Chat format, and when Codex and Grok Build use upstreams in Chat format.
  • Usage from Codex session imports had no cache writes. Cache writes for GPT-5.6 and GPT-6 were priced as regular input; they are now recorded separately.
  • Costs for Claude Sonnet 5.5 and Haiku 5.5 were recorded as 0. The built-in pricing table now includes these two models.
  • On the "Claude" tab of "Usage", a provider configured in both Claude Code and Claude Desktop showed up as two identical rows, and switching apps left the old rows behind.
  • In the extra options of OpenCode and MiniMax Code, editing one option changed the types of other values you had not touched. For example, the strings "123" and "false" were saved as a number or a boolean. Untouched values now stay as they were, and an option can no longer be renamed to an existing name.
  • Turning "Send User-Agent" on or off in OpenClaw deleted all other custom request headers. Only User-Agent is changed now.
  • The "火山 Agent Plan" (Volcengine Agent Plan) preset for Pi and MiniMax Code used the Coding Plan address, so Agent Plan keys did not work. It now uses Agent Plan's own address, and a new "火山 Coding Plan" preset is added.

Other:

  • The Chinese guide to Aggregation mode and the user manual in all three languages cover two more common Codex questions: subagents cannot read their tasks after switching to a different provider, and after the official 5-hour quota runs out, /model is locked to Luna Reserve, which you can work around by temporarily setting a third-party provider as the default.
  • The description of "Unified Codex session history" now applies only to Codex CLI: after its update, the Codex desktop app already shows sessions from all providers, so if you only use the desktop app you don't need to turn it on.

Upgrade Notes

The database schema is unchanged, still at 20.

Claude cache write costs go up after upgrading. With 1-hour caching (which Claude Code's main session usually uses), cache writes in new records are priced correctly, so daily costs will be noticeably higher than before the upgrade. They were undercounted before; this is not a price increase, and records from before the upgrade are not recalculated.

Costs for Claude Sonnet 5.5 and Haiku 5.5 that were recorded as 0 are recalculated at startup with the new prices. Haiku 5.5 is priced only at the rate for prompts up to 100K tokens, so longer prompts are undercounted.

Existing "火山 Agent Plan" providers (Pi, MiniMax Code) are not changed automatically; change /api/coding/v3 in the API address to /api/plan/v3, or delete them and add them again from the new preset.


Thanks

Thanks to @ggbdpq (cache hits showing as 0 for relay services, OpenCode extra option types being changed, the restart prompt after switching between Direct and Routing), @Chaoqi31 (reporting and fixing pricing for Claude's 1-hour cache writes and for cache writes in Codex session imports), @Yanxcyan (Claude Sonnet 5.5 / Haiku 5.5 pricing, the 火山 Agent Plan preset), @hulkbig (reporting and fixing OpenClaw custom request headers being deleted), @Railgun-wiki (reporting and fixing duplicate rows in usage statistics) and @funkpopo (scrolling the settings page to the app config entry) for their contributions.

Thanks to @yleo888, @harvey500, @friendlzw, @burningimlam, @JinLin-Yu, @winter-maple, @SamPheng, @cjmarklll, @LeenixP and @EMnian for reporting issues and making suggestions.

For the full technical details, see the CHANGELOG.