fix(core): thread abort signal through chat compression#20515
fix(core): thread abort signal through chat compression#20515deadsmash07 wants to merge 1 commit intogoogle-gemini:mainfrom
Conversation
Ctrl+C during compression now cancels the in-flight API calls. Previously, tryCompressChat did not forward the parent abort signal to the compression service, so generateContent calls used a throwaway AbortController and ignored user cancellation. Fixes google-gemini#20405
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request enhances the responsiveness of the application by implementing proper cancellation for long-running chat compression operations. By propagating existing abort signals through the chat compression logic, users can now interrupt ongoing LLM API calls immediately, preventing lingering requests and improving control during interactive sessions. Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request correctly threads the parent abort signal through the chat compression service. By adding an optional abortSignal parameter to tryCompressChat in local-executor.ts and client.ts, the change ensures that in-flight generateContent API calls during chat summarization can be properly cancelled. The implementation is straightforward and effectively resolves the issue of lingering API requests upon cancellation.
|
Closing this — @Shiv-aurora's PR #20407 addresses the same issue and was opened first. No need for a duplicate. |
Summary
processTurnandexecuteTurnthroughtryCompressChatinto the compression servicegenerateContentAPI calls immediatelyDetails
When the CLI triggers chat compression (summarization + verification LLM calls), pressing Ctrl+C didn't cancel the underlying API requests. Both
generateContentcalls inchatCompressionService.compress()were receiving a throwawaynew AbortController().signalbecausetryCompressChatin bothclient.tsandlocal-executor.tsnever forwarded the parent abort signal.The fix adds an optional
abortSignalparameter to bothtryCompressChatmethods and passes through the signals that are already available at the call sites (signalinprocessTurn,combinedSignalinexecuteTurn).Related Issues
Fixes #20405
How to Validate
Pre-Merge Checklist
npm run