← ClaudeAtlas

codex-infinity-threadlisted

Keep long Codex conversations alive: repair an oversized session that crashes the Codex desktop app with "RangeError: Invalid string length" or won't open a conversation. Use whenever Codex won't reload a session, the desktop app crashes or white-screens on launch or when opening a chat, or a session rollout file under ~/.codex/sessions has grown huge (commonly from embedded base64 screenshots or large tool outputs). Slims the on-disk rollout in place - dropping superseded compaction checkpoints, replacing images with text, truncating oversized outputs, archiving the original first - so the session reloads and can be continued. Trigger on phrases like "Codex crashes on startup", "Invalid string length", "Codex won't open my conversation", "Codex session too big", "oversized rollout", or "recover my Codex session". Not for routine context-window pressure (use Codex's /compact) and not for Claude Code sessions, which store attachments by reference and do not hit this crash.
haberlah/codex-infinity-thread · ★ 0 · AI & Automation · score 73
Install: claude install-skill haberlah/codex-infinity-thread
# Codex Infinity Thread Keep a long-lived Codex conversation usable across hundreds of tasks, and bring it back when the session grows too large for the desktop app to open, by slimming its on-disk rollout while preserving the thread. ## The failure this fixes Codex stores each session as a JSONL "rollout" at `~/.codex/sessions/YYYY/MM/DD/rollout-<timestamp>-<uuid>.jsonl`. When the desktop app opens a session it aggregates the entire rollout into a single in-memory string. Node/V8 caps a string at **536,870,888 bytes (~512 MB)**; past that the main process throws **`RangeError: Invalid string length`** and the app crashes on launch (it auto-restores the last session, so it re-crashes every time). The bloat is almost always **base64 screenshots**: the `computer-use` / browser tool records one per action, and each is stored twice (as a `data:image` URI in the model-facing `function_call_output`, and as an MCP `{type:image,data,...}` block in the display-only event). Text is tiny by comparison. This is a real, unresolved issue (see references/troubleshooting.md for the upstream bug reports). There is no official repair command - hence this skill. ## Quick start ```bash # 1. Find the offender (or pass a path directly) python {baseDir}/scripts/repair_rollout.py --auto --dry-run # 2. Repair it (archives the original, swaps in the slimmed file) python {baseDir}/scripts/repair_rollout.py /path/to/rollout-....jsonl # 3. Confirm it's safe to load python {baseDir}/scripts/verif