opencode icon indicating copy to clipboard operation
opencode copied to clipboard

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

Open Th0rgal opened this issue 3 days ago • 1 comments

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

Th0rgal avatar Jan 11 '26 23:01 Th0rgal