You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Ensure that pressing Escape in the VS Code extension (or Ctrl+C in the CLI) instantly aborts the current LLM network request.
Use Case
If the AI starts generating an answer and the user immediately realizes they made a typo in their prompt (or the AI is going down the wrong path), they want to stop it instantly to save tokens/time.
Proposed Solution
Bind the Escape key in the webview to trigger the cancel message. Ensure the backend NanocoderAcpClient uses an AbortController to physically terminate the HTTP request to the LLM provider, rather than just hiding the output.
Alternatives Considered
Only providing a mouse-clickable "Stop" button, but power users heavily rely on keyboard shortcuts for cancellation.
Additional Context
I have searched existing issues to ensure this is not a duplicate
This feature aligns with the project's goals (local-first AI assistance)
Implementation Notes (optional)
VS Code Extension: Add a keydown listener on document or the chat-input textarea to catch Escape.
Backend: Ensure the Vercel AI SDK streamText call is passed an AbortSignal.
Contribution Guidelines
If you would like to work on this issue, please comment below to ask for assignment first.
Before opening a Pull Request, please briefly share your implementation plan in this thread so we can align on the approach!
Hey @arpan7sarkar, thanks for your interest! Feel free to share a short implementation plan first, and if everything looks good, I'll assign it to you.
Move the Escape listener from the textarea to document, so it works even if focus is somewhere else (like a tool card or the response area).
Keep it guarded by the existing isProcessing flag so it does nothing when idle.
On Escape, just call the same cancel path the Stop button already uses (postMessage({type: 'cancel'}) + setProcessing(false)).
Also added a nanocoder.cancel command so it shows up in the Command Palette too.
Backend
Checked the ACP session + chat handler code turns out the AbortController is already wired into the streamText call, and cancel already aborts the real request, not just the UI. So nothing to change here, just confirmed it actually works.
Already implemented and tested this locally, works as expected.
@arpan7sarkar Looks good to me. I like that you reused the existing cancel flow instead of adding a separate path, and it's great that you verified the backend already performs a real AbortController cancellation. One thing I'd like you to double-check is that the global Escape handler doesn't interfere with other UI interactions (such as autocomplete or future dialogs) and only triggers while a response is actively streaming. If that looks good, feel free to open the PR.
It won't interfere. It's just a keystroke bound to the same cancel action as the Stop button, guarded by isProcessing, so it's a no-op unless a response is actively streaming. No dropdowns/autocomplete currently handle Escape, so there's no conflict there.
Activity
arpan7sarkar commentedon Aug 4, 2026
Hey @akramcodez I am working on this issue please assign me it .
akramcodez commentedon Aug 4, 2026
Hey @arpan7sarkar, thanks for your interest! Feel free to share a short implementation plan first, and if everything looks good, I'll assign it to you.
arpan7sarkar commentedon Aug 4, 2026
Hey @akramcodez , here's my plan for this one:
Frontend (chat-panel.js in the VS Code webview)
Backend
Already implemented and tested this locally, works as expected.
2minclip-export.mp4
akramcodez commentedon Aug 4, 2026
@arpan7sarkar Looks good to me. I like that you reused the existing cancel flow instead of adding a separate path, and it's great that you verified the backend already performs a real AbortController cancellation. One thing I'd like you to double-check is that the global Escape handler doesn't interfere with other UI interactions (such as autocomplete or future dialogs) and only triggers while a response is actively streaming. If that looks good, feel free to open the PR.
arpan7sarkar commentedon Aug 4, 2026
It won't interfere. It's just a keystroke bound to the same cancel action as the Stop button, guarded by isProcessing, so it's a no-op unless a response is actively streaming. No dropdowns/autocomplete currently handle Escape, so there's no conflict there.