Skip to content

[FEATURE]:permissions: external_directory approval prompt lacks explicit scope choice (folder only vs including subfolders) #56807

Open

Description

@znanovik

Feature hasn't been suggested before.

  • I have verified this feature I'm about to request hasn't been suggested before.

Describe the enhancement you want to request

Summary

When external_directory permissions are configured to ask, each access to a
different external (sub)directory triggers a new approval prompt. The prompt
offers no explicit scope choice and does not explain what "Allow always" will
save, so it is unclear whether one approval covers the granted folder and all
its subfolders. Request: make the prompt state the scope of each choice and/or
offer "this folder only" vs "this folder including all subfolders".

Environment

  • opencode version: v2.0.32
  • OS: Windows 11 (10.0.26200), win32 x64
  • Terminal: Unavailable (terminal env vars not set from CLI probe)
  • Shell: Windows PowerShell
  • Install/channel: latest release
  • Active plugins: -opencode.config.compatibility; local plugin
    file:///…/agent-os-opencode (Agent OS hook bridge)

Reproduction

  1. Global opencode.json (the exact rule the V1→V2 migration guide
    recommends to restore V1-like behavior):
    "permissions": [
      { "action": "external_directory", "resource": "*", "effect": "ask" }
    ]
  2. Start the TUI in a project. Ask the agent to read a file in a sibling external folder → approval prompt appears.
  3. Approve with "Allow once".
  4. Ask the agent to read a file in a different subdirectory under the same external folder (or in its parent) → a new prompt appears per new boundary directory.
    Reproducible consistently (reported by the user who configured the rule).

Expected Behavior

The approval prompt states the scope explicitly, e.g. "this folder only" / "this folder and all subfolders", scoped to the current project.
Alternatively, "Allow always" should visibly save a pattern covering the confirmed directory tree. Per the matching rules (* includes /), a saved dir/* pattern is already recursive over the subtree — but at approval time none of this is communicated.

Actual Behavior

After "Allow once", every new external subfolder triggers a fresh prompt. The user reads this as "grant covers only this exact folder, without its subfolders", which breaks the common mental model "giving access to a folder includes its subtree".
It is not visible from the prompt what pattern "Allow always" will save. During the reporter's test the project-scoped saved-permission storage remained empty (as documented for "Allow once"), so the exact proposed pattern could not be observed.

Additional Context

The permissions guide states: "Allow always: Approve it and save the tool's proposed patterns for the project", and external_directory resources are "normally ending in /*". The gap is purely at the approval UX level.
Since the migration guide explicitly recommends adding this rule, migrated users will meet this prompt routinely.
This is an enhancement request about menu wording/UX, not a malfunction of rule evaluation.

Activity

  1. opencode-agent commented on Oct 18, 2026

    @opencode-agent
    Contributor

    Thanks for the detailed write-up! Your request: make the external_directory approval prompt say what each choice covers, and possibly offer "this folder only" vs "this folder and all subfolders", so it's clear whether approving a folder includes its subfolders.

    Some context from the current v2 code:

    • Each prompt asks for <folder>/*, the folder of the file being accessed, and that is shown under Patterns. With the * matching rules, this covers the folder's subfolders too.
    • Allow once only approves that one request, so the next new folder prompts again.
    • If you move the selection to Always allow without confirming, the prompt shows the pattern(s) it will save: the external folder's project root if it has one, otherwise the folder itself, followed by /*. This is easy to miss, and the prompt never says that subfolders are included.

    Maintainers will consider how to make this clearer.

    Related issues:

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions