Skip to content

Permission check for tool-output directory never matches, causes hang in headless mode #7876

Closed as not planned

Description

@Th0rgal

When running in headless/automated mode (e.g. ralph loops), opencode hangs indefinitely when trying to read truncated tool output.

The issue is in agent.ts - the allow rule for Truncate.DIR uses the directory path directly, but external-directory.ts creates patterns with /* appended. The wildcard matching fails and falls through to "ask", which hangs without a UI.

Logs show:

pattern=/Users/thomas/.local/share/opencode/tool-output/*
action={"pattern":"*","action":"ask"} evaluated

The rule pattern is /tool-output but the requested pattern is /tool-output/*.

Activity

  1. github-actions commented on Jan 11, 2026

    @github-actions
    Contributor

    This issue might be related to a previously reported problem:

    While #7758 was closed and focused on a different directory access pattern, both issues involve permission rule matching for internal opencode directories. The root cause in #7758 involved pattern matching logic and containment checks that might have similarities to the wildcard matching issue described here.

    Feel free to ignore if your specific case (tool-output directory pattern mismatch with wildcards) is distinct from that closed issue.

  2. rekram1-node commented on Jan 13, 2026

    @rekram1-node
    Contributor

    I did a tweak that was kinda ugly that I think fixes this

  3. TomLucidor commented on Jan 20, 2026

    @TomLucidor

    Directory issues and other tool call bugs are always annoying ngl, maybe there are ways to fuzzy-checking them beforehand?

  4. dhowe commented on Mar 22, 2026

    @dhowe

    status?

  5. github-actions commented on May 22, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

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