Skip to content

feat(permission): add optional reason to permission requests - #49993

Open
shabeeth2 wants to merge 8 commits into
anomalyco:devfrom
shabeeth2:permission-request-reason
Open

shabeeth2 wants to merge 8 commits into
anomalyco:devfrom
shabeeth2:permission-request-reason

Conversation

@shabeeth2

@shabeeth2 shabeeth2 commented Sep 19, 2026

Copy link
Copy Markdown

Issue for this PR

Closes #47889

Type of change

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

What does this PR do?

Adds an optional reason to permission requests. Requesters with meaningful task-specific intent can explain why approval is needed, and browser/desktop, TUI and CLI prompts display nonblank reasons as plain text beside the authoritative command, path or scope.

The field survives request creation, live events, pending APIs, plugin requests, compatibility conversions, the public OpenAPI schema and generated clients. It does not affect permission matching, automatic decisions or saved approval scopes. Built-in read and shell/bash inputs now accept an optional task-specific reason and forward it to their permission requests. Omitted reasons remain valid; generic tool descriptions are not copied into reason.

Shell and read descriptions remain optional, preserving compatibility with #26419.

How did you verify your code works?

  • Regenerated the public OpenAPI schema and both client surfaces; packages/client generated-output check passed and legacy SDK regeneration was reproducible.
  • Core permission tests: 12 passed.
  • App conversion tests: 17 passed.
  • HTTP, plugin and CLI tests: 48 passed, 5 existing skips.
  • TUI reason tests: 5 passed.
  • Browser permission dock coverage: 5 passed, including absent, whitespace and literal untrusted text reasons.
  • Legacy read/shell and Core read/bash requester tests passed with supplied and omitted reasons.
  • Core, client, schema, protocol, server, plugin, TUI and UI typechecks passed.
  • git diff --check passed and no files were deleted or renamed.

App typecheck remains blocked by the existing Windows linked custom-elements.d.ts resolution problem. The opencode package typecheck reports the pre-existing GlobalBusEmitter.emit/Node EventEmitter signature incompatibility in src/bus/global.ts.

The final no-mistakes run completed intent, rebase, review, test, documentation, lint and push with no review findings. Its live-test limitation was explicitly accepted because focused executable coverage passed and five browser cases ran live. The CI monitor was cancelled after it bound itself to a duplicate fork-local PR instead of this cross-repository PR; this PR's compliance and standards checks pass.

Screenshots / recordings

permission-reason-opencodecli-evidence permission-reason-opencodeweb-evidence

Checklist

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

@github-actions

Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

@shabeeth2
shabeeth2 marked this pull request as ready for review September 20, 2026 08:14
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.

[FEATURE]: Show why an agent needs a permission before the user approves it

1 participant