Skip to content

Commit 10cd623

Browse files
authored
Record that a saved always-allow overrides a permission ask (#580)
A permission guard that never prompts is a saved allow, not a broken rule: OpenCode appends saved always-allow rules after the config rules and evaluates the last match (findLast), and v2 persists those rows per project in its DB though the docs call them session-only. The gotcha that claimed a bare, argumented, or chained git push still asks was false for that reason; it now records the override, how to check or clear it, and tracks anomalyco/opencode#48456 with a close-out.
1 parent 23569f1 commit 10cd623

2 files changed

Lines changed: 20 additions & 7 deletions

File tree

‎AGENTS.md‎

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3001,17 +3001,22 @@ capture-stash-stale-copy
30013001
- **An unanswered `ask` hangs an unattended run — anchor a `bash`/`shell` permission pattern to the parsed command, and
30023002
bound the job.** OpenCode emits one pattern per parsed `command` node, so a whole-command-string guard
30033003
(`"*git push*"`) also matches a read-only command that merely quotes the phrase (`grep … "git push"`); anchor it
3004-
(`"git push *": "ask"`) so a bare, argumented, or chained push still asks while the quote does not. The action's
3005-
handler denies only the `question` permission, so resolve each binary's ask-defaults — the cloud (v1) binary asks for
3006-
`read` `.env`, `external_directory`, and `doom_loop`, the local (v2) binary for `read` `.env` only — to `allow`/`deny`
3007-
in the config the action uses, and bound each unattended job with `timeout-minutes` — a scheduled `audit` hung 2h13m
3008-
on a `bash` rule, and `/oc` runs were cancelled at 42m and 17m on `external_directory` asks. Deny only a default whose
3009-
internal allows the config can re-express, since a config rule is appended last and overrides a default:
3004+
(`"git push *": "ask"`). A **saved "always" allow overrides the rule**: the engine appends the saved rules after the
3005+
config rules and takes the last match (`findLast`, `packages/core/src/permission.ts`), and v2 persists "always" per
3006+
project in the DB's `permission` table though the docs call it session-only — so a guard that never prompts is a saved
3007+
row until proven otherwise; check or clear it before changing the rule (saved rows are per-project in that table).
3008+
Tracked upstream as `anomalyco/opencode#48456` (open; `#50600` asks for session-scoped or resettable approvals);
3009+
retires when a saved allow stops overriding a configured `ask`. The action's handler denies only the `question`
3010+
permission, so resolve each binary's ask-defaults — the cloud (v1) binary asks for `read` `.env`,
3011+
`external_directory`, and `doom_loop`, the local (v2) binary for `read` `.env` only — to `allow`/`deny` in the config
3012+
the action uses, and bound each unattended job with `timeout-minutes` — a scheduled `audit` hung 2h13m on a `bash`
3013+
rule, and `/oc` runs were cancelled at 42m and 17m on `external_directory` asks. Deny only a default whose internal
3014+
allows the config can re-express, since a config rule is appended after the binary's defaults and overrides them:
30103015
`external_directory`'s `*` cannot be denied (it would override v1's scratch/skill/reference allows, which `expand()` —
30113016
only `~`/`$HOME` — cannot re-express), while denying `*.env.*` needs `*.env.example` re-allowed. Reported upstream as
30123017
`anomalyco/opencode#54477` (declined for v1 — `wont_fix`); retires when the handler resolves a non-`question` `ask`
30133018
(or fails the run on an unanswerable prompt). captured: fix-unattended-permission-hang captured:
3014-
harden-cloud-runs-against-ask-hangs
3019+
harden-cloud-runs-against-ask-hangs captured: record-saved-allow-override
30153020

30163021
- **A generic getter's inferred type can bind an overloaded call to the wrong overload — cast to the erased type, and
30173022
verify the binding, not the source.** `Session.get` is generic (`<T> T get(String)`), so

‎docs/review-rounds.tsv‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,3 +145,11 @@
145145
2026-10-15 decide-against-pre-review 1 coherence,single-sourcing,claim-unreproducible,claim-missing,missing-task - 5
146146
2026-10-15 decide-against-pre-review 2 single-sourcing single-sourcing 1
147147
2026-10-15 decide-against-pre-review 3 - - 0
148+
2026-10-15 record-saved-allow-override 1 premise,over-claim,coherence,wording,missing-task - 3
149+
2026-10-15 record-saved-allow-override 2 missing-task,claim-unreproducible missing-task 2
150+
2026-10-15 record-saved-allow-override 3 wording wording 1
151+
2026-10-15 record-saved-allow-override 4 - - 0
152+
2026-10-15 issue-48456-comment 1 claim-unreproducible,wording - 2
153+
2026-10-15 issue-48456-comment 2 claim-unreproducible,wording claim-unreproducible,wording 2
154+
2026-10-15 issue-48456-comment 3 claim-unreproducible claim-unreproducible 1
155+
2026-10-15 issue-48456-comment 4 - - 0

0 commit comments

Comments
 (0)