Skip to content

provideLanguageModelChatResponse CancellationToken not work #277872

Closed

Description

@wszgrcy

Does this issue occur when all extensions are disabled?: Yes/No

  • VS Code Version: 1.106
  • OS Version: windows 10

Steps to Reproduce:

Test Repo

  1. npm i
  2. f5
Image
Image
Image
Image
  1. not emit event or print true
Image
  async provideLanguageModelChatResponse(
    model: LanguageModelChatInformation,
    _messages: Array<LanguageModelChatMessage>,
    _options: ProvideLanguageModelChatResponseOptions,
    progress: Progress<LanguageModelResponsePart>,
    _token: CancellationToken
  ): Promise<void> {
    console.log(_token);

    let ab = new AbortController();
    _token.onCancellationRequested((e) => {
      console.log(e);
      ab.abort();
    });
    setInterval(() => {
      console.log(_token.isCancellationRequested);
    }, 1000);
    await new Promise<void>((res) => {
      setTimeout(() => {
        res();
      }, 99999999);
    });
}

Activity

  1. added
    bug
    on Nov 18, 2025
  2. jrieken commented on Nov 18, 2025

    @jrieken
    Contributor

    Logan Ramos (@lramos15) I debugging this to understanding and would like to hand off this to you. Is that fine for you?

  3. smallmain commented on Jan 23, 2026

    @smallmain
  4. smallmain commented on Feb 5, 2026

    @smallmain

    Johannes Rieken (@jrieken) Logan Ramos (@lramos15)

    The issues with version v1.109.0 are still present; can you fix them?

  5. lramos15 commented on Sep 25, 2026

    @lramos15
    Member

    🤖 Thanks for the report and for providing a reproduction repo — that helped track down the root cause. This was fixed in #319098 (commit 3d87c04), which ensures the CancellationToken is properly propagated when the user stops a chat request. The fix is on main and should ship in the next stable release. Please reopen or file a new issue if you still see this on an Insiders build.

  6. added this to the 1.140.0 milestone on Sep 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

apibugchatverified

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions