Skip to content

docs: clarify that permission "always" approvals persist per project - #58154

Open
opencode-agent[bot] wants to merge 1 commit into
devfrom
permission-always-scope
Open

opencode-agent[bot] wants to merge 1 commit into
devfrom
permission-always-scope

Conversation

@opencode-agent

@opencode-agent opencode-agent Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

The permissions docs said an always approval lasts "for the rest of the current OpenCode session". It doesn't: approvals are saved to the permission table for the current project and persist across sessions and restarts.

Changes to packages/web/src/content/docs/permissions.mdx ("What “Ask” Does"):

  • always is now described as saved for the current project and persisting across sessions and restarts.
  • Added that shell approvals match by command pattern, regardless of the working directory.
  • Added that saved approvals can be listed and removed through the server API (GET /api/permission/saved, DELETE /api/permission/saved/:id).
  • Fixed the example pattern from git status* to the actual saved form, git status *.

Checked against:

  • packages/core/src/permission.ts: replying always calls PermissionSaved.add with location.project.id. Evaluation appends that project's saved rules as allow after configured rules, and configured deny rules are checked first.
  • packages/core/src/permission/sql.ts and saved.ts: a durable permission table keyed by project_id, with a unique index on project_id + action + resource.
  • packages/core/src/shell/parse.ts and packages/core/src/tool/plugin/shell.ts: the shell tool saves ${prefix(tokens).join(" ")} *, which contains no working directory.
  • packages/protocol/src/groups/permission.ts and packages/server/src/handlers/permission.ts: the permission.saved.list, update and remove endpoints.

Translated docs are not updated here, since the locale sync workflow is currently disabled.

Related to #51279 (closed).

Requested by: @rekram1-node (Aiden Cline via Slack)


Added by the opencode bot (AI-generated).

Related: #48456, #50600

@opencode-agent opencode-agent Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The updated wording matches the code. I checked it against permission.ts (always saves the rule for location.project.id, and saved rules are added as allow after the configured rules), the shell save pattern in shell/parse.ts (<prefix> *, with no working directory), and the permission.saved.* endpoints. This is a docs-only change, so there was nothing to run.

Public API: unchanged (docs only).

One gap is worth closing: see the inline comment about saved approvals overriding configured ask rules.

Related: #48456, #50600


- `once` — approve just this request
- `always` — approve future requests matching the suggested patterns (for the rest of the current OpenCode session)
- `always` — approve future requests matching the suggested patterns (saved for the current project, so they persist across sessions and restarts)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Worth adding that a saved approval overrides a configured ask rule. Saved rules are added as allow after the configured rules, so only a configured deny still blocks the action. That is the part users find most surprising (see #48456 and #50600), and right now the page only says approvals persist.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant