mirror of
https://github.com/anomalyco/opencode.git
synced 2026-11-20 18:57:17 +03:00
fix(core): drop stale thinking when Claude Agent prompts or tools change (#63592)
This commit is contained in:
committed by
GitHub
Unverified
parent
ebf6e00ad3
commit
8921769577
@@ -19,6 +19,9 @@ const ISOLATION_ENV = {
|
||||
CLAUDE_CODE_DISABLE_REFUSAL_FALLBACK: "1",
|
||||
// Raised so opencode's own truncation applies instead
|
||||
MAX_MCP_OUTPUT_TOKENS: "200000",
|
||||
// OpenCode changes the system prompt and tools mid-session (agent switches, instruction edits). Without this,
|
||||
// Claude Code replays thinking bound to the old prompt and the API rejects the request.
|
||||
CLAUDE_CODE_POLISHED_DEWDROP: "drop",
|
||||
// Skips OAuth, so the subscription would not be used
|
||||
CLAUDE_CODE_SIMPLE: undefined,
|
||||
// A shell-level effort override would take precedence over OpenCode's live effort settings.
|
||||
|
||||
@@ -67,6 +67,7 @@ We also clear three variables a user might have set in their shell. `CLAUDE_CODE
|
||||
- Before the call: gives us Claude's ID for the call. Our tool handler can't see this ID, and opencode needs it to send back the right result. Because we only remember one ID at a time, tools must run one at a time, so we never mark them as safe to run in parallel.
|
||||
- After the call: adds PDFs and linked images from opencode's result, which a normal MCP tool result can't carry.
|
||||
- Thinking with summaries, so opencode has reasoning text to show
|
||||
- Dropping earlier thinking when the system prompt or tools change mid-session (`CLAUDE_CODE_POLISHED_DEWDROP=drop`). Without it the API rejects the next request, because each thinking block is tied to the prompt and tools it was made with.
|
||||
- Messages sent exactly as given. opencode already expands `/commands` and adds `@file` contents before sending, so Claude Code does not process them again. It also skips the context Claude Code normally adds at the start of each turn, such as nested CLAUDE.md files, skill lists and reminders. This needs Claude Code 2.1.248 or later.
|
||||
- A higher limit on tool output, so opencode's own truncation applies instead
|
||||
- Saved Claude sessions for chats, but not for side calls such as titles
|
||||
|
||||
Reference in New Issue
Block a user