Skip to content

Conversation

@Th0rgal
Copy link

@Th0rgal Th0rgal commented Jan 11, 2026

Fixes #7876

external-directory.ts appends /* when creating permission patterns, but agent.ts was setting the allow rule without it. The patterns never matched, so permission requests fell through to "ask" and hung in headless mode.

Changed agent.ts to use ${Truncate.DIR}/* instead of Truncate.DIR.

Tested by running the agent tests (bun test agent.test.ts).

The `external_directory` permission for `Truncate.DIR` was not matching
because `external-directory.ts` creates glob patterns with `/*` suffix
(e.g., `/Users/thomas/.local/share/opencode/tool-output/*`) but the
allow rule was using the directory path without the suffix.

This caused permission requests to fall through to the default "ask"
action, which would hang indefinitely in headless/automated contexts
(like ralph loops) where there's no UI to respond to the permission
prompt.

The fix updates the permission pattern in `agent.ts` to include the
`/*` suffix to match the actual patterns being requested.
@github-actions
Copy link
Contributor

Hey! Your PR title Fix permission pattern mismatch for tool-output directory doesn't follow conventional commit format.

Please update it to start with one of:

  • feat: or feat(scope): new feature
  • fix: or fix(scope): bug fix
  • docs: or docs(scope): documentation changes
  • chore: or chore(scope): maintenance tasks
  • refactor: or refactor(scope): code refactoring
  • test: or test(scope): adding or updating tests

Where scope is the package name (e.g., app, desktop, opencode).

See CONTRIBUTING.md for details.

@github-actions
Copy link
Contributor

The following comment was made by an LLM, it may be inaccurate:

No duplicate PRs found

@Th0rgal Th0rgal changed the title Fix permission pattern mismatch for tool-output directory fix: permission pattern mismatch for tool-output directory Jan 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

1 participant