Automatic context compaction after model or reasoning changes at 10–24% usage

Open 💬 0 comments Opened Jul 17, 2026 by Lennart-Hue

What version of the Codex App are you using (From “About Codex” dialog)?

26.715.21425 (build 5488; embedded app-server 0.145.0-alpha.18)

What subscription do you have?

ChatGPT Pro (20x)

What platform is your computer?

Darwin 25.5.0 arm64 arm (macOS 26.5.2, build 25F84)

What issue are you seeing?

After updating from app version 26.707.91948 / app-server 0.144.5 to 26.715.21425 / app-server 0.145.0-alpha.18, changing the selected model or reasoning effort can trigger a real automatic context compaction while only about 10–24% of the context window is in use.

This is not only the UI notification “Context automatically compacted.” The persisted session state contains actual compacted and context_compacted events.

Observed behavior

  • Switching from gpt-5.6-sol Medium to gpt-5.4-mini Medium triggered compaction at 26,910 / 258,400 tokens (10.4%).
  • Both models used the same 258,400-token context window, so this case was not caused by moving to a smaller window.
  • The compaction reduced the retained/last token usage to approximately 4,644 tokens.
  • In another thread, switching to gpt-5.6-sol triggered compaction at 60,621 / 258,400 tokens (23.5%).
  • Changing only reasoning effort from Sol Low to Sol High triggered another compaction at 32,934 / 258,400 tokens (12.7%).
  • The following turns used the selected models correctly; I did not find a model rerouting event.

Impact

Unexpected compaction can discard detail from long-running project threads, reduce answer reliability, and make ordinary model or reasoning-effort changes unsafe.

What steps can reproduce the bug?

Affected session ID: 019f6ff9-8050-7950-8a90-a4a41f8d9b75

  1. Start a clean Codex App thread using gpt-5.6-sol with Medium reasoning.
  2. Continue until context usage is approximately 26,910 / 258,400 tokens (10.4%).
  3. Change the model to gpt-5.4-mini with Medium reasoning.
  4. Send the next prompt.
  5. Observe “Context automatically compacted.”

Persisted event sequence:

  • 2026-07-17T12:08:02.555Z: token count = 26,910; model context window = 258,400
  • 2026-07-17T12:14:37.933Z: thread settings applied for gpt-5.4-mini
  • 2026-07-17T12:14:44.940Z: settings applied again at turn start
  • 2026-07-17T12:14:49.986Z: compacted
  • 2026-07-17T12:14:50.003Z: context_compacted
  • 2026-07-17T12:14:50.019Z: turn context confirms gpt-5.4-mini, Medium

The issue also reproduces without changing the model: changing only Sol reasoning effort from Low to High triggered compaction at about 12.7% context usage.

What is the expected behavior?

Changing the model or reasoning effort should not compact conversation history unless the effective auto-compaction threshold has been reached or another required compatibility constraint applies.

If compaction is intentionally required for a settings change, the app should explain the reason and ask before performing a potentially lossy operation.

A settings-only change within the same model and context window should not reduce a thread from roughly 33k tokens to roughly 6k tokens at only 12–13% context usage.

Additional information

Regression evidence

In two sampled sessions from the previous app version, automatic compaction occurred at approximately 92–94% context usage. After the update, it occurred repeatedly at 10–24%.

The remote_compaction_v2 feature was already enabled before the update. This suggests the regression may involve how app-server 0.145.0-alpha.18 handles thread/settings/update, rollback, or turn start rather than initial feature activation.

No custom model_auto_compact_token_limit, model_context_window, compact prompt, or experimental compact-prompt file is configured.

This is related to, but materially different from, #13676: that report describes a misleading warning without observed compaction after restart. Here, persisted state confirms that compaction actually occurred at low context usage. It is also different from #32453, where model switching is blocked by an HTTP 429 during compaction.

I also submitted this through in-app /feedback on July 17, 2026.

Attachments

  • Three screenshots from the isolated reproduction
  • A sanitized nine-line session-event extract
  • A sanitized runtime/environment extract

compaction-minimal-repro.redacted.txt

<img width="2432" height="1526" alt="Image" src="https://github.com/user-attachments/assets/75d600cf-d841-4e73-b67e-b59c8eea86ed" />
<img width="2704" height="1696" alt="Image" src="https://github.com/user-attachments/assets/cbddc171-34ed-406b-9a77-df73bf590008" />
<img width="2704" height="1696" alt="Image" src="https://github.com/user-attachments/assets/304c9a11-2e95-47dd-a713-72a649e97114" />

app-runtime.redacted.txt

View original on GitHub ↗