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?
- 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.
• 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
18 Comments
@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.
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:Code mode template (
codex-rs/core/templates/collaboration_mode/code.md) only says: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.mdto explicitly end Plan mode:This ensures the model receives an unambiguous signal that Plan mode rules no longer apply.
Repro Steps (from issue)
Thread ID:
019c0aed-2138-7b32-acf5-f3fb174f84f3Note: 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.mdtemplate 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.
Hey @0xdeafbeef have you noticed this on newer versions? I was unable to repro this even on v0.92.0 following your instructions:
I worry the behavior is non-deterministic. Did it happen every time for you? Or only sometimes?
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).
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.
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
looks fixed
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.@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.mdwhich still had the vague "you are now in code mode" wording.#10545 fixed
default.mdwith the explicit "Any previous instructions for other modes are no longer active" language, butcode.mdmay 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.
This is definitely back. Still happens on latest Codex sometimes when I interrupt it trying to produce the plan. Subsequent calls of
/plando not exit plan mode, evident by "Plan mode" in purple in status line.@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.
I just hit what looks like the same bug.
I asked Codex to create a plan, but I forgot to type
/planor enable the Plan Mode switch manually.After that:
<proposed_plan>and</proposed_plan>tags.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:
<img width="300" alt="Image" src="https://github.com/user-attachments/assets/2a5637c9-2c74-40e4-ab93-5e677916e9f0" />
<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.
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.
@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.
Thanks for the workaround.