Skip to content

Non-interactive opencode run hangs forever when a subagent tool hits a permission=external_directory ask (v1.18.18) #43888

Closed as duplicate

Description

@CaioCavalcanti

Non-interactive opencode run hangs forever when a subagent tool hits a permission=external_directory ask (v1.18.18)

Environment

  • OpenCode version: v1.18.18
  • Command: opencode run --format json --auto (non-interactive mode)
  • Working directory: Anchored to a directory outside the project (via --dir or PWD)

Reproduction Steps

  1. Run opencode run --format json --auto with the current working directory set to a path outside the project root (e.g., /tmp/ai-harness-*/workspace).
  2. During execution, a subagent delegates and uses a file tool (e.g., Write) to touch a path classified as an external directory.
  3. The permission resolution yields action=ask for permission=external_directory.
  4. Observe the log line: asking id=per_… permission=external_directory.

Observed Behavior

  • The tool part stays in status:"running" state indefinitely.
  • The parent OpenCode run never times out; it hangs forever until the process is killed externally.
  • Top-level sessions can resolve their own ask permissions via OPENCODE_ASK_ALLOW env var, but subagent delegation hangs because the non-interactive mode cannot prompt for user input.
  • No error is surfaced; the child process never exits.

Expected Behavior

In non-interactive mode, ask permissions should:

  • Time out after a reasonable period.
  • Auto-deny and surface an error to continue execution.
  • Or respect a OPENCODE_ASK_ALLOW/OPENCODE_ASK_DENY pattern consistent across top-level and subagent contexts.

Workaround

Set an explicit allow rule in opencode.json:

{
  "permission": {
    "external_directory": {
      "/tmp/ai-harness-*": "allow"
    }
  }
}

This bypasses the ask and prevents the hang.

Activity

  1. github-actions commented on Aug 21, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions