Skip to content

Rescue forwarding contract: permissions, backgrounding, timeouts #17

Closed

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

Activity

  1. changed the title [-]opencode:rescue subagent has no Bash permission in background mode[/-] [+]Rescue forwarding contract: permissions, backgrounding, timeouts[/+] on Apr 12, 2026
  2. JohnnyVicious commented on Apr 12, 2026

    @JohnnyVicious
    OwnerAuthor

    Consolidating related rescue-forwarder issues here: #16 covers run_in_background/worktree cleanup, #37 covers foreground calls timing out before OpenCode finishes, and #39 covers the rescue agent model tier. A single rescue forwarding contract should settle whether the plugin keeps the subagent, inlines the companion call, how backgrounding works, and what minimal model/tier is required if an agent remains.

  3. added 2 commits that reference this issue on Apr 13, 2026
    e3fdc90
    9a177ee
  4. added a commit that references this issue on Apr 13, 2026
    b95549e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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