[PR #12778] fix(opencode): allow experimental plan mode to gather external context before exploring the codebase #14365

Open
opened 2026-02-16 18:19:10 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/12778

State: open
Merged: No


What does this PR do?

Fixes #12037

Please see the issue for a detailed description of the problem.

Tldr, when using experimental plan mode with the GPT-5.x codex models, they seem to follow instructions quite rigorously and refuse to pull additional critical information before launching their explore agents. This leads to an extremely sub-par exploration of the codebase, causing issues with the plan down the line.
I believe this happens due to the Critical: In this phase you should only use the explore subagent type. line in the prompt.

The Claude series models don't seem to suffer from this, and are smart enough to pull the relevant info before exploring the codebase.

How did you verify your code works?

My testing mostly involved rerunning the previously identified problem prompts against an internal codebase to verify the new vs old behavior. I've tested it with other models (Claude), but my main testing focused on the GPT 5.2-codex models since they exhibited the issue most prominently.

I used the command OPENCODE_EXPERIMENTAL=1 bun dev ~/work/yield-platform to test the changes locally.

Prompt output when using the existing prompt on the dev branch

current-experimental-plan-output

This showcases a behavior of GPT that I specified in the issue, where it tries to launch the MR retrieval inside an explore task, which fails.

Output with the amended prompt

https://github.com/user-attachments/assets/14a6d17d-4ce0-48f7-8040-1610a74fd128

Output when required tool is not available

https://github.com/user-attachments/assets/564200c8-0e38-4991-82c4-1943266d3b8e

**Original Pull Request:** https://github.com/anomalyco/opencode/pull/12778 **State:** open **Merged:** No --- ### What does this PR do? Fixes #12037 Please see the issue for a detailed description of the problem. Tldr, when using experimental plan mode with the GPT-5.x codex models, they seem to follow instructions quite rigorously and refuse to pull additional critical information before launching their explore agents. This leads to an extremely sub-par exploration of the codebase, causing issues with the plan down the line. I believe this happens due to the `Critical: In this phase you should only use the explore subagent type.` line in the prompt. The Claude series models don't seem to suffer from this, and are smart enough to pull the relevant info before exploring the codebase. ### How did you verify your code works? My testing mostly involved rerunning the previously identified problem prompts against an internal codebase to verify the new vs old behavior. I've tested it with other models (Claude), but my main testing focused on the GPT 5.2-codex models since they exhibited the issue most prominently. I used the command `OPENCODE_EXPERIMENTAL=1 bun dev ~/work/yield-platform` to test the changes locally. #### Prompt output when using the existing prompt on the `dev` branch <img width="1728" height="1022" alt="current-experimental-plan-output" src="https://github.com/user-attachments/assets/57302d6b-9d49-4ada-8534-4bb6378a2a00" /> This showcases a behavior of GPT that I specified in the issue, where it tries to launch the MR retrieval inside an explore task, which fails. #### Output with the amended prompt https://github.com/user-attachments/assets/14a6d17d-4ce0-48f7-8040-1610a74fd128 #### Output when required tool is not available https://github.com/user-attachments/assets/564200c8-0e38-4991-82c4-1943266d3b8e
yindo added the pull-request label 2026-02-16 18:19:10 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#14365