fix(app): only offer 'always' when permission request supports it - #46302
Open
CannonRS wants to merge 1 commit into
Open
fix(app): only offer 'always' when permission request supports it#46302CannonRS wants to merge 1 commit into
CannonRS wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Issue for this PR
Closes #46301
Type of change
What does this PR do?
packages/app/src/pages/session/composer/session-composer-state.tsexposes adecide(response: "once" | "always" | "reject")method that always sends thechosen reply straight to the server. The server-side reply path in
packages/opencode/src/permission/index.tsonly does pattern matching when theincoming
Permission.Info.alwaysis a non-empty list of patterns; otherwise the"always" reply silently downgrades to a one-off reply.
This PR adds a
permissionPersistent()memo that returnstrueonly when thecurrent permission request carries at least one
alwayspattern, and short-circuits
decidewhen the user picks"always"for a request that does notsupport persistence. The new memo is also exported from the controller state so
the dock can use it to hide or disable the "always" button. Nothing else in
session-composer-state.tschanges.The fix is deliberately not gated on
protocol() === "v2"or any othertransport signal.
Permission.Info.alwaysis a request field, not a transportfield; the same condition holds for both V1 and V2 request shapes.
How did you verify your code works?
packages/app/src/pages/session/composer/session-composer-state.ts.bun typecheckinpackages/apppasses (tsgo -bexit 0) afterbun install --ignore-scriptsin the worktree, againstupstream/devhead10765ff2a9plus this commit.
decideis the only call site that sends the reply; the newpermissionPersistentguard is the first thing it checks after theresponding === perm.idearly-out.packages/opencode/src/permission/index.tsreadsrequest.alwaysbefore acting on
input.reply === "always". The client guard now matchesthe server's actual behaviour, so a request that does not support
persistence cannot be answered with
"always"from the client either.Screenshots / recordings
N/A — single boolean guard, no UI change. The dock already controls its own
button visibility; this PR only adds the data field needed for the dock to
filter the "always" button.
Checklist
bun typecheckinpackages/apppasses (tsgo -bexit 0) afterbun install --ignore-scriptsin the worktree, againstupstream/devhead
10765ff2a9plus this commit.