feat: support abort parameter in runner, agent, model, tool and processors#234
Open
kalenkevich wants to merge 1 commit intomainfrom
Open
feat: support abort parameter in runner, agent, model, tool and processors#234kalenkevich wants to merge 1 commit intomainfrom
kalenkevich wants to merge 1 commit intomainfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Please ensure you have read the contribution guide before creating a pull request.
Description of Change
Problem:
I needed to add abort functionality across the core execution and streaming paths (
Geminimodel streaming,LlmAgentsteps, andRunnerexecution). Without this, long-running operations or streaming sessions could not be cancelled gracefully by clients (likegemini-cli), potentially leading to resource leaks or unhandled rejections during cancellation attempts.Solution:
Added and verified abort handling via
AbortSignalin the key components:core/test/models/google_llm_test.ts): Added tests to verify thatabortSignalis passed togenerateContentStreamand that it handles abortion correctly.core/test/agents/llm_agent_test.ts): Added a test to verify that execution stops when the signal is aborted between steps.core/test/runner/streaming_runner_test.ts): Added tests to verifyrunAsyncrespects the abort signal generally and specifically during asynchronous tool execution.Testing Plan
Unit Tests:
Summary of passed npm test results:
core/test/runner/streaming_runner_test.tspassed with 13 tests.llm_agent_test.tsandgoogle_llm_test.tswere also verified to contain the new abort logicChecklist