Skip to content

Auto-compaction silently discards all conversation history since 0.145.0 #36642

Closed

Description

@goodbadwolf

What version of Codex CLI is running?

codex-cli 0.146.0

What subscription do you have?

Pro

Which model were you using?

gpt-5.6-sol

What platform is your computer?

Linux 7.0.0-28-generic x86_64 x86_64

What terminal emulator and version are you using (if applicable)?

Ghostty, inside tmux

Codex doctor report

{
  "schemaVersion": 1,
  "generatedAt": "1785718273s since unix epoch",
  "overallStatus": "warning",
  "codexVersion": "0.146.0",
  "checks": {
    "app_server.status": {
      "id": "app_server.status",
      "category": "app-server",
      "status": "ok",
      "summary": "background server is not running",
      "details": {
        "control socket": "/home/manish/.codex/app-server-control/app-server-control.sock",
        "daemon state dir": "/home/manish/.codex/app-server-daemon",
        "mode": "ephemeral",
        "pid file": "/home/manish/.codex/app-server-daemon/app-server.pid (missing)",
        "settings": "/home/manish/.codex/app-server-daemon/settings.json (missing)",
        "status": "not running",
        "update-loop pid file": "/home/manish/.codex/app-server-daemon/app-server-updater.pid (missing)"
      },
      "remediation": null,
      "durationMs": 0
    },
    "auth.credentials": {
      "id": "auth.credentials",
      "category": "auth",
      "status": "ok",
      "summary": "auth is configured",
      "details": {
        "auth file": "/home/manish/.codex/auth.json",
        "auth storage mode": "File",
        "stored API key": "false",
        "stored ChatGPT tokens": "true",
        "stored agent identity": "false",
        "stored auth mode": "chatgpt"
      },
      "remediation": null,
      "durationMs": 0
    },
    "config.load": {
      "id": "config.load",
      "category": "config",
      "status": "ok",
      "summary": "config loaded",
      "details": {
        "CODEX_HOME": "/home/manish/.codex",
        "config.toml": "/home/manish/.codex/config.toml",
        "config.toml parse": "ok",
        "cwd": "/projects/nebulae",
        "enabled feature flags": "<redacted>",
        "feature flag overrides": "<redacted>",
        "feature flags enabled": "45",
        "log dir": "/home/manish/.codex/log",
        "mcp servers": "9",
        "model": "gpt-5.6-sol",
        "model provider": "openai",
        "sqlite home": "/home/manish/.codex"
      },
      "remediation": null,
      "durationMs": 0
    },
    "git.environment": {
      "id": "git.environment",
      "category": "git",
      "status": "ok",
      "summary": "git version 2.43.0",
      "details": {
        ".git entry": "directory",
        "PATH git #1": "/usr/bin/git",
        "PATH git #2": "/bin/git",
        "PATH git entries": "2",
        "git branch": "fix/global-tier-corrections",
        "git build options": "git version 2.43.0; cpu: x86_64; no commit associated with this build; sizeof-long: 8; sizeof-size_t: 8; shell-path: /bin/sh",
        "git exec path": "/usr/lib/git-core",
        "git version": "git version 2.43.0",
        "repo detected": "true",
        "repo root": "/projects/nebulae",
        "selected git": "/usr/bin/git"
      },
      "remediation": null,
      "durationMs": 22
    },
    "installation": {
      "id": "installation",
      "category": "install",
      "status": "ok",
      "summary": "installation looks consistent",
      "details": {
        "PATH codex #1": "/run/user/1000/fnm_multishells/2277064_1785710288621/bin/codex",
        "PATH codex #2": "/run/user/1000/fnm_multishells/3753_1785459905889/bin/codex",
        "PATH codex entries": "2",
        "current executable": "/home/manish/.local/share/fnm/node-versions/v24.14.0/installation/lib/node_modules/@openai/codex/node_modules/@openai/codex-linux-x64/vendor/x86_64-unknown-linux-musl/bin/codex",
        "install context": "npm (package /home/manish/.local/share/fnm/node-versions/v24.14.0/installation/lib/node_modules/@openai/codex/node_modules/@openai/codex-linux-x64/vendor/x86_64-unknown-linux-musl, bin /home/manish/.local/share/fnm/node-versions/v24.14.0/installation/lib/node_modules/@openai/codex/node_modules/@openai/codex-linux-x64/vendor/x86_64-unknown-linux-musl/bin, resources /home/manish/.local/share/fnm/node-versions/v24.14.0/installation/lib/node_modules/@openai/codex/node_modules/@openai/codex-linux-x64/vendor/x86_64-unknown-linux-musl/codex-resources, path /home/manish/.local/share/fnm/node-versions/v24.14.0/installation/lib/node_modules/@openai/codex/node_modules/@openai/codex-linux-x64/vendor/x86_64-unknown-linux-musl/codex-path)",
        "managed by bun": "false",
        "managed by npm": "true",
        "managed by pnpm": "false",
        "managed package root": "/home/manish/.local/share/fnm/node-versions/v24.14.0/installation/lib/node_modules/@openai/codex",
        "npm update target": "/home/manish/.local/share/fnm/node-versions/v24.14.0/installation/lib/node_modules/@openai/codex"
      },
      "remediation": null,
      "durationMs": 39
    },
    "mcp.config": {
      "id": "mcp.config",
      "category": "mcp",
      "status": "warning",
      "summary": "MCP configuration has optional issues",
      "details": {
        "configured servers": "9",
        "disabled servers": "1",
        "playwright": [
          "env var DISPLAY is not set",
          "env var WAYLAND_DISPLAY is not set",
          "env var XAUTHORITY is not set"
        ],
        "stdio servers": "8",
        "streamable_http servers": "1"
      },
      "remediation": "Set the missing MCP env vars or disable the affected server.",
      "durationMs": 3241
    },
    "network.env": {
      "id": "network.env",
      "category": "network",
      "status": "ok",
      "summary": "network-related environment looks readable",
      "details": {
        "proxy env vars": "none"
      },
      "remediation": null,
      "durationMs": 0
    },
    "network.provider_reachability": {
      "id": "network.provider_reachability",
      "category": "reachability",
      "status": "ok",
      "summary": "active provider endpoints are reachable over HTTP",
      "details": {
        "ChatGPT base URL": "https://chatgpt.com/backend-api/ reachable (HTTP 403)",
        "reachability mode": "ChatGPT auth"
      },
      "remediation": null,
      "durationMs": 39
    },
    "network.websocket_reachability": {
      "id": "network.websocket_reachability",
      "category": "websocket",
      "status": "ok",
      "summary": "Responses WebSocket handshake succeeded",
      "details": {
        "DNS": "2 IPv4, 2 IPv6, first IPv6",
        "auth mode": "chatgpt",
        "connect timeout": "15000 ms",
        "endpoint": "wss://chatgpt.com/backend-api/<redacted>",
        "handshake result": "HTTP 101 Switching Protocols",
        "model provider": "openai",
        "models etag present": "true",
        "provider name": "OpenAI",
        "proxy env vars": "none",
        "reasoning header": "false",
        "server model present": "false",
        "supports websockets": "true",
        "wire API": "responses"
      },
      "remediation": null,
      "durationMs": 693
    },
    "runtime.provenance": {
      "id": "runtime.provenance",
      "category": "runtime",
      "status": "ok",
      "summary": "running npm on linux-x86_64",
      "details": {
        "commit": "unknown",
        "current executable": "/home/manish/.local/share/fnm/node-versions/v24.14.0/installation/lib/node_modules/@openai/codex/node_modules/@openai/codex-linux-x64/vendor/x86_64-unknown-linux-musl/bin/codex",
        "install method": "npm (package /home/manish/.local/share/fnm/node-versions/v24.14.0/installation/lib/node_modules/@openai/codex/node_modules/@openai/codex-linux-x64/vendor/x86_64-unknown-linux-musl, bin /home/manish/.local/share/fnm/node-versions/v24.14.0/installation/lib/node_modules/@openai/codex/node_modules/@openai/codex-linux-x64/vendor/x86_64-unknown-linux-musl/bin, resources /home/manish/.local/share/fnm/node-versions/v24.14.0/installation/lib/node_modules/@openai/codex/node_modules/@openai/codex-linux-x64/vendor/x86_64-unknown-linux-musl/codex-resources, path /home/manish/.local/share/fnm/node-versions/v24.14.0/installation/lib/node_modules/@openai/codex/node_modules/@openai/codex-linux-x64/vendor/x86_64-unknown-linux-musl/codex-path)",
        "platform": "linux-x86_64",
        "version": "0.146.0"
      },
      "remediation": null,
      "durationMs": 0
    },
    "runtime.search": {
      "id": "runtime.search",
      "category": "search",
      "status": "ok",
      "summary": "search is OK (bundled)",
      "details": {
        "search command": "/home/manish/.local/share/fnm/node-versions/v24.14.0/installation/lib/node_modules/@openai/codex/node_modules/@openai/codex-linux-x64/vendor/x86_64-unknown-linux-musl/codex-path/rg",
        "search command readiness": "file exists",
        "search provider": "bundled"
      },
      "remediation": null,
      "durationMs": 0
    },
    "sandbox.helpers": {
      "id": "sandbox.helpers",
      "category": "sandbox",
      "status": "ok",
      "summary": "sandbox configuration is readable",
      "details": {
        "approval policy": "Never",
        "codex-linux-sandbox helper": "/home/manish/.codex/tmp/arg0/codex-arg04iiWXv/codex-linux-sandbox",
        "execve wrapper helper": "/home/manish/.codex/tmp/arg0/codex-arg04iiWXv/codex-execve-wrapper",
        "filesystem sandbox": "unrestricted",
        "network sandbox": "enabled"
      },
      "remediation": null,
      "durationMs": 0
    },
    "state.paths": {
      "id": "state.paths",
      "category": "state",
      "status": "ok",
      "summary": "state paths and databases are inspectable",
      "details": {
        "CODEX_HOME": "/home/manish/.codex (dir)",
        "active rollout files": "965 files, 482132177 total bytes, 499618 average bytes",
        "archived rollout files": "0 files, 0 total bytes, 0 average bytes",
        "goals DB": "/home/manish/.codex/goals_1.sqlite (file)",
        "goals DB integrity": "ok",
        "log DB": "/home/manish/.codex/logs_2.sqlite (file)",
        "log DB integrity": "ok",
        "log dir": "/home/manish/.codex/log (dir)",
        "memories DB": "/home/manish/.codex/memories_1.sqlite (file)",
        "memories DB integrity": "ok",
        "sqlite home": "/home/manish/.codex (dir)",
        "state DB": "/home/manish/.codex/state_5.sqlite (file)",
        "state DB integrity": "ok",
        "thread history DB": "/home/manish/.codex/thread_history_1.sqlite (missing)",
        "thread history DB integrity": "skipped (missing)"
      },
      "remediation": null,
      "durationMs": 168
    },
    "state.rollout_db_parity": {
      "id": "state.rollout_db_parity",
      "category": "threads",
      "status": "ok",
      "summary": "rollout files and state DB thread inventory agree",
      "details": {
        "default model provider": "openai",
        "rollout DB active files": "965",
        "rollout DB active rows": "965",
        "rollout DB archive mismatches": "0",
        "rollout DB archived files": "0",
        "rollout DB archived rows": "0",
        "rollout DB duplicate DB paths": "0",
        "rollout DB duplicate rollout thread ids": "0",
        "rollout DB malformed file names": "0",
        "rollout DB missing active rows": "0",
        "rollout DB missing archived rows": "0",
        "rollout DB model providers": "argo=531, openai=434",
        "rollout DB rows": "965",
        "rollout DB scan cap reached": "false",
        "rollout DB scan errors": "0",
        "rollout DB sources": "exec=603, subagent:other=176, cli=81, subagent:thread_spawn=75, mcp=26, subagent:review=3, subagent:memory_consolidation=1",
        "rollout DB stale rows": "0"
      },
      "remediation": null,
      "durationMs": 135
    },
    "system.environment": {
      "id": "system.environment",
      "category": "system",
      "status": "ok",
      "summary": "OS language en-US",
      "details": {
        "EDITOR": "set",
        "LANG": "en_US.UTF-8",
        "LESS": "set",
        "PAGER": "set",
        "VISUAL": "set",
        "os": "Ubuntu 24.4.0 (noble) [64-bit]",
        "os language": "en-US",
        "os type": "Ubuntu",
        "os version": "24.4.0"
      },
      "remediation": null,
      "durationMs": 5
    },
    "terminal.env": {
      "id": "terminal.env",
      "category": "terminal",
      "status": "ok",
      "summary": "terminal metadata was detected",
      "details": {
        "SSH_CLIENT": "present",
        "SSH_CONNECTION": "present",
        "TERM": "xterm-ghostty",
        "TERM_PROGRAM": "ghostty",
        "color output": "disabled (stdout is not a terminal)",
        "effective locale": "en_US.UTF-8",
        "multiplexer": "tmux 3.4",
        "stderr is terminal": "false",
        "stdin is terminal": "false",
        "stdout is terminal": "false",
        "terminal": "Ghostty",
        "terminal size": "80x24",
        "terminal version": "1.3.1",
        "tmux allow-passthrough": "on",
        "tmux client termname": "xterm-ghostty",
        "tmux client termtype": "ghostty 1.3.1",
        "tmux extended-keys": "off",
        "tmux focus-events": "off",
        "tmux set-clipboard": "external",
        "tmux xterm-keys": "on"
      },
      "remediation": null,
      "durationMs": 12
    },
    "terminal.title": {
      "id": "terminal.title",
      "category": "title",
      "status": "ok",
      "summary": "terminal title default",
      "details": {
        "terminal title activity": "true",
        "terminal title items": "activity, project-name",
        "terminal title project source": "git repo root",
        "terminal title project value": "nebulae",
        "terminal title source": "default"
      },
      "remediation": null,
      "durationMs": 0
    },
    "updates.status": {
      "id": "updates.status",
      "category": "updates",
      "status": "ok",
      "summary": "update configuration is locally consistent",
      "details": {
        "cached latest version": "0.146.0",
        "check for update on startup": "true",
        "last checked at": "2026-08-02T22:38:14.386301498Z",
        "latest version": "0.146.0",
        "latest version status": "current version is not older",
        "npm update target": "/home/manish/.local/share/fnm/node-versions/v24.14.0/installation/lib/node_modules/@openai/codex",
        "update action": "npm install -g @openai/codex",
        "version cache": "/home/manish/.codex/version.json"
      },
      "remediation": null,
      "durationMs": 158
    }
  }
}

What issue are you seeing?

Since 0.145.0, auto-compaction sometimes discards the whole conversation instead of summarizing it. The session continues but the model has no memory of it, and the next turn opens with the agent asking what to work on.

In the rollout, the compacted record's replacement_history holds only the four boot preamble messages (three developer, one user). A healthy compaction ends with an additional summary item that has no role; on a failure that item is absent.

The agent's next message was:

What would you like to work on in /path/to/project?

There is no error. The TUI reports a successful compaction and last_token_usage drops from 225,050 to 28,030, which is the preamble alone.

What steps can reproduce the bug?

No deterministic repro, since it is threshold-triggered on long sessions. I characterized it across my stored rollouts instead, counting every compacted record and treating a replacement_history of exactly [developer, developer, developer, user] as a failure. ChatGPT auth only, no custom provider:

CLI version compactions context lost
0.135.0 - 0.144.3 45 0
0.145.0 8 7

The first 0.145.0 compactions were healthy, then every one after 2026-07-24 19:00 UTC failed, with no version change in between. That points at a server-side component rather than the client alone.

To check your own rollouts:

find ~/.codex/sessions -name '*.jsonl' -exec jq -c \
  'select(.type=="compacted")
   | {n: (.payload.replacement_history|length),
      roles: (.payload.replacement_history|map(.role))}' {} +

Healthy rows end in null, which is the summary item. Failed rows are exactly ["developer","developer","developer","user"].

0.146.0 is absent from the table because my recent long sessions on it ran through a different model provider. The failure looks identical there, so I do not believe 0.146.0 fixes it.

What is the expected behavior?

Compaction should replace history with the preamble plus a summary. If summarization returns nothing, it should surface an error and leave history intact rather than silently discarding it.

Additional information

Two leads from strings in the 0.146.0 binary, offered as pointers rather than conclusions:

  • "A new context window will start without summarizing conversation history." describes the observed outcome exactly. If a new_context path is reachable from an auto-compaction trigger, that would match.
  • auto_compact_fallback_prompt and auto_compact_fallback_buffer_tokens suggest a fallback compaction path. If the primary summarization fails and the fallback yields empty output, an unconditional history replacement would produce this.

Related but distinct: #33493 (local compaction v2, unbounded images) and #34428 (remote compaction ignoring compact_prompt).

Activity

  1. added
    bugSomething isn't working
    CLIIssues related to the Codex CLI
    contextIssues related to context management (including compaction)
    sessionIssues involving session (thread) management, resuming, forking, naming, archiving
    on Aug 3, 2026
  2. github-actions commented on Aug 3, 2026

    @github-actions
    Contributor
  3. Nagi-Inaba commented on Aug 4, 2026

    @Nagi-Inaba

    I found a strong configuration-level A/B result for the exact four-item failure signature reported here.

    Environment

    • Windows 11 Pro x64, build 26200
    • Codex Desktop 26.727.6591.0
    • bundled codex-cli 0.146.0-alpha.9.2
    • gpt-5.6-sol
    • context window: 258400
    • remote_compaction_v2: stable / true throughout the test
    • token_budget: shown by codex features list as under development

    I scanned all top-level type="compacted" records in my local session JSONL files around the configuration change.

    Configuration period Compactions Healthy Four-item failures
    Before enabling token_budget 12 12 0
    token_budget = true 7 0 7
    token_budget = false, after restarting Codex 4 4 0

    The seven failures occurred between 2026-08-03 09:41:55 UTC and 16:35:45 UTC.

    Every failure had exactly:

    replacement_history.length = 4
    roles = [developer, developer, developer, user]
    

    Those four items contained only the startup/context envelope. The active user request, progress, tool results, conclusions, and next action were absent. The agent then asked what task it should work on.

    After setting:

    [features]
    token_budget = false

    and restarting Codex, four subsequent automatic compactions succeeded. Their replacement histories contained 7 or 8 items and ended with the expected role-less summary item. No task loss occurred.

    One correction to my earlier interpretation: payload.message == "" was present in both failed and healthy records, so an empty payload.message alone is not a reliable failure indicator. The useful discriminator is the four boot-only messages with no trailing summary item.

    This A/B result is consistent with the current open-source implementation:

    • The automatic compaction path checks Feature::TokenBudget before selecting remote or local summarizing compaction: session/turn.rs.
    • The TokenBudget implementation intentionally skips model/server summarization and starts a fresh context window: compact_token_budget.rs.

    This behavior and the proposed separation of TokenBudget reminders from summary-free rollover are already documented in #36057.

    Therefore, in my affected sessions, the four-item context loss was caused by token_budget = true, not by remote_compaction_v2 alone. remote_compaction_v2 remained enabled while compaction worked normally after disabling TokenBudget.

    This does not prove that every reproduction in this issue has the same cause, because affected users may have different feature flags. However, checking the effective token_budget value with codex features list should provide a deterministic first diagnostic.

    Current workaround

    1. Set token_budget = false.
    2. Restart Codex.
    3. Verify that subsequent compacted histories end with a summary item.

    Expected product behavior

    One of the following would avoid this silent task loss:

    • decouple TokenBudget reminders from the summary-free rollover, as proposed in Allow TokenBudget reminders with native summarizing compaction #36057;
    • clearly present the transition as an intentional fresh-context reset rather than a successful summarizing compaction;
    • or preserve normal summarizing compaction unless the user explicitly requests new_context.
  4. tajemniktv commented on Aug 26, 2026

    @tajemniktv

    I can reproduce this on current Codex Desktop / CLI 0.150.0-alpha.8 on Windows with gpt-5.6-luna (High). I hit the same failure twice in one session, on two different user follow-up tasks.

    Repro 1: diagnostic task disappears

    A long previous task ended with the context already near capacity. I then sent a new bug report with a log attachment. Luna correctly accepted the task and performed two useful diagnostic reads.

    Immediately before compaction, telemetry showed:

    input_tokens: 239286
    model_context_window: 258400
    

    The next rollout record was:

    {
      "type": "compacted",
      "payload": {
        "message": "",
        "replacement_history": [ ... ]
      }
    }

    I inspected replacement_history. It contained only the static/injected context (app/developer context, memory instructions, context-window metadata, subagent/multi-agent hints, and the AGENTS/environment user payload). It did not contain:

    • the live user request,
    • the attached log reference,
    • either diagnostic tool result,
    • any generated task/compaction summary.

    A few seconds later the model responded with the equivalent of:

    I'm ready to help with the repository. What would you like me to investigate or change?

    So from the post-compaction model's point of view there really was no active task left.

    Repro 2: task disappears mid-edit

    A later follow-up reported a concrete runtime assertion from an unlocked simulation-speed feature. Luna correctly diagnosed the exact problem: a value of 25 was reaching a vanilla API that asserts 1..20. It explicitly announced the intended prefix-clamp/postfix-restore fix and then modified the source accordingly.

    Immediately before the next compaction:

    input_tokens: 232179
    model_context_window: 258400
    

    Again, the next record was a type: "compacted" event with:

    payload.message == ""
    

    and the replacement history again lacked the current user request/task state. Four seconds later Luna replied:

    What would you like me to work on in the repository?

    Codex then marked the turn complete, despite the worktree having just been modified and no build/test validation having happened yet.

    Additional detail / possible confounder

    I do have the experimental token-budget feature enabled with an earlier reminder (~30k tokens remaining), plus AGENTS instructions to checkpoint task state. The reminder itself worked and, on an earlier turn, Luna created a .codex/TASK_STATE.md checkpoint. However, these two failures happened when automatic compaction itself fired, and the observable failure is specifically that the resulting compaction payload had an empty message and replacement history with no live task/history.

    So the custom reminder may affect when the window approaches rollover, but it does not explain why the compaction handoff contains no task summary at all.

    This looks extremely similar to the failure described here, except it is still reproducible for me on 0.150.0-alpha.8, on Windows/Desktop, and with Luna rather than Sol. The second reproduction also shows that this can leave a task half-modified and then falsely complete after the model loses its state.

  5. zhuonixian commented on Aug 27, 2026

    @zhuonixian

    Reproducing on Linux x86_64 + codex-cli 0.150.1 (release build) + gpt-5.5 + ChatGPT auth, with token_budget enabled — same boot-only replacement_history signature, plus quantitative evidence that may help confirm the root cause.

    Rollout record (top-level type: "compacted" in the session JSONL):

    payload.message = ""
    replacement_history.length = 3
    roles = [developer, developer, user]
    # → skills_instructions, <context_window> marker, <environment_context>
    

    No trailing summary item. (CLI shows 3 boot messages vs Desktop's 4 in the reports above — otherwise the same signature.)

    Post-compact turn sizes — the first real API call after compaction:

    input_tokens = 14,043   (≈ system payload only)
    then 19,234 → 31,946 → 61,549 as the new window grows naturally
    

    Compaction fired at input_tokens: 209,892 of model_context_window: 258400 (~81%). So neither the replacement history nor the server side holds any summary — it behaves as a clean fresh-window restart, and the post-compact model indeed asked what it should work on.

    Not a network failure: direct connectivity to chatgpt.com is impossible in this environment (proxy required). Through the proxy, codex doctor is all green (WebSocket 101, inference endpoint reachable, HTTP 405 on GET as expected), and an authenticated minimal POST to the responses endpoint returns 200 with response.created events. No WARN/ERROR in the sqlite runtime logs around the compaction either — the summary-free rollover is completely silent.

    Feature states via codex features list at the time of failure:

    remote_compaction_v2    stable             true
    token_budget            under development  true
    

    This is consistent with @Nagi-Inaba's analysis: token_budget (not remote_compaction_v2) selects the summary-free path in compact_token_budget.rs.

    Additional gotcha for anyone relying on the reminder as a safety net: reminder_threshold_tokens = 12000 (remaining-tokens semantics) never fired, because auto-compaction triggered at ~81% usage (~48k remaining on a 258k window) — well above the 12k reminder line. For the reminder to fire before rollover, it must be set above the auto-compact trigger point (e.g. ~80k remaining in this window size).

    Workaround applied: [features.token_budget] enabled = false (keeping remote_compaction_v2 = true). Will report back after the next auto-compaction on whether replacement_history ends with a summary item again.

  6. hyperbetteri commented on Sep 1, 2026

    @hyperbetteri

    Public-safe prompt/runtime pattern: fail closed on empty compaction

    Author: Almási Andor Aladár

    A compaction step should be treated as a state-preserving transformation, not as permission to replace working context with an empty/default context.

    Minimal rule set:

    1. Preserve a compact checkpoint containing the active objective, latest user instruction, current subtask, verified facts/source pointers, pending work, blockers, and next safe action.
    2. Validate that the compaction result actually contains a usable state summary before replacing prior working context.
    3. If the summary is empty, missing, malformed, or obviously incomplete, do not silently commit it as the new context.
    4. Preserve the previous context/state where possible and surface a recoverable error instead.
    5. After successful compaction, reconcile the checkpoint against the latest user message before continuing; latest explicit instruction wins.
    6. Never reconstruct precision data from vague memory when the original source artifact remains available.

    A prompt can provide a userland checkpoint, but the important invariant belongs in the runtime: an empty compaction result must fail closed rather than erase the active task state.

    Copyright © 2026 Almási Andor Aladár. Public-safe excerpt; no disclosure or license of the underlying private architecture.

  7. cutthreat commented on Sep 9, 2026

    @cutthreat

    I reproduced the same failure signature twice in one long-running Codex Desktop thread on Windows.

    Environment at verification time:

    • Codex Desktop 26.903.8094.0
    • codex-cli 0.153.4
    • Windows 10.0.26200.0, AMD64

    In the first occurrence, an approximately 32,190-character tool result exhausted the context window. The resulting compacted record had no usable summary: the active user request remained present in guardian_history but was absent from replacement_history. The replacement contained only developer/bootstrap context and the reinjected AGENTS.md instruction envelope. The next agent turn acknowledged those instructions instead of continuing the user's active task.

    The same structural failure happened again later after an approximately 41,845-character tool result.

    Expected behavior: compaction preserves the active user request and current work state, or fails safely without replacing the task with reinjected instructions.

    Impact: the requested work is silently abandoned while the UI receives a plausible but unrelated final answer.

    I can provide a sanitized structural diagnostic receipt privately. I am not posting the rollout because it contains private conversation and local workspace context.

  8. samvallad33 commented on Oct 1, 2026

    @samvallad33

    @goodbadwolf, this one stings, and the agent asking what it should work on is the detail I cannot shake. If I am reading that A/B comparison upthread right, the window simply starts over and the task lives nowhere else, which is a lonely place to keep the only copy. I ended up building something for this exact annoyance. Strata is a small memory plane that keeps an append only log of every event outside the context window, so a compaction can drop its summary and the durable record still replays, with recall by exact handle and no similarity search. It might help, and no pressure either way. https://github.com/samvallad33/vestige

    Disclosure: I build Vestige, the project behind Strata, so weigh my enthusiasm accordingly.

  9. goodbadwolf commented on Oct 12, 2026

    @goodbadwolf
    Author

    Two corrections to my report, plus the cause on my machine:

    • I had added token_budget = true to my config on 2026-07-24, and that is when my failures started showing up. Matches @Nagi-Inaba's A/B.
    • My version table is wrong. Recounting rollouts per CLI version by trailing role instead of the exact 4-message shape: summary-terminated compactions exist through 0.145.0, and from 0.146.0 through 0.154.x, 156 compaction records, zero summaries. The boot preamble drifts to 3 or 5 items after 0.147.0, so my shape grep undercounts the range. The real discriminator is "no trailing summary".

    #51117 (0.162.0) is not a fix for this path. run_auto_compact at tag rust-v0.162.1 still checks Feature::TokenBudget first and routes enabled sessions to the summary-free rollover. #36057 stays open, and #43912 decoupled only Guardian reviewer sessions.

    Mitigation: token_budget = false restores summarizing compaction.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    CLIIssues related to the Codex CLIbugSomething isn't workingcontextIssues related to context management (including compaction)sessionIssues involving session (thread) management, resuming, forking, naming, archiving

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions