Skip to content

Record that a saved always-allow overrides a permission ask - #580

Merged
aanbrn merged 1 commit into
mainfrom
record-saved-allow-override
Oct 15, 2026
Merged

aanbrn merged 1 commit into
mainfrom
record-saved-allow-override

Conversation

@aanbrn

@aanbrn aanbrn commented Oct 15, 2026

Copy link
Copy Markdown
Owner

Summary

Corrects a false AGENTS.md gotcha and records the real mechanism behind a permission guard that stops
prompting. .opencode/opencode.json is unchanged — the "git push *": "ask" rule stays.

The gotcha claimed anchoring makes "a bare, argumented, or chained push still ask". It doesn't — not because the
rule is inert, but because a saved "always" allow overrides it: OpenCode's engine appends the saved allow rules
after the config rules and takes the last match (findLast), and v2 persists those rows per project in its DB
although the docs call "always" session-only. So a guard that never prompts is a saved row until proven otherwise;
the clause now says to check or clear it before changing the rule, explains the findLast precedence, and tracks
anomalyco/opencode#48456 (open) — with #50600 (open) asking for session-scoped or resettable approvals — and a
close-out for when a saved allow stops overriding a configured ask.

This is a docs unit — no OpenSpec change dir (skip_specs: the change corrects a gotcha and records a mechanism,
adds no behavior; no agent-skills statement describes permission precedence).

The upstream gap was already filed, so no duplicate is created: our concrete end-to-end reproduction (which #48456
says it lacked) was posted as a comment there.

Test plan

  • ./gradlew check -PskipITs -Pcoverage.gate.enabled=false — green
  • spotlessApply run after the final edit; spotlessCheck/verifyCapturedMarkers green
  • Docs refresh — no change dir; .opencode/opencode.json byte-identical to HEAD
  • The per-unit lesson-capture ran and returned nothing durable (net 0) — the mechanism is the diff itself
  • The pre-write derivation pass ran; claims table below

Claims table

Claim Source
The engine appends saved allows after config rules and takes the last match, so a saved allow overrides a config ask packages/core/src/permission.ts at tag v2.0.29: evaluate → rulesets.flat().findLast(…); evaluateInput → const all = [...rules, ...(yield* savedRules())]
A saved git push * allow existed for this project sqlite3 -readonly ~/.local/share/opencode/opencode.db "SELECT project_id, action, resource FROM permission WHERE action='shell' AND resource='git push *'" → f27375c7…|shell|git push * (created 2026-10-10; deleted as part of this change)
v2 persists "always" per project though the docs call it session-only the DB row above persists across sessions; the permissions docs say "always — … (for the rest of the current OpenCode session)"
The repository keeps "git push *": "ask" .opencode/opencode.json (unchanged)
The gap is owned upstream; our reproduction was posted anomalyco/opencode#48456 (open) body + the comment posted from this change

Review rounds: docs/review-rounds.tsv rows for record-saved-allow-override (1–4) and issue-48456-comment
(1–4).

Not verified in-session: whether the guard prompts again after clearing the saved row. This session does not
surface permission asks — a dedicated git push and a read of an unmatched external path both ran without a prompt —
so the re-arming should be confirmed in a fresh OpenCode session.

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.
@aanbrn
aanbrn merged commit 10cd623 into main Oct 15, 2026
1 check passed
@aanbrn
aanbrn deleted the record-saved-allow-override branch October 15, 2026 05:43
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