Plan mode leave reminder becomes the final user turn after a tool-driven agent switch, models refuse
メンテナーはふだん 1 日以内に返信
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 72/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- typescript
調査の方向性
packages/core/src/plugin/plan.ts のリマインダー挿入ロジックから始め、特に issue に示されているメッセージの配置を確認してから、plan.test.ts の関連ケースを調べてください。ツール主導の切り替え後に末尾に追加されるユーザーリマインダーを再現し、リトライ時に永続化されたリマインダーがどう振る舞うかを確認してください。リマインダーが正しい順序に保たれ、最後に空のユーザーターンが残らず、plan のテストが通れば完了です。
索引モデルが issue の本文から書いたものです。
説明
Description
When the agent switches away from plan partway through a turn, so the last message is an assistant or tool message rather than a user prompt, the opencode.plan context hook adds the "NO LONGER in Plan mode" reminder at the very end of the request:
// packages/core/src/plugin/plan.ts (dev ba06ff9e0b), lines 64-65
const at = event.messages.at(-1)?.role === "user" ? event.messages.length - 1 : event.messages.length
event.messages.splice(at, 0, Message.user(text))
The request then ends with a user turn that holds only a <system-reminder> and no instruction. gpt-5.3-codex replies "I'm sorry, but I cannot assist with that request." every time. The reminder is also persisted as a synthetic message, so it stays at the end on retries, and the session keeps refusing until the user types something.
This shows up with plan-approval plugins (Plannotator submit_plan): the tool result reads "Plan approved…", the plugin switches the agent to build, and the next request ends assistant(tool_call) > tool(result) > user(<leave reminder>). In my gateway logs, every refused request has this exact tail: 6 of 6 refusals on 2026-10-19.
Steps to reproduce
- Start a session in the
planagent. - Have a tool call switch the session to
build(for example, approve a plan in Plannotator). - Look at the next model request: its last message is a user message containing only the leave reminder. Seen with gpt-5.3-codex through an OpenAI-compatible Responses provider.
Proposed fix
If a switch reminder would be the last message and the message before it is not a user message, move the reminder to the start of the trailing assistant/tool run. The request then ends on the tool result, as a normal agent loop does, and the enter/leave order is kept. The same check also fixes reminders that were already persisted at the tail. Tests: two new cases fail before the fix and pass after it. All 15 tests in plan.test.ts pass, and tsc -b and prettier are clean. I have a patch ready and can open a PR if a maintainer is happy with this approach.
OpenCode version
2.0.32 (bug also present on dev ba06ff9e0b)
Plugins
@plannotator/opencode 0.28.23 (triggers it), plus local plugins
Operating System
macOS
- 主要言語
- TypeScript
- スター
- 215k
- フォーク
- 28.9k
- 平均マージ
- 4時間 21分
- マージ済み PR(30日)
- 476
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
anomalyco/opencode のほかの issue
-
reproduced
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
anomalyco/opencode#58247 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
anomalyco/opencode#58216 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
pending close triaging
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
anomalyco/opencode#58181 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
Opencde Github Actions Bot Cannot Install対応中かも @zzz-creator が今日担当しました。 オープンreproduced
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
anomalyco/opencode#57911 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
anomalyco/opencode#57855 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
anomalyco/opencode の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
db-ux-design-system/core-web#8613 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
foxglove/mcap#1907 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
bug internal-plugin pr-welcome upstream
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
dsh-tauri-desk/deepseek-harness-desktop#1225 · コメント 1 件 ·
-
enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
unjs/unhead#1027 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信