Skip to content

fix: Codex 0.163 rollout root conflict and rebind long persisted prompts - #845

Closed
jgafarias wants to merge 2 commits into
miuuyy:mainfrom
jgafarias:fix/codex-0.163-rollout-roots
Closed

jgafarias wants to merge 2 commits into
miuuyy:mainfrom
jgafarias:fix/codex-0.163-rollout-roots

Conversation

@jgafarias

Copy link
Copy Markdown

Summary

Two fixes for 6.1.9: one for a regression caused by the Codex 0.163 update, and one for binding long prompts to their persisted turn.

1. Current environment conflicts with its current Codex rollout on Codex 0.163

After Codex Desktop updated from 0.162.0-alpha.17.2 to 0.163.0-alpha.10.2, every turn failed with:

stream disconnected before completion: Current environment conflicts with its current Codex rollout

Cause: Codex 0.163 no longer records workspace_roots in turn_context. Its <environment_context> envelope still lists the granted output directory (~/.codex/visualizations/<date>/<thread>) as a workspace root, next to the project. With no declared roots, the rollout fell back to [cwd]. The strict root comparison in sameAuthority then rejected the envelope.

Rollout data before and after the update:

Codex turn_context.workspace_roots envelope roots sandbox_policy.writable_roots
0.162 [project, visualizations/…] [project, visualizations/…] [visualizations/…]
0.163 (absent) [project, visualizations/…] [visualizations/…]

Fix: the envelope must still include every rollout root. It may list an extra root only when the rollout already grants that path as a writable root. An envelope root that the rollout does not grant still throws. The authority returned to the caller still comes from the rollout, never from the envelope.

2. Rebind persisted exchanges across rendered-only prompt differences

A very long prompt (50–90k characters) sent to a fresh chat can show no user bubble while it generates. When the answer completes, ChatGPT persists the exchange under a new key, and its user bubble can differ from the submitted text:

  • a connector pill rendered inline,
  • the context JSON fence rendered as a code block with its own label and copy button,
  • backslashes doubled by the Markdown composer,
  • a bubble collapsed behind "Show more" that shows only the head or the tail of the prompt.

In these cases the exact text comparison failed and the turn was rejected as another user turn.

The ownership check now matches after removing those rendered-only differences. A collapsed bubble is accepted only when the conversation was empty before this turn and the bubble shows a contiguous fragment of at least 256 content characters from the submitted prompt. A longer or reworded message still does not match. On a mismatch, only character counts are logged, never prompt text.

Tests

  • tests/environment.test.ts: new regression test for a rollout without workspace_roots whose envelope lists a granted output root. It also checks that a root the rollout does not grant is still rejected. The test fails without the fix.
  • tests/browser-turn-binding.test.ts: new DOM scenarios (run when CHATGPT_DOM_TEST_BROWSER is set) for the pill, fenced-context, escaped-backslash and collapsed head/tail cases, plus negative cases (history present, divergent, too short, longer, reworded, changed tail or fence).
  • bun test ./tests: 950 pass, 0 fail.
  • Built a Windows package with Bun 1.4.0, installed it over 6.1.9 and checked that the installed bundle contains the fix, on Codex 0.163.0-alpha.10.2.

Codex 0.163 no longer records workspace_roots in turn_context, while its
<environment_context> envelope still lists granted output directories
(e.g. ~/.codex/visualizations/<date>/<thread>) as workspace roots. The
rollout then fell back to [cwd] and every turn failed with "Current
environment conflicts with its current Codex rollout".

An envelope root beyond the rollout roots is now accepted only when the
rollout already grants it as a writable root, so it never expands the
authority returned to the caller.
Long prompts sent to a fresh chat can show no user bubble while
generating, and ChatGPT later persists the exchange under a new key with
a connector pill, a fenced code block, escaped backslashes, or a
collapsed bubble. Ownership of the persisted turn is now matched after
removing those rendered-only differences, and a collapsed bubble is
accepted only in a conversation this turn opened empty when it shows a
substantial contiguous fragment of the submitted content. Mismatches log
lengths only.
@jgafarias jgafarias changed the title Fix Codex 0.163 rollout root conflict and rebind long persisted prompts fix: Codex 0.163 rollout root conflict and rebind long persisted prompts Oct 16, 2026
@miuuyy

miuuyy commented Oct 17, 2026

Copy link
Copy Markdown
Owner

Thanks, the Codex 0.163 directory mismatch is real; I've addressed it locally against current main. I won't use the partial-text matching: two different prompts can share the same visible fragment. The reply fix already on main verifies the current turn, and the new Bigger Context fix expands and checks the full stage message.

@miuuyy miuuyy added the non-urgent PR: deferred capability, documentation, tooling, or a non-blocking correction. label Oct 17, 2026
@miuuyy

miuuyy commented Oct 17, 2026

Copy link
Copy Markdown
Owner

Thanks for identifying the Codex 0.163 issue. The directory fix is ready locally. I am closing this in favor of our existing reply checks and the upcoming full-message expansion fix; matching only part of a prompt could select the wrong request.

@miuuyy miuuyy closed this Oct 17, 2026
miuuyy added a commit that referenced this pull request Oct 17, 2026
…nnel calls

Expand and verify acknowledged Bigger Context stages, accept exact Codex-granted output roots, handle upload rejections before processing, and avoid repeated tokenization of identical chunks. Enable shared-stdio handshake completion in every owned tunnel startup path.

Includes findings from @nofihq in #840, @jgafarias in #845, and reports #844 and #811. Contributor fixes #837 and #842 were merged separately with their original authorship.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

non-urgent PR: deferred capability, documentation, tooling, or a non-blocking correction.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants