Mode switch Plan -> Code still behaves like Plan

Open 💬 18 comments Opened Jan 29, 2026 by 0xdeafbeef
💡 Likely answer: A maintainer (swordfish444, contributor) responded on this thread — see the highlighted reply below.

What version of Codex is running?

codex-cli 0.92.0

What subscription do you have?

pro

Which model were you using?

_No response_

What platform is your computer?

Linux 6.18.0-364.vanilla.fc43.x86_64 x86_64 unknown

What terminal emulator and version are you using (if applicable)?

_No response_

What issue are you seeing?

  1. Start a session in Code mode.
  2. Switch to Plan mode (shift‑tab).
  3. Switch back to Code mode.
  4. Ask for an execution command (e.g., “go”).

Observed: agent claims it’s still in Plan mode and refuses execution.
Workaround: shift‑tab to Plan and back fixes it.

• Execution is blocked in Plan Mode despite user saying go; must respond with a status update that
  execution can't proceed until mode switches, without asking questions directly.

  Preparing user confirmation prompt

  Planning to request user confirmation to proceed with execution once mode switches, asking
  explicitly to confirm running commands now.

• I’m still in Plan Mode, which forbids executing commands. Please switch me back to code mode

What steps can reproduce the bug?

  • Plan mode instruction injected at 2026‑01‑29T18:04:55.152Z (developer message

<collaboration_mode>).

  • Turn context later switches to Code mode at 2026‑01‑29T18:53:37.015Z (collaboration_mode:

{ mode: "code" }).

  • Despite that, at 2026‑01‑29T20:09:32.854Z the agent reasons “Execution is blocked in Plan Mode

…” and emits a request_user_input tool call and message stating it is still in Plan Mode.

What is the expected behavior?

Shift tab removes prev instructions

Additional information

thread ID 019c0aed-2138-7b32-acf5-f3fb174f84f3

View original on GitHub ↗

18 Comments

swordfish444 contributor · 5 months ago

@etraut-openai This looks like the same underlying issue as #9997 (Plan-mode instructions still influencing behavior after switching back to Code). This report has a nice timestamped repro; suggest consolidating the details into #9997 and closing this as a dup.

yuvrajangadsingh contributor · 5 months ago

Root Cause Analysis

I investigated the collaboration mode templates and found the issue:

Plan mode template (codex-rs/core/templates/collaboration_mode/plan.md) states:

"You are in Plan Mode until a developer message explicitly ends it. Plan Mode is not changed by user intent, tone, or imperative language."

Code mode template (codex-rs/core/templates/collaboration_mode/code.md) only says:

"you are now in code mode."

When switching Plan→Code, the Code mode instruction doesn't explicitly end Plan mode - it just announces Code mode. The model follows Plan mode's instruction to persist until an explicit end message.

Proposed Fix

Update code.md to explicitly end Plan mode:

Plan Mode is now ended. You are in Code mode.
You may now execute commands, edit files, and perform mutating actions.

This ensures the model receives an unambiguous signal that Plan mode rules no longer apply.

Repro Steps (from issue)

  1. Start in Code mode
  2. Switch to Plan mode (shift+tab)
  3. Switch back to Code mode
  4. Ask for execution → agent refuses, claims still in Plan mode

Thread ID: 019c0aed-2138-7b32-acf5-f3fb174f84f3

yuvrajangadsingh contributor · 5 months ago

Note: I see @swordfish444 mentioned this may be a dup of #9997, which was marked as mitigated.

However, since the issue persists in 0.92.0, my analysis above might explain why the fix was incomplete - the code.md template still doesn't explicitly end Plan mode, so the model continues following Plan mode's instruction to persist "until a developer message explicitly ends it."

If this is indeed a regression or incomplete fix of #9997, the root cause analysis above may help identify what was missed.

charley-oai contributor · 5 months ago

Hey @0xdeafbeef have you noticed this on newer versions? I was unable to repro this even on v0.92.0 following your instructions:

Start a session in Code mode. Switch to Plan mode (shift‑tab). Switch back to Code mode. Ask for an execution command (e.g., “go”). Observed: agent claims it’s still in Plan mode and refuses execution. Workaround: shift‑tab to Plan and back fixes it.

I worry the behavior is non-deterministic. Did it happen every time for you? Or only sometimes?

charley-oai contributor · 5 months ago

If non-deterministic than it may just be an issue with the code mode developer instructions (being too subtle) as @yuvrajangadsingh has suggested. But in the rollout of the thread you posted, it looked like the model was getting confused by repetitive insertion of the plan mode instructions, which makes me think there was some bug causing the plan mode instructions to be reinserted at the wrong times (in which case updating the code mode prompt wouldn't fix).

0xdeafbeef · 5 months ago
Hey @0xdeafbeef have you noticed this on newer versions? I was unable to repro this even on v0.92.0 following your instructions: > Start a session in Code mode. > Switch to Plan mode (shift‑tab). > Switch back to Code mode. > Ask for an execution command (e.g., “go”). > Observed: agent claims it’s still in Plan mode and refuses execution. > Workaround: shift‑tab to Plan and back fixes it. I worry the behavior is non-deterministic. Did it happen every time for you? Or only sometimes?

Happened in some latest alpha from today. Also there is an issue when you switch plan -> code and it tries to use ask questions tool, but it's available only in a plan mode.

Also it pretty often just states that it's ready to impl plan and asks to manually switch to code mode.

I think that it's the problem of me doing several edit rounds in a single context window without using /new.

charley-oai contributor · 5 months ago

Hopefully this PR will improve: https://github.com/openai/codex/pull/10545

0xdeafbeef · 5 months ago
Hopefully this PR will improve: https://github.com/openai/codex/pull/10545

BTW request_user_input gate request_user_input under plan mode at all? It's nice feature and you will put less ifs into a prompt if it's always available

0xdeafbeef · 4 months ago

looks fixed

0xdeafbeef · 4 months ago

019cdde2-2cfc-7ca0-92a1-b44a790ea8ea

Got I can draft the exact drift.md content here, but I can’t write the file while we’re in Plan Mode. I've not used plan mode in this session at all.

yuvrajangadsingh contributor · 4 months ago

@charley-oai @0xdeafbeef looks like this is back. i submitted a fix for this earlier in #10270 (before the contribution guidelines changed) that addressed the template side, specifically code.md which still had the vague "you are now in code mode" wording.

#10545 fixed default.md with the explicit "Any previous instructions for other modes are no longer active" language, but code.md may still need the same treatment. my fix explicitly stated "Plan Mode is now ended" in that template, which gives the model a clear signal to drop plan mode constraints.

i've been contributing fixes to codex since before the guideline change (PRs #9196, #9279, #9348 all merged). happy to rebase #10270 on main if you want to pick it up.

reverofevil · 3 months ago

This is definitely back. Still happens on latest Codex sometimes when I interrupt it trying to produce the plan. Subsequent calls of /plan do not exit plan mode, evident by "Plan mode" in purple in status line.

yuvrajangadsingh contributor · 3 months ago

@charley-oai @etraut-openai @reverofevil just checked the current templates on main. the original template bug is fixed, #10545 rewrote default.md with explicit "previous mode instructions no longer active" and code mode is now an alias for Default. so the prompt-level issue from my earlier analysis is resolved.

but @reverofevil's report sounds different. he says interrupting plan generation and then calling /plan again doesn't exit plan mode (purple "Plan mode" stays in status line). that sounds like a TUI state issue, not a prompt one. if the mode switch handler doesn't fire when the model is interrupted mid-generation, the internal state stays on Plan even though the user expects it to reset.

worth checking if the shift-tab / /plan toggle properly resets ModeKind when the model is mid-response. the template will only help if the mode actually switches at the protocol level.

firecrauter · 2 months ago

I just hit what looks like the same bug.

I asked Codex to create a plan, but I forgot to type /plan or enable the Plan Mode switch manually.

After that:

  • The response included literal <proposed_plan> and </proposed_plan> tags.
  • Codex appeared to behave as if it was in Plan Mode.
  • I could not proceed normally from that state.

To work around it, I had to fork from the previous message and retry the request, this time explicitly enabling Plan mode.

Note: I did not try sending another message with Plan Mode on active, then off.

Environment:

  • Codex: 26.429.30905
  • OS: Windows 11
  • Subscription: ChatGPT Plus

<img width="300" alt="Image" src="https://github.com/user-attachments/assets/2a5637c9-2c74-40e4-ab93-5e677916e9f0" />

justingolden21 · 2 months ago

<img width="813" height="908" alt="Image" src="https://github.com/user-attachments/assets/93317ae1-486d-4986-ad56-a6855da1a711" />

Still a thing in May 2026.

Plan mode is unchecked and it absolutely refuses to do anything. This is broken and it's very annoying. I just had it execute a plan half an hour ago and it worked fine, and the next plan now it doesn't work at all

Workaround: I force closed codex and restarted and no dice. I copied its plan to a new chat and it's now not in plan mode.

thevans101 · 2 months ago
Still a thing in May 2026. Plan mode is unchecked and it absolutely refuses to do anything. This is broken and it's very annoying. I just had it execute a plan half an hour ago and it worked fine, and the next plan now it doesn't work at all Workaround: I force closed codex and restarted and no dice. I copied its plan to a new chat and it's now not in plan mode.

Confirming that I'm also occasionally experiencing this issue with GPT-5.5 in Codex Version 26.513.31313 (2867). Repeated prompts and restarting Codex didn't fix it for me either, but turning plan mode on, sending a short prompt (to ignore the message), then turning plan mode off again seemed to fix it.

dsinghjassal · 2 months ago

@charley-oai / @etraut-openai I am also facing this issue; I am trying to try out codex having used claude code for months but this is not a great start for sure.

dsinghjassal · 2 months ago
> Still a thing in May 2026. > Plan mode is unchecked and it absolutely refuses to do anything. This is broken and it's very annoying. I just had it execute a plan half an hour ago and it worked fine, and the next plan now it doesn't work at all > Workaround: I force closed codex and restarted and no dice. I copied its plan to a new chat and it's now not in plan mode. Confirming that I'm also occasionally experiencing this issue with GPT-5.5 in Codex Version 26.513.31313 (2867). Repeated prompts and restarting Codex didn't fix it for me either, but turning plan mode on, sending a short prompt (to ignore the message), then turning plan mode off again seemed to fix it.

Thanks for the workaround.