Skip to content

Add per-repository automatic file approvals - #23

Merged
d3cker merged 1 commit into
develfrom
codex/repository-file-permissions
Sep 17, 2026
Merged

d3cker merged 1 commit into
develfrom
codex/repository-file-permissions

Conversation

@d3cker

@d3cker d3cker commented Sep 17, 2026

Copy link
Copy Markdown
Owner

Bot sessions run in isolated worktrees, so a request to access their primary checkout can trigger external_directory approval even when it belongs to the same repository. Per-session approval replies also do not carry over to a later round. Add an opt-in repository policy that handles these file requests across sessions without changing global OpenCode permissions.

  • Add autoApproveRepositoryFiles to project configuration and individual advanced repository entries. Interactive init asks whether to enable it (default no); --auto-approve-repository-files enables it noninteractively. Existing configurations retain their behavior.
  • Apply the policy to ask decisions for external_directory, read, and edit in bot sessions and native subagents. Every resource must resolve inside the configured checkout or the assigned worktree, including worktrees stored outside the checkout. Check canonical paths and existing parents of new files; leave sibling paths, symlink escapes, and unknown patterns to ordinary approval.
  • Retain explicit OpenCode denials, saved exact permission decisions, pending questions, media helper restrictions, and all shell/other action permissions. Generated worktree loaders carry the setting through restart and later rounds.
  • Update README, configuration/runtime/installation/advanced references, architecture, affected workflow diagrams, AGENTS.md, and the bundled bot prompt. Clarify that builds and tests must still use the assigned worktree.

Validation: npm run check passed (218 tests, lint, type checking, native TUI rendering, and build). Additional CLI and real Git worktree assertions passed with the focused setup/executor suite (21 tests); lint and type checking passed again after those test additions. All eight Mermaid diagrams parsed, 97 local documentation links passed, and git diff --check is clean.

For an existing repository, add "autoApproveRepositoryFiles": true to its .opencode/automation.json, restart the idle service, and reactivate the owner. Already-pending questions still require their explicit reply. This branch has not been deployed to the test server and does not address the separate provider rejection of tools: [].

@d3cker
d3cker merged commit 49434c9 into devel Sep 17, 2026
2 checks passed
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.

1 participant