Repository navigation
Conversation
Adds a `session` reply that allows the exact resources of a request for the rest of the session without saving a project-wide rule. Resources are matched literally and kept in memory. The TUI permission prompt offers the new option. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
|
This PR doesn't fully meet our contributing guidelines and PR template. What needs to be fixed:
Please edit this PR description to address the above within 72 hours, or it will be automatically closed. If you believe this was flagged incorrectly, please let a maintainer know. |
There was a problem hiding this comment.
The core part works as described. A session reply allows exactly the requested resources in that session only. It also answers other pending requests in the same session that are fully covered, and leaves partly covered requests and other sessions untouched. I checked this with the PR's test file, an extra throwaway core test, the ACP permission tests and type checks. I couldn't get the TUI to show a permission prompt in my headless harness. Could you attach before/after screenshots (or a short video) of the TUI prompt with the new Allow for session option?
Public API: Permission.Reply gains "session" (once | always | reject → once | session | always | reject). This affects the decision field of the permission reply HTTP endpoint, the reply field of the permission.replied event, and PermissionReply / PermissionReplyInput in @opencode/client. It is backwards compatible for callers. Plugins or clients that switch over the permission.replied reply value will now also see session.
Concerns:
packages/protocol/openapi.jsonwas not regenerated:bun run check:generatedinpackages/protocolfails, andPermission.Replythere still lists onlyonce,alwaysandreject. Please runbun run generateinpackages/protocol.- Grants only apply to the session that asked, so subagents (which run in their own child sessions) will prompt again; see the inline comment.
- The reformatting of the two shell-scanner test cases in
permission.test.tsis unrelated and can be dropped so the diff stays focused.
| ) | ||
| }) | ||
|
|
||
| function granted(input: Pick<Request, "sessionID" | "action" | "resources">) { |
There was a problem hiding this comment.
Grants are keyed by the request's own sessionID, so a subagent's child session never inherits them. If a user picks Allow for session in the parent, the subagent will ask again for the same command. If they pick it on a subagent's prompt, it covers only that child. In #48456, 14 of the 15 commands came from a subagent, so this is the case people are likely to hit. Was it meant to work this way, or should the grant be stored on (and checked against) the root session?
|
This pull request has been automatically closed because it was not updated to meet our contributing guidelines within the 72-hour window. Feel free to open a new pull request that follows our guidelines. |
Summary
sessionpermission reply, shown as Allow for session in the TUI prompt, between "Allow once" and "Always allow".*or?is not widened into a wildcard. Configured deny rules still win.PermissionReplyand the client types are regenerated.Not covered: the mini footer TUI, the desktop app dock and the ACP adapter still offer only once, always and reject.
Testing
packages/core:bun test test/permission.test.ts(new test for exact-match session grants)bun typecheckinpackages/schema,packages/coreandpackages/tuiVisual
🤖 Generated with Claude Code
Added by the opencode bot (AI-generated).
Related: #48456, #50600
Public API: adds
sessionto Permission.Reply (permission replydecision,permission.repliedeventreply, clientPermissionReplytypes; backwards compatible for callers)