fix(cursor): nest ACP extension outcome so plan approvals aren't cancelled#80
Open
heavygee wants to merge 1 commit into
Open
fix(cursor): nest ACP extension outcome so plan approvals aren't cancelled#80heavygee wants to merge 1 commit into
heavygee wants to merge 1 commit into
Conversation
…elled
Cursor's ACP blocking extension methods (cursor/ask_question,
cursor/create_plan) expect the JSON-RPC result to nest the outcome under
an `outcome` key, e.g. `{ outcome: { outcome: "accepted" } }`. The
adapter returned it flat (`{ outcome: "accepted" }`), so Cursor read
`response.outcome.outcome` as undefined and fell back to a cancellation
— an approved plan was relayed to the agent as `User cancelled`, making
plan mode unusable over HAPI for Cursor sessions.
Wrap every ask_question / create_plan response in the nested envelope
and add regression tests asserting the exact wire shape for the
affirmative approval -> CreatePlan path (plus approved_for_session,
reject, and abort).
Fixes #79
Co-authored-by: Cursor <cursoragent@cursor.com>
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
Fixes #79. Approving a Cursor plan-mode
CreatePlanrequest from the HAPI web UI relayedUser cancelledback to the agent instead of an approval, so the plan → execute handoff never fired (plan mode unusable for Cursor sessions over HAPI).Root cause: Cursor's ACP blocking extension methods (
cursor/ask_question,cursor/create_plan) require the JSON-RPC result to nest the outcome under anoutcomekey (see https://cursor.com/docs/cli/acp):cli/src/cursor/utils/cursorExtensionAdapter.tsreturned the outcome flat ({ outcome: "accepted" }), so Cursor readresponse.outcome.outcomeasundefinedand fell back to a cancellation. The hub still recorded the request asapproved(green checkmark), which is why the symptom looked like "approved in the UI, cancelled to the agent". The same flat shape affectedcursor/ask_question(identical latent bug).The standard ACP
session/request_permissionresponses inAcpSdkBackendalready use the nested{ outcome: { outcome: ... } }shape, so the cursor extension responses were the outlier.Changes
cursor/ask_questionandcursor/create_planresponses (accept / reject / cancel / answered, incl.cancelAll) in the nested{ outcome: { ... } }envelope via a smallwrapOutcomehelper.approvedandapproved_for_session) resolves to{ outcome: { outcome: 'accepted' } }, plus reject →rejectedand abort →cancelled.Test plan
bun typecheck(cli/web/hub) greenbun run testgreen (cli + hub)cursorExtensionAdapter.test.ts— 12/12 passUser cancelled.