Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

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

Abierto Apto para principiantes
#57,013 1 comentario 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

@Veld101 ya está trabajando en esto.

Desde el 19/10/2026.

  • #57065 de @Veld101 — abierto

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
72/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
typescript
Área
ai, backend

Línea de trabajo

Empieza por la lógica de inserción de recordatorios en packages/core/src/plugin/plan.ts, especialmente por la ubicación del mensaje que se muestra en el issue, y luego revisa los casos relacionados en plan.test.ts. Reproduce el recordatorio de usuario final después de un cambio dirigido por una herramienta y comprueba cómo se comportan los recordatorios persistidos al reintentar. El trabajo estará terminado cuando el recordatorio permanezca en el orden correcto sin dejar un turno de usuario vacío al final y pasen las pruebas de plan.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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

Lenguaje dominante
TypeScript
Estrellas
215k
Forks
28.9k
Merge medio
8 h 27 min
PR fusionados (30 d)
282

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de anomalyco/opencode

Todos los issues de anomalyco/opencode

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.