Skip to content

fix(opencode-plugin): show meaningful permission patterns in web UI#274

Merged
mrsimpson merged 1 commit into
mainfrom
fix/opencode-plugin-permissions
May 1, 2026
Merged

fix(opencode-plugin): show meaningful permission patterns in web UI#274
mrsimpson merged 1 commit into
mainfrom
fix/opencode-plugin-permissions

Conversation

@mrsimpson
Copy link
Copy Markdown
Collaborator

Summary

  • Replaces the generic patterns: ['*'] in the wrap() ask() call with tool-specific human-readable strings so the opencode web permission dialog shows useful context (e.g. target_phase: code, workflow: epcc) instead of just *
  • Adds a buildPermissionPatterns(toolName, args) helper in plugin.ts that maps each tool's arguments to descriptive "key: value" pattern strings
  • Removes dead-code ask() calls from all 5 tool handlers — they were auto-allowed by wrap()'s always: ['*'] grant and never shown to the user

Root Cause

The opencode web UI (session-permission-dock.tsx) only displays props.request.patterns. All tools were passing patterns: ['*'], causing the dialog to show only * with no context about what the tool was going to do.

Changes

  • packages/opencode-plugin/src/plugin.ts — Add buildPermissionPatterns() helper; update wrap() to use it and pass actual args as metadata
  • packages/opencode-plugin/src/tool-handlers/proceed-to-phase.ts — Remove redundant ask()
  • packages/opencode-plugin/src/tool-handlers/start-development.ts — Remove redundant ask()
  • packages/opencode-plugin/src/tool-handlers/conduct-review.ts — Remove redundant ask()
  • packages/opencode-plugin/src/tool-handlers/reset-development.ts — Remove redundant ask()
  • packages/opencode-plugin/src/tool-handlers/setup-project-docs.ts — Remove redundant ask()

Replace generic patterns: ['*'] in the wrap() ask() call with tool-specific
human-readable strings (e.g. 'target_phase: code', 'workflow: epcc') so the
opencode web permission dialog shows useful context instead of just '*'.

- Add buildPermissionPatterns(toolName, args) helper in plugin.ts
- Update wrap() to use it and pass actual args as metadata
- Remove redundant dead-code ask() calls from all 5 tool handlers
  (they were never shown since wrap() already granted always: ['*'])
@mrsimpson mrsimpson merged commit 32c7e07 into main May 1, 2026
3 checks passed
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