Skip to content

fix: close four regressions from the 260923 bundle round - #5720

Merged
lidge-jun merged 8 commits into
devfrom
codex/260924-regression-risk-fixes
Sep 24, 2026
Merged

lidge-jun merged 8 commits into
devfrom
codex/260924-regression-risk-fixes

Conversation

@lidge-jun

Copy link
Copy Markdown
Owner

Summary

Fixes four regressions a post-merge review found in the 260923 bundle round (#5672-#5685). Each changes behaviour an existing user could hit on upgrade without any config change.

Plan and review record: devlog/_plan/260924_regression_risk_fixes/.

Verification

  • New regression tests, each failing on the pre-fix source and passing after: tests/codex-integration/codex-home-wsl-local-state.test.ts, tests/update/update-mise-node-runtime.test.ts, tests/adapters/tool-envelope-echo-whole-line.test.ts, tests/adapters/openai/openai-chat-serialized-tool-call-hold-bound.test.ts; the existing fresh-WSL-home test now models a fresh install instead of a mock that reported every path present.
  • Touched areas (codex-integration, update, lib, providers/cursor, responses, adapters/openai, layout and ratchet tests) outside ~/.codex: 11989 pass / 43 skip / 1 fail; the one failure was this branch's test-layout seed mismatch, fixed in the last commit (27/27 layout tests pass). Focused receipt at head: 1929 pass / 0 fail (--isolate).
  • bun run typecheck (tsc 7, 1833 files) and bun run structure:check pass. src/adapters/openai-chat.ts stays at 818/822 lines.
  • The full suite was not run locally for this PR; per the owner's instruction the gate is ci.yml lane=all on the merged dev tip.
  • gpt-6-sol audited the plan (two rounds) and the diff; findings are folded or recorded as decisions in the plan.

Checklist

  • Scope stays focused and avoids unrelated cleanup.
  • Docs or release notes were updated when needed.
  • Security-sensitive changes were reviewed for secrets, auth, and unsafe defaults.

…x holds no Codex state

#5441 made any local ~/.codex directory the Codex home on WSL, even when
config.toml is missing. A WSL user whose ~/.codex exists but holds no Codex
state, and who ran against the discovered Windows Codex home, was moved to
an empty local home on upgrade: auth and sessions disappeared and a sync
wrote a new local config.

The local home now wins only when Codex is already using it: config.toml,
auth.json, sessions or history.jsonl is present (an unexpected stat error
counts as present, so doubt never switches homes). #5441's fresh install
keeps its local home once Codex has logged in or run; a bare directory
falls back to Windows discovery as before #5441.
… on Windows

On Windows, npm -g under a mise-managed Node installs OpenCodex directly
into <mise>/installs/node/<version>/node_modules. The mise ownership
walk then read Node's own .mise.backend.toml (short = "node", full =
"core:node") as contradictory OpenCodex metadata and refused ocx update
with metadata_inconsistent, although the install is plain npm.

That exact runtime record, with the package directly in the runtime's
global node_modules, now falls through to ordinary npm detection. Any
other backend or alias under a node tool root, a deeper nested layout,
unreadable metadata and every OpenCodex mismatch stay fail-closed. POSIX
is unaffected: its lib/node_modules layout never reaches the Node record.
…velope

The shared tool-envelope echo filter from #5676 matched as soon as a line
started with a marker and dropped that line and everything after it. It
is armed on almost every agentic turn (input with tool calls or outputs,
or a previous_response_id continuation), so an answer line such as
"[Tool Result] shows the build passed." silently truncated the rest of
the reply on xAI and Cursor. The Cursor history stripper had been widened
to the same prefix rule and removed such prose from replayed history.

The envelope OpenCodex replays is a marker alone on its line. A result,
error or call marker now counts only when it is the whole line (trailing
whitespace and CR allowed), decided when the line completes; the end of
the stream follows the same rule, and a bare truncated marker still
counts. The "[Tool call:" line keeps its prefix rule because a call echo
wraps when its arguments do. The Cursor replay stripper uses the same
isWholeLineEchoMarker. Fenced markers, the xAI Responses JSON path and
the stored continuation snapshot follow from the shared filter.
… tool call

#5548 holds everything after a bare <tool_call><function=...> opening
until the stream ends, so a model that writes such a block and then keeps
answering without a structured call delivered the rest of its answer only
at the end of the turn, and could approach the translator budget.

Streaming content now goes through ingestStreaming. Once a closed block
is followed by more than 8 KiB of prose with no block open after it, or
held text plus queued events would pass 4 MiB (checked before the next
delta is retained), everything held is released in order with nothing
suppressed. A duplicated block is the tail of the content, so matching
blocks followed by their structured call are still removed; past a bound
the stream prefers delivery over suppression, the behaviour before
#5548. Buffered responses keep the unbounded ingest because their
structured calls are already known. openai-chat.ts keeps its line count.
…ueued-event paths

A delta that opens a block and already passes 4 MiB is no longer retained, an oversized delta after an open block is delivered after the held text, and queued non-text events count toward the same bound. The fresh WSL home test now models a fresh install (auth.json present, config.toml absent) instead of a mock that reported every path present. Review decisions are recorded in the plan.
@lidge-jun
lidge-jun requested a review from Ingwannu as a code owner September 24, 2026 01:19
@lidge-jun
lidge-jun merged commit 0996ecb into dev Sep 24, 2026
6 of 7 checks passed
@lidge-jun
lidge-jun deleted the codex/260924-regression-risk-fixes branch September 24, 2026 01:19
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 24, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-24T01:22:38.141472Z e606cf8 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions

Copy link
Copy Markdown
Contributor

Deterministic PR hygiene checks passed.

@github-actions github-actions Bot added the bug Something isn't working label Sep 24, 2026
@coderabbitai

coderabbitai Bot commented Sep 24, 2026

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

⚙️ Run configuration

Configuration used: Repository: lidge-jun/opencodex/.coderabbit.yaml

Review profile: ASSERTIVE

Plan: Advanced

Run ID: 8213230b-02e9-4e46-b912-2eca0b86e0d2

📥 Commits

Reviewing files that changed from the base of the PR and between 37f93da and e606cf8.

📒 Files selected for processing (33)
  • devlog/_plan/260924_regression_risk_fixes/000_overview.md
  • devlog/_plan/260924_regression_risk_fixes/010_wsl_home.md
  • devlog/_plan/260924_regression_risk_fixes/020_windows_mise_node.md
  • devlog/_plan/260924_regression_risk_fixes/030_echo_filter.md
  • devlog/_plan/260924_regression_risk_fixes/040_tool_call_hold.md
  • devlog/_plan/260924_regression_risk_fixes/050_delivery.md
  • docs-site/src/content/docs/fr/guides/codex-integration.md
  • docs-site/src/content/docs/guides/codex-integration.md
  • docs-site/src/content/docs/ja/guides/codex-integration.md
  • docs-site/src/content/docs/ko/guides/codex-integration.md
  • docs-site/src/content/docs/ru/guides/codex-integration.md
  • docs-site/src/content/docs/tr/guides/codex-integration.md
  • docs-site/src/content/docs/zh-cn/guides/codex-integration.md
  • docs-site/src/content/docs/zh-tw/guides/codex-integration.md
  • scripts/test-layout/layout.json
  • src/adapters/cursor/envelope-echo.ts
  • src/adapters/openai-chat.ts
  • src/adapters/openai-chat/serialized-tool-call-content.ts
  • src/codex/home.ts
  • src/lib/tool-envelope-echo-filter.ts
  • src/update/install-detection.mjs
  • structure/codex-home.md
  • structure/decisions/ADR-5548-serialized-tool-call-content.md
  • structure/ops/service-and-sidecars.md
  • structure/providers/chat-compat.md
  • structure/providers/cursor.md
  • structure/providers/xai-grok.md
  • tests/adapters/openai/openai-chat-serialized-tool-call-hold-bound.test.ts
  • tests/adapters/tool-envelope-echo-whole-line.test.ts
  • tests/codex-integration/codex-home-wsl-local-state.test.ts
  • tests/codex-integration/codex-home-wsl.test.ts
  • tests/fixtures/test-layout-expected.json
  • tests/update/update-mise-node-runtime.test.ts
 ______________________________________________
< Plot twist: The bug was a feature all along. >
 ----------------------------------------------
  \
   \   \
        \ /\
        ( )
      .( o ).
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e606cf8682

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".


/** Non-whitespace characters after the last closed block, or 0 while a later block is still open. */
function proseAfterClosedBlock(text: string): number {
const closer = text.lastIndexOf(CLOSE_TAG);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Require a structurally closed block before releasing it

When a streamed tool argument itself contains the literal </tool_call> and more than 8 KiB follows before the real </function></tool_call> arrives in a later chunk, this substring search treats the still-open block as closed and releases its raw serialized markup. The subsequent structured call can no longer reconcile or suppress it, so users see duplicate protocol text alongside the dispatched tool call. Determine closure using the serialized-call grammar or tracked parser state rather than any occurrence of the closing-tag string.

AGENTS.md reference: src/AGENTS.md:L19-L19

Useful? React with 👍 / 👎.

lidge-jun added a commit that referenced this pull request Sep 24, 2026
#5721)

#5720 declared the Codex-state list as a module-level const below
defaultCodexHome. The storage workers reach defaultCodexHome during
module initialisation through an import cycle, and with a ~/.codex
directory present (every Windows CI runner, and most user machines) the
call read the const before it was initialised: ReferenceError in the
trash-restore and policy-run workers. The list is now local to the
function.

The CodeBuddy compiled-MCP test also removes its temp directory with the
shared retrying helper: Windows keeps the compiled ocx executable locked
briefly after the process exits, and a plain rmSync failed with EBUSY.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant