Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

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

Open Beginner friendly
#57,013 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

@Veld101 is already working on this.

Since Oct 19, 2026.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
72/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
typescript
Domain
ai, backend

Research direction

Start with the reminder insertion logic in packages/core/src/plugin/plan.ts, especially the message placement shown in the issue, then inspect the related cases in plan.test.ts. Reproduce the trailing user reminder after a tool-driven switch and check how persisted reminders behave on retry. Done means the reminder stays in the correct order without leaving an empty user turn at the end, and the plan tests pass.

Written by the indexing model from the issue text.

Description

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

Dominant language
TypeScript
Stars
215k
Forks
28.9k
Avg merge
8h 27m
Merged PRs (30d)
282

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from anomalyco/opencode

All issues in anomalyco/opencode

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.