mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-05-12 21:03:05 -07:00
feat(core): enable contiguous parallel admission for Kind.Agent tools (#20583)
This commit is contained in:
@@ -29,6 +29,7 @@ import { PolicyDecision } from '../policy/types.js';
|
||||
import {
|
||||
ToolConfirmationOutcome,
|
||||
type AnyDeclarativeTool,
|
||||
Kind,
|
||||
} from '../tools/tools.js';
|
||||
import { getToolSuggestion } from '../utils/tool-utils.js';
|
||||
import { runInDevTraceSpan } from '../telemetry/trace.js';
|
||||
@@ -427,11 +428,11 @@ export class Scheduler {
|
||||
return true;
|
||||
}
|
||||
|
||||
// If the first tool is read-only, batch all contiguous read-only tools.
|
||||
if (next.tool?.isReadOnly) {
|
||||
// If the first tool is parallelizable, batch all contiguous parallelizable tools.
|
||||
if (this._isParallelizable(next.tool)) {
|
||||
while (this.state.queueLength > 0) {
|
||||
const peeked = this.state.peekQueue();
|
||||
if (peeked && peeked.tool?.isReadOnly) {
|
||||
if (peeked && this._isParallelizable(peeked.tool)) {
|
||||
this.state.dequeue();
|
||||
} else {
|
||||
break;
|
||||
@@ -516,6 +517,11 @@ export class Scheduler {
|
||||
return false;
|
||||
}
|
||||
|
||||
private _isParallelizable(tool?: AnyDeclarativeTool): boolean {
|
||||
if (!tool) return false;
|
||||
return tool.isReadOnly || tool.kind === Kind.Agent;
|
||||
}
|
||||
|
||||
private async _processValidatingCall(
|
||||
active: ValidatingToolCall,
|
||||
signal: AbortSignal,
|
||||
|
||||
Reference in New Issue
Block a user