RemoteCompactionV2 repeat-compaction loop and state loss in ephemeral side conversations
Summary
On Codex Desktop 26.721.41059 (build 5848, embedded codex-cli 0.146.0-alpha.3.1), an ephemeral side conversation repeatedly auto-compacts while investigating compaction itself. The compacted conversation resumes with an unusually large context, quickly compacts again, and can lose decision-critical state.
A diagnostic upload was submitted through feedback/upload with logs enabled and the desktop log attached. The API associated it with parent thread 019fa51f-b15d-7fb2-82ad-7bac48ccbca6 rather than returning a separate feedback ID.
Thread IDs
- Persistent parent:
019fa51f-b15d-7fb2-82ad-7bac48ccbca6 - Ephemeral side conversation:
019fa548-b7d2-7b43-ab59-c8f3b7d05b4e
Reproduction evidence
The side conversation was forked from the parent at 2026-07-27T20:33:54.313Z and received its boundary injection at 20:33:54.379Z, while parent tool item exec-2506c50c-b54b-4e5d-aac6-8071a391fbc5 was still active.
Immediately around that fork, the desktop log emitted hundreds of messages of this form:
Item not found in turn state itemId=exec-2506c50c-b54b-4e5d-aac6-8071a391fbc5
Received turn/started for unknown conversation conversationId=019fa548-b7d2-7b43-ab59-c8f3b7d05b4e
Received item/started for unknown conversation conversationId=019fa548-b7d2-7b43-ab59-c8f3b7d05b4e
Rebinding placeholder latest turn to incoming event ...
The side conversation is deliberately ephemeral and pathless. It has no rollout JSONL and no row in state_5.sqlite, so its compaction replacement and turn history cannot be audited through the normal persisted artifacts.
After a fresh compaction in that side conversation, app-server token telemetry resumed at approximately 138,163 tokens and rose past 159,499 within roughly one minute. Every record showed:
auto_compact_scope_limit=244800
full_context_window_limit=258400
RemoteCompactionV2
This leaves little useful headroom after compaction and produces another compaction during ordinary tool-heavy investigation.
Separately, an earlier compaction in the persistent July 14 lineage lost an architectural constraint and caused the assistant to reach the wrong conclusion. Re-reading the pre-compaction JSONL reversed that conclusion. This was decision-critical semantic loss, not only inefficient token retention.
Failure layers
The evidence appears to show three related but distinct problems:
- Retention/headroom: RemoteCompactionV2 retains enough raw message and startup/tool context that this side conversation resumes around 138k tokens and quickly compacts again.
- Active-turn semantic state: decision-critical constraints can disappear or older state can be restored as current, overlapping the behavior reported in #8648.
- Side-fork lifecycle and observability: forking while a parent tool item is active produces unknown-item/unknown-conversation/rebinding errors, while the ephemeral fork has no persisted rollout for diagnosis.
Expected behavior
- A side fork should have a coherent turn/item lifecycle even when the parent has an active tool call.
- Compaction should leave enough headroom for meaningful continued work rather than immediately triggering another compaction.
- The current active goal, user correction, and architectural constraints should survive compaction.
- Ephemeral side-conversation failures should have enough persisted diagnostic state to reconstruct the compaction and event sequence.
Related issues
- #8648: replies or resumes from the wrong conversational state after compaction
- #21269: retained startup/context packets in compacted replacement history, closed after the June 29 local-compaction rollout
This reproduces on the current local-v2 desktop build after #21269 was closed.
5 Comments
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
I can reproduce the repeat-compaction loop in a normal persistent local desktop task, so the affected scope appears broader than ephemeral side conversations.
Environment
26.715.52143(build5591)codex-cli 0.145.0-alpha.1826.4(build25E246)019fa463-f80c-7143-acef-24491dc181e7Evidence
The affected work was a bounded documentation/validation handoff: list the few owner-only provider values still required to close an infrastructure Phase 0, record their sources, validate the repository artifacts, and finish the conversation.
From
thread/readfor turn019fa5bf-3e7b-7bc2-9a5e-3c53cca25e94:interrupted9,476,685 ms(~2 h 37 min 57 s)contextCompactionitemsThe agent repeatedly returned from compaction saying it was about to inspect, verify, or patch the same small handoff. It did make some changes, but repeatedly lost operational continuity and expanded/reprocessed the task instead of completing it.
The subsequent explicit closure turn
019fa652-0c90-7bb0-9226-ed2bc0a5425bwas also interrupted after517,490 ms(~8 min 37 s). It contained 6 morecontextCompactionitems, three short reasoning items, and two status messages, but no tool call, file change, or final answer.The complete local rollout currently contains 157
context_compactedevents across 129 user-message events. I am not attaching the raw rollout because the task contains private infrastructure identifiers; the task ID is included for internal diagnostics.Expected behavior
This reproduction seems related to all three layers described in the issue: insufficient post-compaction headroom, loss of active-turn semantic state, and weak observability/recovery. Unlike the original report, however, it occurred in an ordinary persisted desktop task with a rollout JSONL and a stable task ID.
Follow-up: I also submitted this through Codex's internal
/feedbackflow with logs and diagnostics enabled.019fa677-950c-7a92-823c-1d7916e4618e019fa463-f80c-7143-acef-24491dc181e7Two direct
feedback/uploadapp-server attempts against the affected task remained pending indefinitely (first with logs, then withincludeLogs=falseand only a 2 MB desktop log). I therefore used a fresh TUI/feedbacksession and included the affected task/turn IDs plus this issue comment URL in the report text. The 5.7 GB rollout was not attached through that fresh upload, but its path/size and the original task ID are recorded in the feedback.I reproduced a stronger form of this in a persistent Codex Desktop task and inspected the rollout JSONL.
Environment: Desktop
26.727.40816(build6067), embeddedcodex-cli 0.146.0-alpha.9.2, GPT-5.6 Sol, 258,400-token context,remote_compaction_v2=true.The task crossed three automatic compaction boundaries at approximately 225k–231k total tokens. Every resulting
type="compacted"record had:Those four messages contained only startup/context material: app/memory/skill instructions, multi-agent instructions and the
AGENTS.md/environment wrapper. The active user request, progress, tool results, conclusions and next action were all absent.Immediately after the three compactions, the model responded with variants of:
This appears model-generated from the surviving startup instructions, not a hardcoded reset message.
The first request used 32,124 input tokens, including 191 advertised skills and a broad memory/
AGENTS.mdpacket. That large baseline makes compaction occur sooner, but it is not sufficient to explain total task loss: it is only ~12.4% of the context window.The causal boundary supported by the artifacts is:
The local records cannot distinguish whether the service returned an empty summary or client-side V2 assembly discarded it. They do prove the malformed replacement was persisted and installed silently.
Suggested guard: reject or fall back whenever
payload.messageis empty andreplacement_historycontains only startup/context packets with no actual user task or progress summary. Disablingremote_compaction_v2is an effective bypass; reducing startup size only postpones the failure.Hi @bardsleym, regarding the missing tool output / unfinished call state in the transcript, Codex Rescue Alpha5 has bounded tool-correlation diagnostics to detect persisted correlation anomalies and incomplete turn boundaries without assuming non-execution.
To inspect the rollout locally and safely in read-only mode:
No private files need to be uploaded; please sanitize any repository details before sharing diagnostic output.