Skip to content

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

@Th0rgal

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/*.

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