[PR #6554] Refactor permission system with context-aware requests and auto-resolution #11972

Closed
opened 2026-02-16 18:16:54 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/6554

State: closed
Merged: No


Refactors the permission system to make permission requests context-aware and automatically resolve matching pending permissions.

Permission Request Structure

  • Changed from scalar callID to structured tool object containing messageID and callID
  • Enables UI to display tool inputs and context when requesting permissions
  • Removed message field in favor of deriving context from tool metadata

Tool Context Integration

Added ask() method to Tool.Context:

export type Context = {
  // ... existing fields
  ask(input: Omit<PermissionNext.Request, "id" | "sessionID" | "tool">): Promise<void>
}

Tools now request permissions directly through context rather than separate mechanisms. MCP tools now require explicit permission approval.

Auto-resolution

When user selects "always allow", the system:

  1. Adds approved patterns to session ruleset
  2. Automatically resolves other pending permissions in the same session that match the new patterns
  3. Keeps permissions in-memory (not persisted) until management UI exists

Permission Merging

Standardized merge order across all agents: defaults → agent-specific rules → user config. Last matching rule wins, enabling user overrides.

UI Improvements

  • Icon indicators per tool type (bash: #, edit: , websearch: , etc.)
  • Scrollable diff views capped at 25% terminal height
  • Context-aware displays showing actual tool inputs (file paths, commands, search queries)
  • Clear messaging that "always allow" persists until restart only

Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

**Original Pull Request:** https://github.com/anomalyco/opencode/pull/6554 **State:** closed **Merged:** No --- Refactors the permission system to make permission requests context-aware and automatically resolve matching pending permissions. ## Permission Request Structure - Changed from scalar `callID` to structured `tool` object containing `messageID` and `callID` - Enables UI to display tool inputs and context when requesting permissions - Removed `message` field in favor of deriving context from tool metadata ## Tool Context Integration Added `ask()` method to `Tool.Context`: ```typescript export type Context = { // ... existing fields ask(input: Omit<PermissionNext.Request, "id" | "sessionID" | "tool">): Promise<void> } ``` Tools now request permissions directly through context rather than separate mechanisms. MCP tools now require explicit permission approval. ## Auto-resolution When user selects "always allow", the system: 1. Adds approved patterns to session ruleset 2. Automatically resolves other pending permissions in the same session that match the new patterns 3. Keeps permissions in-memory (not persisted) until management UI exists ## Permission Merging Standardized merge order across all agents: defaults → agent-specific rules → user config. Last matching rule wins, enabling user overrides. ## UI Improvements - Icon indicators per tool type (bash: `#`, edit: `→`, websearch: `◈`, etc.) - Scrollable diff views capped at 25% terminal height - Context-aware displays showing actual tool inputs (file paths, commands, search queries) - Clear messaging that "always allow" persists until restart only <!-- START COPILOT CODING AGENT TIPS --> --- ✨ Let Copilot coding agent [set things up for you](https://github.com/sst/opencode/issues/new?title=✨+Set+up+Copilot+instructions&body=Configure%20instructions%20for%20this%20repository%20as%20documented%20in%20%5BBest%20practices%20for%20Copilot%20coding%20agent%20in%20your%20repository%5D%28https://gh.io/copilot-coding-agent-tips%29%2E%0A%0A%3COnboard%20this%20repo%3E&assignees=copilot) — coding agent works faster and does higher quality work when set up for your repo.
yindo added the pull-request label 2026-02-16 18:16:54 -05:00
yindo closed this issue 2026-02-16 18:16:54 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#11972