mirror of
https://github.com/wu736139669/hapi.git
synced 2026-11-25 05:07:05 +00:00
fix(cursor): stop acknowledging soft steers that an abort cancels (#2229)
Abort sends session/cancel, and ACP answers the pending soft-steer session/prompt with stopReason "cancelled". The completion handler ignored the stopReason and acknowledged the row as steered, so a message Cursor may never have run was shown as delivered. Surface the stopReason from beginSoftSteerPrompt. On "cancelled" the row is held as indeterminate (the same path a transport failure takes), because Cursor may or may not have folded it into the cancelled turn: the user resolves it with Retry or Cancel instead of a silent claim or an automatic re-run after Stop. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
ba7494c5b5
commit
b4be7c2d93
@@ -509,7 +509,7 @@ class CursorAcpRemoteLauncher extends RemoteLauncherBase {
|
||||
await restoreQueuedReservation();
|
||||
return { steered: false, error: 'Active turn changed' };
|
||||
}
|
||||
let steer: { dispatched: Promise<void>; completed: Promise<void> };
|
||||
let steer: { dispatched: Promise<void>; completed: Promise<string | null> };
|
||||
try {
|
||||
steer = backend.beginSoftSteerPrompt(acpSessionId, [{
|
||||
type: 'text',
|
||||
@@ -557,7 +557,16 @@ class CursorAcpRemoteLauncher extends RemoteLauncherBase {
|
||||
// JSON-RPC rejection means ACP never accepted the instruction
|
||||
// (restore it for the next prompt), while a transport failure
|
||||
// (abort/disconnect) keeps the row reserved — never re-delivered.
|
||||
void steer.completed.then(() => {
|
||||
void steer.completed.then((stopReason) => {
|
||||
// Abort answers an unfinished soft steer with `cancelled`.
|
||||
// Cursor may or may not have folded it into the turn, so
|
||||
// hold it for explicit Retry/Cancel instead of claiming it.
|
||||
if (stopReason === 'cancelled') {
|
||||
if (session.queue.markReservationIndeterminate(taken)) {
|
||||
session.client.emitSteerIndeterminate([localId]);
|
||||
}
|
||||
return;
|
||||
}
|
||||
// Completion means ACP accepted the inject: the ACK must
|
||||
// reach the hub even when an abort reset the queue and
|
||||
// cancelled the reservation in between.
|
||||
|
||||
Reference in New Issue
Block a user