Skip to content

fix(desktop): abort agent loop on plan_response cancel#2225

Merged
esengine merged 1 commit into
esengine:mainfrom
z1223473749:fix/desktop-plan-cancel-abort
May 29, 2026
Merged

fix(desktop): abort agent loop on plan_response cancel#2225
esengine merged 1 commit into
esengine:mainfrom
z1223473749:fix/desktop-plan-cancel-abort

Conversation

@z1223473749

Copy link
Copy Markdown

What

Add abortTurn(tab) in the plan_response cancel handler.

Why

When the user cancels a plan, the agent loop continues running. The model receives the cancellation signal via pauseGate but the in-progress turn is not aborted, causing the model to re-submit the plan or continue generating output that the user already rejected.

How to verify

  1. Start a session with plan mode enabled
  2. Let the model submit a plan via submit_plan
  3. Click Cancel in the plan approval
  4. Confirm the agent loop stops immediately — no further streaming or tool calls from the rejected turn

What

Why

How to verify

Checklist

  • npm run verify passes locally (lint + typecheck + tests + comment-policy gate)
  • No Co-Authored-By: Claude trailer in commits
  • Comments follow CONTRIBUTING.md (no module-essay headers, no incident history)
  • No edits to CHANGELOG.md — release notes are maintainer-written at release time

## What
Add abortTurn(tab) in the plan_response cancel handler.

## Why
When the user cancels a plan, the agent loop continues running. The
model receives the cancellation signal via pauseGate but the in-progress
turn is not aborted, causing the model to re-submit the plan or continue
generating output that the user already rejected.

## How to verify
1. Start a session with plan mode enabled
2. Let the model submit a plan via submit_plan
3. Click Cancel in the plan approval
4. Confirm the agent loop stops immediately — no further streaming or
   tool calls from the rejected turn

@esengine esengine left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clean 1-line fix, split out of #2072 — cancelling a plan now abortTurn(tab) before clearing plan state and emitting $plan_cleared, so an in-flight turn actually stops on cancel instead of running on after the plan's gone. Correct. CI green. Merging.

@esengine esengine merged commit 1739231 into esengine:main May 29, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants