Skip to content

Run Plan mode on Codex in Codex's native plan collaboration mode (CF-3) - #385

Merged
BunsDev merged 3 commits into
mainfrom
codex-native-plan
Oct 23, 2026
Merged

BunsDev merged 3 commits into
mainfrom
codex-native-plan

Conversation

@BunsDev

@BunsDev BunsDev commented Oct 22, 2026

Copy link
Copy Markdown
Contributor

Part of CF-3 (#276). Implements Val's decision recorded in docs/reviews/2026-10-22-cf3-plan-mode-decision.md: when Modex's Plan mode is on for a Codex turn, Modex now runs it in Codex's own plan mode.

What changes

  • Plan turns use Codex's plan mode. turn/start sends collaborationMode: { mode: "plan", settings: { model, reasoning_effort, developer_instructions: null } }.
    • The model is the one picked in Modex. If none is picked, it is the model Codex reported from thread/start or thread/resume.
    • The effort is the one picked in Modex, or Codex's default.
    • Codex's own plan instructions replace Modex's PLAN MODE: prefix.
    • The sandbox stays read-only and approval stays untrusted.
  • Codex asks questions in Plan mode without a feature flag. Its question tool is offered by default there, and questions arrive as the existing question card.
  • Codex's plan is shown as the turn's answer. Codex sends its plan as a plan item; Modex shows it as the final assistant message, marked nativePhase: "plan".
    • The text streams in as it arrives, and the finished item's text replaces the streamed text.
    • No new item kind is added.
  • Fallback. If a Codex refuses collaborationMode (JSON-RPC -32600/-32601/-32602 mentioning collaboration), Modex reruns the turn with the old prefix and shows: "This Codex does not offer its plan mode, so this Plan turn runs with Modex's plan instructions."
  • Ordinary turns don't change. They send no collaboration mode.

Evidence

  • Live check through Modex's runner on codex-cli 0.163.0.
    • Codex asked one question, which was answered with delivery: sent.
    • The plan arrived as the final answer in about 13 s.
    • Captures are outside the tree; their hashes are in the decision doc.
  • Unit tests: test/codex-native-plan.test.ts, 6 tests written red first.
  • e2e: e2e/codex-native-plan.spec.ts. It sends a Plan turn through the real backend, runner, IPC and UI against a scripted Codex.
    • It covers the question card, the plan rendered as Markdown, and the saved phases.
    • It also checks that turning Plan off sends no collaboration mode.

Tests

  • pnpm build: passed.
  • pnpm test on the rebased head: 1,816 passed, 16 skipped.
    • backend-health.test.js hung idle for two hours partway through, and I stopped it.
    • Run alone it passes 5/5 in 0.1 s. This PR doesn't touch it.
    • Before the rebase, the full unit run passed: 1,811 passed, 16 skipped.
  • pnpm test:e2e (before the rebase): 389 passed, 6 skipped, site 7 passed.

Docs

Still Val's

  • The TestFlight upload of a Companion build that has the question card.
  • Running the acceptance rows in docs/reviews/2026-10-22-cf3-question-acceptance.md.

🤖 Generated with Claude Code

BunsDev and others added 2 commits October 22, 2026 16:42
Val chose native plan mode on 2026-10-22 (docs/reviews/2026-10-22-cf3-plan-mode-decision.md). A Plan
turn on Codex now starts with `collaborationMode: { mode: "plan" }`, so Codex uses its own plan
instructions and offers its question tool by default, and the `PLAN MODE:` prefix is no longer sent.
The mode overrides the turn's model and effort, so its settings carry the model picked in Modex, or the
one Codex reported for the thread, and the picked effort. The sandbox stays read-only with `untrusted`
approvals.

Codex's proposed plan arrives as an experimental `plan` item, streamed by `item/plan/delta`, with no
final agent message. It becomes the turn's final assistant answer (`nativePhase: "plan"`), so every
client, journal and export shows it as Markdown with no new item kind. A Codex that refuses the mode
gets the prompt prefix instead, with a notice.

Red first: five of six new backend tests failed. New: test/codex-native-plan.test.ts and
e2e/codex-native-plan.spec.ts. Live: one Plan turn through the real backend, runner and broker asked
a question, took the answer, and ended with the plan as the answer.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@BunsDev
BunsDev enabled auto-merge October 22, 2026 23:57
@vercel

vercel Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
modex Ready Ready Preview Oct 23, 2026 1:30am UTC

Request Review

@github-code-quality

Copy link
Copy Markdown

Code coverage overview

Languages: TypeScript

TypeScript / code-coverage-agent

main ec7be57 codex-native-plan 82e4855 +/-
65% 65% 0%

ℹ️ Calculations represent line coverage. Results may change as calculations are updated.

@BunsDev
BunsDev added this pull request to the merge queue Oct 23, 2026
Merged via the queue into main with commit 2eba641 Oct 23, 2026
13 checks passed
@BunsDev
BunsDev deleted the codex-native-plan branch October 23, 2026 02:25
This was referenced Oct 23, 2026

This branch was successfully deployed

1 active deployment
Preview — 82e4855d Deployed Oct 23, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant