Skip to content

Rescue forwarding contract: permissions, backgrounding, timeouts #17

@JohnnyVicious

Description

@JohnnyVicious

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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions