diff --git a/packages/core/src/plugin/provider/claude-agent/claude/query-options.ts b/packages/core/src/plugin/provider/claude-agent/claude/query-options.ts index d165206df01..b273ee92043 100644 --- a/packages/core/src/plugin/provider/claude-agent/claude/query-options.ts +++ b/packages/core/src/plugin/provider/claude-agent/claude/query-options.ts @@ -16,6 +16,7 @@ const ISOLATION_ENV = { ENABLE_TOOL_SEARCH: "false", CLAUDE_CODE_DISABLE_ADVISOR_TOOL: "1", CLAUDE_CODE_DISABLE_NONSTREAMING_FALLBACK: "1", + CLAUDE_CODE_DISABLE_REFUSAL_FALLBACK: "1", // Raised so opencode's own truncation applies instead MAX_MCP_OUTPUT_TOKENS: "200000", // Skips OAuth, so the subscription would not be used diff --git a/specs/v2/claude-agent-provider.md b/specs/v2/claude-agent-provider.md index fc080c5e22c..f71aa3b0067 100644 --- a/specs/v2/claude-agent-provider.md +++ b/specs/v2/claude-agent-provider.md @@ -53,6 +53,7 @@ Claude Code reads none of the user's Claude settings. The plugin passes every se - Tool search. Claude Code hides MCP tools until Claude searches for them. All of opencode's tools reach Claude as MCP tools, so this would hide every one of them. Opencode also has native tool deferral through codemode for normal MCPs. - The advisor tool. Claude can ask a stronger model for advice in the middle of a task, using the user's plan. opencode could not show or control these calls. - The non-streaming fallback. When a stream fails partway, Claude Code retries without streaming, and opencode would hang waiting for the step to end. +- The refusal fallback. When a safety classifier flags a request, Claude Code switches the session to another model, so the model running would no longer match the one picked in opencode. We also clear three variables a user might have set in their shell. `CLAUDE_CODE_SIMPLE` would skip the subscription login. `CLAUDE_CODE_EFFORT_LEVEL` would override the effort chosen in opencode. `MCP_TOOL_TIMEOUT` would cap every opencode tool call, failing subagents and permission prompts that run longer.