opencode
opencode copied to clipboard
Permission check for tool-output directory never matches, causes hang in headless mode
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/*.