Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Plan mode leave reminder becomes the final user turn after a tool-driven agent switch, models refuse

オープン 初心者向け
#57,013 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@Veld101 がすでに取り組んでいます。

2026年10月19日 から。

  • #57065 @Veld101 による — オープン

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
72/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
typescript
領域
ai, backend

調査の方向性

packages/core/src/plugin/plan.ts のリマインダー挿入ロジックから始め、特に issue に示されているメッセージの配置を確認してから、plan.test.ts の関連ケースを調べてください。ツール主導の切り替え後に末尾に追加されるユーザーリマインダーを再現し、リトライ時に永続化されたリマインダーがどう振る舞うかを確認してください。リマインダーが正しい順序に保たれ、最後に空のユーザーターンが残らず、plan のテストが通れば完了です。

索引モデルが issue の本文から書いたものです。

説明

reproduced
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
  1. Start a session in the plan agent.
  2. Have a tool call switch the session to build (for example, approve a plan in Plannotator).
  3. 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

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

anomalyco/opencode のほかの issue

anomalyco/opencode の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。