Repository navigation
Record that a saved always-allow overrides a permission ask - #580
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Corrects a false
AGENTS.mdgotcha and records the real mechanism behind a permission guard that stopsprompting.
.opencode/opencode.jsonis 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 DBalthough 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
findLastprecedence, and tracksanomalyco/opencode#48456(open) — with#50600(open) asking for session-scoped or resettable approvals — and aclose-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-skillsstatement 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— greenspotlessApplyrun after the final edit;spotlessCheck/verifyCapturedMarkersgreen.opencode/opencode.jsonbyte-identical toHEADlesson-captureran and returned nothing durable (net 0) — the mechanism is the diff itselfClaims table
askpackages/core/src/permission.tsat tagv2.0.29:evaluate→rulesets.flat().findLast(…);evaluateInput→const all = [...rules, ...(yield* savedRules())]git push *allow existed for this projectsqlite3 -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)"git push *": "ask".opencode/opencode.json(unchanged)anomalyco/opencode#48456(open) body + the comment posted from this changeReview rounds:
docs/review-rounds.tsvrows forrecord-saved-allow-override(1–4) andissue-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 pushand a read of an unmatched external path both ran without a prompt —so the re-arming should be confirmed in a fresh OpenCode session.