Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

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

Đang mở Phù hợp với người mới
#57,013 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

@Veld101 đang làm issue này rồi.

Từ ngày 19/10/2026.

  • #57065 của @Veld101 — đang mở

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
72/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
typescript
Lĩnh vực
ai, backend

Hướng nghiên cứu

Bắt đầu với logic chèn lời nhắc trong packages/core/src/plugin/plan.ts, đặc biệt là vị trí thông báo được hiển thị trong issue, sau đó kiểm tra các trường hợp liên quan trong plan.test.ts. Tái hiện lời nhắc cuối của người dùng sau một lần chuyển đổi do công cụ điều khiển và kiểm tra cách các lời nhắc đã lưu tồn tại hoạt động khi thử lại. Hoàn thành khi lời nhắc vẫn đúng thứ tự, không để lại lượt người dùng trống ở cuối, và các bài kiểm tra plan đều đạt.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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

Ngôn ngữ chính
TypeScript
Star
215k
Fork
28.9k
Merge trung bình
6 giờ 8 phút
Pull request đã merge (30 ngày)
411

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của anomalyco/opencode

Tất cả issue của anomalyco/opencode

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.