GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — feat(plugin): let plugins assert permissions by rekram1-node · Pull Request #54930 · anomalyco/opencode

Conversation

@rekram1-node

@rekram1-node rekram1-node commented Oct 12, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

Summary

Plugins had no in-process way to ask for permission. Built-in tools call Permission.assert, but the plugin permission domain only exposed list, get, reply, and the evaluate hook. The HTTP session.permission.create route doesn't wait for the reply, and a plugin can't reliably reach its own server anyway. V1 plugin tools had ctx.ask; V2 had no equivalent.

This adds ctx.permission.assert to the plugin context, for both Effect and Promise plugins. It goes through the same permission engine as built-in tools: configured rules, saved "always allow" decisions, and the native approval prompt.

The input is a new AssertInput schema in packages/plugin/src/permission.ts, shared by both plugin flavours like options.ts, and built from the canonical Permission.Request fields: sessionID, action, resources, and optional agent, save, metadata, source. Effect plugins use its typed form; Promise plugins use its encoded form (plain strings), which the adapter decodes with the same schema.

Outcomes:

Outcome Effect plugins Promise plugins
Allowed succeeds resolves
Deny rule fails with Tool.Error (BlockedError attached) rejects with that Tool.Error
Rejected with feedback fails with Tool.Error (feedback as message, CorrectedError attached) rejects with that Tool.Error
Plain rejection defect, so the step ends, as with built-in tools rejects with DeclinedError; rethrowing it from a tool ends the step (#54913)

Failing with Tool.Error matches the tool error type, so an Effect tool can yield* the call without mapping errors, and tool.execute.before hooks can use it to gate a call. No error classes are added to @opencode/schema.

Addresses the in-process request in #52540 and the plugin-side gating in #37164. A tool-context shortcut and enforcing options.permission for tools that never assert (#50652, #47177) are left for follow-ups.

Tests

packages/core/test/plugin/permission-assert.test.ts covers both plugin flavours against a permission service that returns each outcome: input forwarding (including decoding plain Promise input), deny and feedback becoming Tool.Error with the original attached, and a plain rejection staying a decline.

The core plugin and permission tests pass, and so does typecheck, apart from one existing @opencode/app error that is also on dev.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Base automatically changed from promise-tool-errors to dev October 12, 2026 20:37
@rekram1-node
rekram1-node force-pushed the plugin-permission-assert branch from ce4f9d8 to bb374d1 Compare October 12, 2026 20:50
@opencode-agent opencode-agent Bot mentioned this pull request Oct 13, 2026
session.prompt hook has no reject-with-message — throw yields empty HTTP 500 #55212
Open
rekram1-node added 2 commits October 13, 2026 20:03
@rekram1-node
feat(plugin): let plugins assert permissions
4a3a2f2
@rekram1-node
refactor(plugin): give permission assert its own input schema
3f9a520
@rekram1-node
rekram1-node force-pushed the plugin-permission-assert branch from bb374d1 to 3f9a520 Compare October 14, 2026 01:06
@rekram1-node
refactor(plugin): share permission assert input from the package root
08fff24
@rekram1-node
rekram1-node merged commit 6a7cedc into dev Oct 14, 2026
10 of 11 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@rekram1-node
rekram1-node deleted the plugin-permission-assert branch October 14, 2026 01:28
This was referenced Oct 14, 2026
courier_answer: have OpenCode ask the person before an allow is passed on (permission.assert, 2.0.29) ivopogace/opencode-courier#164
Closed
Move the plugin API pin to @opencode/[email protected] ivopogace/opencode-courier#165
Merged
@QuaanNguyen QuaanNguyen mentioned this pull request Oct 14, 2026
Define bordercollie behavior under OpenCode v2.0.28 per-project auto-accept permissions QuaanNguyen/xor#66
Closed
This was referenced Oct 14, 2026
docs(plugin): document permission assert and fix session rules example #55526
Merged
[FEATURE]: Plugins cannot raise a permission request in-process on v2 #52540
Closed
OpenCode V2: bash operation refused because host does not provide a permission request endpoint #50584
Closed
feat(plugin): let tool.execute.before request native permission approval #37164
Closed
@erikengervall erikengervall mentioned this pull request Oct 15, 2026
Confirm Alexandria runs through OpenCode 2 permissions firecrawl/opencode-firecrawl#6
Merged
Bewinxed added a commit to Bewinxed/cawco that referenced this pull request Oct 15, 2026
@Bewinxed @claude
Caw's OpenCode shell reaches the hub's gate: 2.0's action names, and …
052a10f
…OpenCode 2.0.29's permission assert

Caw on OpenCode ran his shell without the hub's gate deciding it:
- LEAD_GATED_TOOLS.opencode named `bash`, 1.x's action. 2.0's is `shell`
  ("In V2, use permissions, shell, and subagent instead of permission, bash,
  and task", opencode.ai/v2/docs/permissions). The agent's `#asked` matched
  his asks against it (opencode-session.ts LEAD_ASKED), so a `shell` ask was
  answered by his permission mode. The hub's LEAD_SHELL_TOOLS read `bash` too.
- In his place the plugin's replacing `shell` never asked at all: 2.0.28 gave
  plugins no way to ("Plugins had no in-process way to ask for permission.
  Built-in tools call Permission.assert, but the plugin permission domain only
  exposed list, get, reply, and the evaluate hook", anomalyco/opencode#54930,
  shipped in 2.0.29).

Now:
- core LEAD_GATED_TOOLS.opencode is ["shell", "edit"] (2.0's `edit` covers
  write and patch), and LEAD_SHELL_TOOLS is {Bash, shell}. The other 1.x
  `bash` names a 2.0 shell call meets are 2.0's too: hub web-reads SHELLS
  (a shell's URL makes a wake external, which the gate reads), continuation
  SHELL_TOOLS and the permission card's presentation (pi keeps `bash`). The
  denied-tool lists stay in Claude's names, which opencodeToolsFor maps to
  2.0's actions (Bash→shell, Agent→subagent).
- OpenCode is pinned to 2.0.29: core OPENCODE_VERSION, the one pin (the tool
  catalog's exactVersion, the adapter's start check, the install command), and
  @opencode/client 2.0.29. The repo has no @opencode/plugin dependency: the
  plugin is generated JavaScript.
- The plugin's `shell`, for a session bounded by a workspace (a delegate in a
  clone, Caw in his place), asks first through ctx.permission.assert: action
  `shell`, the command as its resource and in its metadata (the gate reads
  `command`), save the command, the call as its source. A deny or rejection
  throws and nothing runs. A person's session in a lead's place still runs the
  built-in, which asks on its own. No shell call runs without an ask.

2.0.29's other changes the adapter meets (v2.0.28...v2.0.29): a Promise
`execute.before` rejection is now that call's own Tool.Error (#55263); a
response cut at its output limit is continued with a synthetic user message
"Your last response hit the output token limit (stop reason: length)..."
(#53876); top-level `policies` replace `experimental.policies` (#55297), which
the adapter does not write; managed config wins (#55267).

Probe-kit caw-hands: `CAW_HARNESS=opencode` runs a, s, b and a new r with
Caw on OpenCode: `rm notes.txt` raises the card and Deny keeps the file; a
read-only `cat notes.txt` runs with no card. It needs a real boundary. In this
workspace, on 2.0.29: carry-live case 5 ALL PASS (a person's OpenCode shell
through the built-in on the host), send-backgrounds ALL PASS (claude,
opencode, pi).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@marius-kilocode marius-kilocode mentioned this pull request Oct 16, 2026
chore(upstream): sync v2.0.30 (775d1d0d713) Kilo-Org/kilocode#15136
Merged
@opencode-agent opencode-agent Bot mentioned this pull request Oct 17, 2026
[FEATURE]: Add a skip field to tool.execute.before (for deterministic pre-execution gating) #52837
Closed
1 task done
@QuaanNguyen QuaanNguyen mentioned this pull request Oct 19, 2026
Switch Preferences to free-form natural language with approve/deny/ask verdicts QuaanNguyen/xor#70
Open
10 tasks
@opencodejr opencodejr Bot mentioned this pull request Oct 28, 2026
External plugin tools bypass configured permissions #50652
Open
@nb-99 nb-99 mentioned this pull request Nov 22, 2026
Approve deletes inside agent scratch roots without a model review nb-99/opencode-secret-guard#47
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

1 participant

@rekram1-node
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.