Skip to content

docs(permissions): clarify write is not a permission key - #47352

Closed
kavish-19 wants to merge 1 commit into
anomalyco:devfrom
kavish-19:fix-write-permission-key-docs
Closed

kavish-19 wants to merge 1 commit into
anomalyco:devfrom
kavish-19:fix-write-permission-key-docs

Conversation

@kavish-19

@kavish-19 kavish-19 commented Sep 4, 2026 •

Copy link
Copy Markdown

Issue for this PR

Closes #40150

Type of change

  • Documentation
  • Bug fix
  • New feature
  • Refactor / code improvement

What does this PR do?

write: blocks in opencode.json / agent frontmatter parse cleanly because the permission schema (packages/core/src/v1/config/permission.ts) has a catch-all Schema.Record rest element, but nothing ever consults them: write.ts asks under permission: "edit", and there is no permission: "write" anywhere in src. 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.mdx already states edit covers edit, write, and patch — write was never meant to be a standalone key. Renaming what write.ts asks under would contradict that design (and there's a second call site, permission/index.ts's edits array, 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:

  • A :::caution block calling out that write is not a permission key and file writes are already covered by edit.
  • A sentence clarifying that unrecognized keys (in general) are matched as tool-name wildcards, and a key matching neither a declared permission nor a tool name silently does nothing.

How did you verify your code works?

Docs-only change; verified against current dev that the described behavior is accurate:

  • packages/core/src/v1/config/permission.ts:19-33 — no write key declared, Schema.Record rest element present.
  • packages/opencode/src/tool/write.ts:55 — asks under permission: "edit".
  • packages/opencode/src/permission/index.ts:205 — const edits = ["edit", "write", "apply_patch"].

Screenshots / recordings

Not applicable (docs text only).

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

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
@github-actions

github-actions Bot commented Oct 4, 2026

Copy link
Copy Markdown
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:

  • The PR was created more than 1 month ago
  • The PR had fewer than 2 positive reactions
  • Positive reactions are counted as thumbs-up, heart, celebration, or rocket reactions on the PR

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.

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.

write permission rules are silently ignored — write.ts asks under edit

1 participant