Summary
plugins/opencode/commands/rescue.md declares allowed-tools: Bash(node:*), which permits Bash in the command's own execution context. But Claude Code does not propagate allowed-tools to subagents the command spawns, and plugin subagents cannot use permissionMode: bypassPermissions. As a result, when /opencode:rescue --background is used, the opencode:opencode-rescue subagent is spawned in background mode where permission prompts are impossible and Bash is auto-denied. The subagent returns a permission error instead of running OpenCode.
Options
A. Eliminate the subagent layer (simplest). The rescue subagent is a thin forwarder — it makes exactly one Bash call to opencode-companion.mjs task .... Inline that call directly in commands/rescue.md, which already has Bash(node:*), and delete plugins/opencode/agents/opencode-rescue.md. This also avoids the worktree hang tracked in the companion issue for openai/codex-plugin-cc#198.
B. Promote rescue agent to ~/.claude/agents/ at setup. Extend handleSetup in opencode-companion.mjs to copy agents/opencode-rescue.md into ~/.claude/agents/ with permissionMode: bypassPermissions injected. Regular user-level agents support permissionMode, so the subagent would then work in background mode. Add a hash/version check so re-running /opencode:setup refreshes the copy.
Option A is cheaper and has no "did the user run setup?" dependency.
Upstream references
openai/codex-plugin-cc#94 (bug) + #101 (proposed promote-to-agents fix).
Summary
plugins/opencode/commands/rescue.mddeclaresallowed-tools: Bash(node:*), which permits Bash in the command's own execution context. But Claude Code does not propagateallowed-toolsto subagents the command spawns, and plugin subagents cannot usepermissionMode: bypassPermissions. As a result, when/opencode:rescue --backgroundis used, theopencode:opencode-rescuesubagent is spawned in background mode where permission prompts are impossible and Bash is auto-denied. The subagent returns a permission error instead of running OpenCode.Options
A. Eliminate the subagent layer (simplest). The rescue subagent is a thin forwarder — it makes exactly one Bash call to
opencode-companion.mjs task .... Inline that call directly incommands/rescue.md, which already hasBash(node:*), and deleteplugins/opencode/agents/opencode-rescue.md. This also avoids the worktree hang tracked in the companion issue for openai/codex-plugin-cc#198.B. Promote rescue agent to
~/.claude/agents/at setup. ExtendhandleSetupinopencode-companion.mjsto copyagents/opencode-rescue.mdinto~/.claude/agents/withpermissionMode: bypassPermissionsinjected. Regular user-level agents supportpermissionMode, so the subagent would then work in background mode. Add a hash/version check so re-running/opencode:setuprefreshes the copy.Option A is cheaper and has no "did the user run setup?" dependency.
Upstream references
openai/codex-plugin-cc#94 (bug) + #101 (proposed promote-to-agents fix).