codex icon indicating copy to clipboard operation
codex copied to clipboard

[Windows Desktop] Token-budget rollover emits malformed self-referential commentary before context reset

Open a86582751 opened this issue 4 weeks ago • 2 comments

Summary

During a long-running goal task in Codex Desktop on Windows, the assistant emitted malformed, self-referential English commentary while approaching a token-budget context rollover. The text discussed whether and how to end its own turn, interleaved with ordinary task progress updates.

The local rollout records those visible fragments as assistant messages with phase = "commentary". A context reset occurred approximately two minutes later, and execution continued afterward.

This report concerns the abnormal visible output during rollover preparation. It is based on one observed incident, with matching persisted records.

Environment

  • Windows 11, Codex Desktop.
  • Selected model was gpt-6.1-sol.
  • Current running bundled executable reports codex-cli 0.166.0-alpha.6.
  • The affected conversation was originally created under 0.165.0-alpha.1.2, according to its session metadata. The exact executable build used for the incident has not been conclusively reconstructed, so the current version should not be treated as proof of the incident's build.
  • The task had an active goal and substantial accumulated context.
  • Relevant user configuration was
[features.token_budget]
enabled = true
use_history_notes_extension = true

The current executable's feature listing reports token_budget = true with stage under development, and context_management = false.

Observed behavior

The visible response included the following excerpts, with project-specific material omitted.

compaction formatted context summary?

We keep generatingneed final actualmessage commentary willfinishwhenassistant emitsendturn automatically

nowawaitauto.

These fragments appeared alongside normal progress text about unfinished work. They read as self-directed turn-control deliberation rather than useful task progress.

The screenshot's corresponding rollout entries are ordinary assistant message records with phase = "commentary". Separate reasoning records also exist, but their contents are excluded from this report. The finding is limited to the visible fragments being persisted as commentary. It does not establish which model-serving or client component assigned that phase.

Sanitized event timeline

The following is an allowlisted, normalized extraction from the local rollout. Times are UTC on November 4, 2026. Local time was UTC+08, so the two malformed commentary messages appeared at 23:28:31 and 23:28:46.

Conversation and item IDs, account information, local paths, project names, task contents, tool arguments and outputs, reasoning contents, and authentication data are omitted.

15:28:06.813  token_count
              last_token_usage.input_tokens            453532
              last_token_usage.output_tokens              533
              last_token_usage.reasoning_output_tokens    516
              last_token_usage.total_tokens            454065

15:28:31.538  item_completed
              item.type       AgentMessage
              item.phase      commentary

15:28:31.554  response_item
              type            message
              role            assistant
              phase           commentary
              visible excerpt "compaction formatted context summary?"

15:28:32.106  token_count
              last_token_usage.input_tokens            454112
              last_token_usage.output_tokens              644
              last_token_usage.reasoning_output_tokens    516
              last_token_usage.total_tokens            454756

15:28:46.036  item_completed
              item.type       AgentMessage
              item.phase      commentary

15:28:46.059  response_item
              type            message
              role            assistant
              phase           commentary
              visible excerpt "We keep generatingneed final actualmessage commentary ..."

15:30:16.069  token_count
              last_token_usage.input_tokens            464824
              last_token_usage.output_tokens             2084
              last_token_usage.reasoning_output_tokens    516
              last_token_usage.total_tokens            466908

15:30:17.425  compacted
              message length                  0
              compaction_response_id present  false

15:30:17.443  token_count
              last_token_usage.total_tokens   38647

15:30:17.457  item_completed
              item.type       ContextCompaction

15:30:22.538  response_item
              type            function_call
              execution continued after the reset

The token figures above are the recorded last-request usage, rather than cumulative lifetime usage. Reasoning output tokens are included as a reported field, not added again to total tokens.

An empty compaction message is consistent with the token-budget reset path. It is included to identify the transition, not presented as proof that all task state was lost.

Reproduction scenario to investigate

  1. Enable the configuration above in a ChatGPT-backed Desktop setup.
  2. Run a long task with an active goal and tool use until the conversation approaches its effective compaction threshold.
  3. Observe the final model steps before a token-budget context reset.
  4. Check whether user-visible commentary contains self-referential turn-ending text, malformed concatenated words, or repetitive attempts to wait for the reset.
  5. Inspect message phases and the actual compaction event, rather than relying only on the UI's compaction indicator.

This is an investigation scenario derived from the observed incident. A deterministic minimal reproduction and reproduction rate have not yet been established.

Expected behavior

The assistant should preserve the task's continuity through rollover and emit coherent, user-directed progress text. Internal turn-control confusion should not appear as visible commentary.

Related source and reports

  • Token-budget compaction implementation in 0.166.0-alpha.6 installs a fresh context window without model/server summarization.
  • #43194 concerns backend failures and unsafe continuity across reset. Backend availability was not retested for this incident, so its historical 404 findings are not asserted as this incident's cause.
  • #57475 concerns side-conversation continuity after a pre-turn reset. This report instead isolates malformed visible output before a reset in an ongoing task.

Please investigate the interaction between token-budget exhaustion handling, model-produced message phases, turn completion, and active-goal continuation.

This report was prepared with AI assistance and checked against local persisted records. No raw rollout or screenshot is attached because the source material contains unrelated project information.

a86582751 avatar Nov 04 '26 15:11 a86582751

Follow-up on November 17 — repeated resets with failing continuity operations

A separate ongoing Desktop conversation provides additional evidence about the rollover and recovery path. The audit snapshot covers November 15–17, through 09:17 UTC on November 17. The original malformed-commentary incident in this issue occurred on November 4. The causal relationship between the two observations remains open.

Effective configuration and observed transitions

The affected conversation's runtime telemetry reported

feature.token_budget                         true
feature.context_management                   false
token_budget.present                         true
token_budget.reminder_threshold_tokens       6144
token_budget.auto_compact_fallback_buffer_tokens 16384
model_context_window_effective               475000
model_context_window_override                false
model_auto_compact_token_limit               unset

User configuration was still

[features.token_budget]
enabled = true
use_history_notes_extension = true

The snapshot contains 28 calls to new_context and 28 corresponding persisted context resets. Most occurred at approximately 450,000–454,000 tokens. Recorded context usage immediately after each reset was approximately 42,000 tokens.

Every reset had an empty compaction message, no compaction_response_id, and a replacement history consisting of seven items, six developer messages and one user message. Message contents are excluded here. This shape is consistent with the token-budget fresh-window implementation.

Continuity operations repeatedly failed

The same rollout contains 159 explicit backend-failure results across the following operations.

Operation Failed results
notes write_file 31
notes append_to_file 10
notes read_file 31
notes list_files_by_prefix 39
history list_items 37
history list_windows 9
history search_contents 1

Each counted result contains the exact error Unable to perform operation: The backend request failed.

These are counted persisted tool-result records. Their individual HTTP status codes were not available in this extraction.

One representative transition

The following allowlisted timeline comes from the latest reset in that snapshot. All times are UTC on November 17, 2026. Local time was UTC+08.

08:50:31.642  checkpoint write returned backend-request failure
08:50:39.271  new_context called
08:50:39.305  new_context returned
08:50:39.318  last recorded request total_tokens = 452661

08:50:40.313  compacted
               summary message length = 0
               compaction_response_id absent
               replacement history items = 7
08:50:40.332  recorded context total_tokens = 42083

08:50:45.352  checkpoint read returned backend-request failure
08:50:51.630  checkpoint listing returned backend-request failure
08:51:03.229  history lookup returned backend-request failure
08:51:13.671  another history lookup returned backend-request failure

08:51:07–08:52:41
               shell-based recovery read project instructions,
               implementation logs and on-disk handoff records,
               inspected repository state, and queried goal state

08:52:47.590  task-specific progress commentary resumed

The observed recovery included actual filesystem reads. Continued task-specific output therefore coexists with a failing native continuity backend. The amount of lost decision context or repeated engineering work has not been quantified.

Independent authenticated HTTP checks

Separate probes in the diagnostic conversation used the same local account authentication. They used the diagnostic conversation's session identity, rather than the audited long-running conversation's identity.

On November 17 at approximately 09:22 UTC, after the user changed Clash to Global mode with TUN enabled, results were

Request Status x-oai-request-id
GET /backend-api/wham/usage 200 1aa4a52d-e011-4a0b-8f49-071d9d31be3f
POST /backend-api/codex/responses, gpt-6.1-sol 200, response.completed observed dad0e1f7-8737-41c8-af39-0ba92a40c7bd
POST /backend-api/codex/alpha/notes/v2/thread_hint 404 5d3a4899-05c2-444a-8135-28d7f5ac6614
POST /backend-api/codex/alpha/notes/v2/list_files_by_prefix 404 cbb96a7f-cb9d-4bd3-9476-91200ed3d726
POST /backend-api/codex/alpha/history/v2/list_windows 404 11b9ca4d-ff69-422c-9fbb-40b7623d1d78

The three 404 bodies were {"detail":"Not found"}. Their responses arrived in approximately 0.33–0.41 seconds.

Both explicit HTTP-proxy requests and requests with the client HTTP proxy disabled produced the same status pattern. TUN remained enabled for both, so this comparison does not establish an independent proxy-free network path. Earlier Rule-mode probes that day produced the same status pattern.

These HTTP results provide request IDs for investigation. The precise server-side cause, and the HTTP statuses behind all 159 long-conversation failures, remain unresolved. This overlaps with #43194.

Version and investigation boundaries

  • The affected conversation's creation metadata reports 0.169.0-alpha.11.1.
  • The currently running background server separately reports 0.169.0.
  • The exact serving executable for every reset has not been reconstructed.
  • This audit inspected persisted events and targeted runtime telemetry in an existing active task. A deterministic synthetic reproduction remains pending.
  • Project identifiers, local paths, conversation/item IDs, instructions, reasoning contents, tool argument bodies, and credentials are excluded from this comment.

Please investigate whether a supported token-budget session should continue replacing working context after checkpoint persistence and recovery repeatedly fail, how backend availability is surfaced to the client/model, and how recent working decisions remain recoverable in that state.

The original malformed visible commentary also remains unresolved. This follow-up adds a concrete repeated-reset and recovery-failure sequence for maintainers to correlate with it.

AI-assisted report, checked against local persisted records.

a86582751 avatar Nov 17 '26 09:11 a86582751

Additional finding — model-initiated filesystem checkpoints can conceal failing continuity services

Further inspection of the same long-running task and one of its subagents identified concrete local checkpoint files created and maintained through assistant-issued file-editing and shell calls.

These observations clarify the filesystem recovery described in the previous follow-up. The agents had established their own file-based continuity procedure while native checkpoint operations were failing.

File names below are normalized to MAIN_CHECKPOINT.md and CHILD_CHECKPOINT.txt. Project paths, conversation IDs, task contents, reasoning contents, and credentials are omitted. All times are UTC.

Main agent

The main-agent rollout records this sequence on November 15, 2026.

16:22:26.077  native checkpoint-write call
16:22:27.137  result contained backend-request failure

16:23:46.420  assistant-issued file-editing call
               Add File for MAIN_CHECKPOINT.md
               also updated the older handoff file to point to it
16:23:46.702  file-editing execution completed

16:24:46.931  context reset

16:26:26.864  assistant-issued shell call
               read MAIN_CHECKPOINT.md and the older handoff file

The main checkpoint was subsequently read and updated repeatedly. The file existed at inspection, approximately 54 KB, with its latest filesystem modification timestamp at 11:01 UTC on November 16. Later task progress was also maintained in separate on-disk handoff documents.

Subagent

The inspected subagent independently used a local checkpoint. Its November 17 sequence was

09:08:47.726  assistant-issued file-editing call
               Add File for CHILD_CHECKPOINT.txt
09:08:47.886  execution completed

09:25:05.635  attempted checkpoint update
09:25:05.845  patch verification failed because expected text was absent

09:26:02.186  another assistant-issued execution call
09:26:05.518  result reported "checkpoint appended"

09:26:31.752  context reset
               last recorded request total before reset 449983
               recorded context total after reset      41393

09:26:35–09:26:52
               native checkpoint/history recovery calls failed

09:26:46 onward
               inspected Git status, working-tree changes and source files

09:27:26.458  assistant-issued shell call
               read CHILD_CHECKPOINT.txt and a project continuation record
09:27:26.963  returned file contents

09:33:35.424  assistant-issued shell call
               appended further information to CHILD_CHECKPOINT.txt

The child checkpoint existed at inspection, approximately 17.8 KB. Its rollout also contained five native checkpoint/history backend-failure results in the inspected snapshot.

What this establishes

For these specific files, creation, update, and later recovery reads appear as assistant-issued ordinary tool calls. The model selected concrete project-local paths and emitted their contents in file-editing or shell arguments.

The inspected 0.169.0 token-budget reset implementation runs compaction lifecycle hooks and installs a fresh context window. The file-creation evidence above identifies the observed checkpoints as model-driven actions within the task.

The term “model-initiated” describes the observed call origin. Existing task instructions and context guidance may have influenced the choice to preserve progress. The exact contribution of each instruction has not been isolated.

The concrete failure preceding these writes was checkpoint-backend failure. The recorded context resets themselves completed.

User-visible consequence and hypothesis

The user reports roughly two months of use before recognizing the continuity problem. A plausible explanation is that model-maintained files, source inspection, and Git state allowed tasks to keep producing relevant work while the native continuity path was failing.

This explanation is supported for the inspected main-agent and subagent sequences. Backend failure across the entire two-month period has not been established. Completeness of preserved decisions, frequency of stale-state recovery, and the amount of repeated work remain unmeasured.

This may make the problem difficult to detect from continued task activity alone. Please consider including backend operation outcomes and file-based recovery behavior when investigating the repeated resets and the original malformed-commentary report.

AI-assisted follow-up, checked against persisted local records. Project-specific checkpoint contents are excluded.

a86582751 avatar Nov 17 '26 09:11 a86582751