mirror of
https://github.com/farion1231/cc-switch.git
synced 2026-10-26 01:34:51 +08:00
Codex can compress rollouts untouched for 7 days into a sibling rollout-*.jsonl.zst and delete the original, either through [features] local_thread_store_compression or through the app-server rollout/compress RPC, which ignores that flag. It decompresses a rollout back to .jsonl when the session is resumed. CC Switch only read .jsonl, so compressed sessions vanished from the session list, their usage was never imported, and history bucket migrations skipped them while still recording themselves as done. - Add codex_rollout_file, shared by the readers below: recognise both forms, read .jsonl.zst transparently, write a rollout back in its own form, and keep only the plain file when both forms briefly coexist. - Session list: decompress only the head of a compressed rollout. Use its mtime, which Codex preserves, as the last active time and show no last-reply preview, so scanning tens of GB stays fast. Content refs are resolved against the decompressed stream. A stale source path falls back to the other form, and deleting a session removes both forms. - Usage import: a cursor is inherited from any path with the same logical file name, taking the furthest line offset, in any directory and in both directions. Request-id dedup only covers the 30 days of detail rows kept before rollup, and compressed rollouts are older, so this is what prevents double counting across compress and resume. Compressed files persist their on-disk size so unchanged ones are skipped without decompressing. - History bucket migrations rewrite compressed rollouts in place, keep them compressed, and keep their mtime so old sessions do not jump to the top of the list. - Settings > Codex gets a "Compress old Codex sessions" switch backed directly by config.toml (write true to enable, remove the key to disable) through the live write engine, showing the current size of the sessions directories. It re-reads when the saved Codex directory changes.