Skip to content

fix(cli): keep cancelled agent sessions idle - #13601

Merged
marius-kilocode merged 1 commit into
mainfrom
set-cancelled-agent-icon-to-idle
Aug 31, 2026
Merged

fix(cli): keep cancelled agent sessions idle#13601
marius-kilocode merged 1 commit into
mainfrom
set-cancelled-agent-icon-to-idle

Conversation

@marius-kilocode

Copy link
Copy Markdown
Collaborator

What Problem This Solves

Stopping an agent with Esc or the Stop button could show the Finished attention icon, even though the agent had not completed its work. This made deliberate cancellations look like completed turns that needed review.

Why This Change Was Made

The runner returns the last assistant message after cancellation. That recovery result is successful, so the turn-close resolver could incorrectly classify it as completed. Record an interrupted outcome in the cancellation fallback, while preserving an existing explicit outcome such as a terminal error.

User Impact

  • Esc and Stop return the session to Idle instead of Finished.
  • Normal completion still shows Finished, including the next turn after a cancellation.
  • Existing terminal errors remain visible.
  • The fix is in the shared CLI backend and applies to local and worktree sessions. No client-specific icon workaround or new setting is needed.

Evidence

The regression test reproduced completed before the fix and now receives interrupted. Coverage also checks the actual webview abort request, rendered Idle state, and a later normal completion.

Local validation passed:

  • 4,492 extension unit tests.
  • 71 focused CLI tests covering runner cancellation, prompt cancellation, queued prompts, and compaction error outcomes.
  • CLI and extension typechecks, extension compile, formatter, and fork-annotation checks. Lint completed with existing warnings only.
  • The focused cancellation and completion checks passed again after updating the branch to current main.

Manual verification used a fresh CLI build, isolated VS Code, and a credential-free local provider. Esc showed Idle, Stop showed Idle, and a subsequent normally completed turn showed Finished. These screenshots exercise local sessions inside Agent Manager; worktree sessions use the same backend cancellation path.

Esc: Idle, with no Finished checkmark Agent Manager session is idle after Escape cancels the running turn
Stop button: Idle, with no Finished checkmark Agent Manager session is idle after the Stop button cancels the running turn
Normal completion after cancellation: Finished A subsequent normally completed turn shows the green Finished checkmark in Agent Manager

@kilo-code-bot

kilo-code-bot Bot commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Files Reviewed (4 files)
  • .changeset/idle-stopped-sessions.md
  • packages/kilo-vscode/tests/fixtures/session-provider-activity.tsx
  • packages/opencode/src/session/prompt.ts
  • packages/opencode/test/kilocode/session-prompt-queue.test.ts

Reviewed by grok-4.6 · Input: 170.6K · Output: 15.1K · Cached: 1.1M

Review guidance: REVIEW.md from base branch main

@WebReflection WebReflection left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The intent is clear, I am just wondering if the Bus could ever raise an error instead and, if that's the case, how would we ensure the promise is not "forever pending" because closed.reject is never reached.

@marius-kilocode
marius-kilocode merged commit 2234b67 into main Aug 31, 2026
33 checks passed
@marius-kilocode
marius-kilocode deleted the set-cancelled-agent-icon-to-idle branch August 31, 2026 10:33
@marius-kilocode

Copy link
Copy Markdown
Collaborator Author

@WebReflection would we actually care in the test? The timeout seems sufficient as failure for me.

@WebReflection

Copy link
Copy Markdown
Contributor

would we actually care in the test?

fair point, I guess we have other venues to also test failures too, comment addressed, thank you.

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