Repository navigation
Conversation
Fixes anomalyco#40150. `write:` blocks in opencode.json parse cleanly (the permission schema has a catch-all record) but are never consulted -- write.ts asks under `edit`, and there is no `permission: "write"` anywhere in src. Document that edit already covers write/patch, and warn generally that unknown permission keys silently no-op instead of erroring. Claude-Session: https://claude.ai/code/session_01T4ATBBxLWWrWEP9PkKqVSY
Contributor
|
Automated PR Cleanup Thank you for contributing to opencode. Due to the high volume of PRs from users and AI agents, we periodically close older PRs using automated criteria so maintainers can focus review time on the most active and community-supported contributions. This PR was closed because it matched the following cleanup criteria:
PRs created within the last month are not affected by this cleanup. If you believe this PR was closed incorrectly, or if you are still actively working on it, please leave a comment explaining why it should be reopened. A maintainer can review and reopen it if appropriate. Thanks again for taking the time to contribute. |
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.
Issue for this PR
Closes #40150
Type of change
What does this PR do?
write:blocks inopencode.json/ agent frontmatter parse cleanly because the permission schema (packages/core/src/v1/config/permission.ts) has a catch-allSchema.Recordrest element, but nothing ever consults them:write.tsasks underpermission: "edit", and there is nopermission: "write"anywhere insrc. An operator writing"write": {"*.env": "deny"}gets no error and no effect — the block is silently inert.The issue thread converged on this being a documentation problem rather than a code one:
docs/permissions.mdxalready stateseditcoversedit,write, andpatch—writewas never meant to be a standalone key. Renaming whatwrite.tsasks under would contradict that design (and there's a second call site,permission/index.ts'seditsarray, that would need to move in lockstep to avoid a half-live fix). Introducing a general unknown-key diagnostic is tempting but riskier: any key that doesn't match a declared permission is legitimately used to gate MCP/custom tools by name ("mymcp_*": "deny"), so a blanket warning would need care to avoid false positives — a larger change than this specific, reported confusion warrants.This PR instead documents the trap directly:
:::cautionblock calling out thatwriteis not a permission key and file writes are already covered byedit.How did you verify your code works?
Docs-only change; verified against current
devthat the described behavior is accurate:packages/core/src/v1/config/permission.ts:19-33— nowritekey declared,Schema.Recordrest element present.packages/opencode/src/tool/write.ts:55— asks underpermission: "edit".packages/opencode/src/permission/index.ts:205—const edits = ["edit", "write", "apply_patch"].Screenshots / recordings
Not applicable (docs text only).
Checklist