Skip to content

feat(vscode): cancel in-flight requests with Escape. - #789

Open
arpan7sarkar wants to merge 1 commit into
Nano-Collective:mainfrom
arpan7sarkar:feat/webview-escape-cancel
Open

feat(vscode): cancel in-flight requests with Escape.#789
arpan7sarkar wants to merge 1 commit into
Nano-Collective:mainfrom
arpan7sarkar:feat/webview-escape-cancel

Conversation

@arpan7sarkar

Copy link
Copy Markdown
Contributor

Description

Implements #758

Pressing Escape in the VS Code extension's chat panel now cancels an in-flight LLM request, mirroring the existing Stop button. The listener is bound on the webview's document (not just the chat input) so it fires even when focus has moved to a tool card, dropdown, or the streaming response area, and it's guarded by isProcessing so it's a no-op when idle. Also added a nanocoder.cancel command for the Command Palette.

While wiring this up, found that cancelling mid-stream surfaced as a Nanocoder prompt failed: RequestError: Internal error toast — AcpAgent.prompt was throwing a generic error on abort, and the ACP JSON-RPC layer flattened it into an opaque failure. Fixed that too: cancellation is now recognized explicitly, reported inline in the chat as "Cancelled by user", and resolved with stopReason: 'cancelled' instead of rejecting. NanocoderAcpClient also tracks an in-flight cancel client-side and suppresses the toast for it, so this holds even against a CLI build that hasn't picked up the agent-side change. Genuine errors still show the toast as before.

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update

Changeset

  • Added a changeset (pnpm changeset) describing this change for the changelog

Docs-only or internal chores need no changeset (or run pnpm changeset --empty to note that intentionally).

Testing

Automated Tests

  • New features include passing tests in .spec.ts/tsx files
  • All existing tests pass (pnpm test:all completes successfully)
  • Tests cover both success and error scenarios

Manual Testing

  • Tested with Ollama
  • Tested with OpenRouter
  • Tested with OpenAI-compatible API
  • Tested MCP integration (if applicable)

Checklist

  • Code follows project style guidelines
  • Self-review completed
  • Documentation updated (if needed)
  • No breaking changes (or clearly documented)
  • Appropriate logging added using structured logging (see CONTRIBUTING.md)

Copilot AI lite review requested due to automatic review settings August 4, 2026 09:16

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@arpan7sarkar

Copy link
Copy Markdown
Contributor Author

Hey @akramcodez do check it out and let me know if any changes are needed .

@arpan7sarkar

Copy link
Copy Markdown
Contributor Author

Hey @will-lamerton , @Avtrkrb , @akramcodez , Do check this functionlity out , its perfectly working let me now if any change is needed , else merge it
Thanks

@akramcodez akramcodez left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM @arpan7sarkar, amazing work on this!

@arpan7sarkar

Copy link
Copy Markdown
Contributor Author

Thanks @akramcodez , now waiting for another review :)

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.

3 participants