fix: wrap permission auto-reply in outcome object and select optionId dynamically#148
Closed
DrVictorChen wants to merge 1 commit intoopenabdev:mainfrom
Closed
fix: wrap permission auto-reply in outcome object and select optionId dynamically#148DrVictorChen wants to merge 1 commit intoopenabdev:mainfrom
DrVictorChen wants to merge 1 commit intoopenabdev:mainfrom
Conversation
… dynamically
The auto-reply for session/request_permission had two bugs:
1. Response was missing the required `outcome` wrapper — agents that
validate the ACP spec (Claude Code, Cursor) treated every tool call
as rejected (#130).
2. optionId was hardcoded to "allow_always", which is a `kind`, not an
`optionId`. Different agents use different ids (e.g. Cursor uses
"allow-always" with a hyphen; ExitPlanMode uses "bypassPermissions").
The agent receives an unknown id → treats it as rejected (#111).
Now we:
- Select the most permissive option from the request's `options` array
by `kind` priority: allow_always > allow_once > first non-reject_once
- Wrap the response in `{ outcome: { outcome: "selected", optionId } }`
per the ACP spec
Fixes #130, fixes #111
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
PR Review ✅Thanks @DrVictorChen for the comprehensive PR description — the What/Why/Impact table makes this easy to review. Looks good
Minor noteIf an option object exists but has no field, falls back to — this is conservative and correct. Approve. Ready to merge. |
Author
|
Sure, will rebase once #147 is merged. Thanks for the review! |
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.
Summary
Combined fix for #130 and #111 — both touch the same auto-reply block in
connection.rs.outcomewrapper. Agents that validate the ACP spec (Claude Code, Cursor) treated every tool call as rejected.optionIdwas hardcoded to"allow_always", which is akind, not anoptionId. Different agents use different ids (e.g. Cursor uses"allow-always"with a hyphen;ExitPlanModeuses"bypassPermissions"). Unknown id → rejected → agent stuck.Changes
optionsarray bykindpriority:allow_always>allow_once> first non-reject_once{ outcome: { outcome: "selected", optionId } }per the ACP specTested with
Cannot read properties of undefined (reading 'outcome')Fixes #130, fixes #111
🤖 Generated with Claude Code