mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-03-15 08:31:14 -07:00
Fix issue where config was undefined. (#22397)
This commit is contained in:
committed by
GitHub
parent
604d4ded8d
commit
64c50d32ac
@@ -120,4 +120,25 @@ describe('agent-scheduler', () => {
|
||||
expect(schedulerConfig.toolRegistry).toBe(agentRegistry);
|
||||
expect(schedulerConfig.toolRegistry).not.toBe(mainRegistry);
|
||||
});
|
||||
|
||||
it('should create an AgentLoopContext that has a defined .config property', async () => {
|
||||
const mockConfig = {
|
||||
messageBus: mockMessageBus,
|
||||
toolRegistry: mockToolRegistry,
|
||||
promptId: 'test-prompt',
|
||||
} as unknown as Mocked<Config>;
|
||||
|
||||
const options = {
|
||||
schedulerId: 'subagent-1',
|
||||
toolRegistry: mockToolRegistry as unknown as ToolRegistry,
|
||||
signal: new AbortController().signal,
|
||||
};
|
||||
|
||||
await scheduleAgentTools(mockConfig as unknown as Config, [], options);
|
||||
|
||||
const schedulerContext = vi.mocked(Scheduler).mock.calls[0][0].context;
|
||||
expect(schedulerContext.config).toBeDefined();
|
||||
expect(schedulerContext.config.promptId).toBe('test-prompt');
|
||||
expect(schedulerContext.toolRegistry).toBe(mockToolRegistry);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -67,8 +67,17 @@ export async function scheduleAgentTools(
|
||||
configurable: true,
|
||||
});
|
||||
|
||||
const schedulerContext = {
|
||||
config: agentConfig,
|
||||
promptId: config.promptId,
|
||||
toolRegistry,
|
||||
messageBus: toolRegistry.messageBus,
|
||||
geminiClient: config.geminiClient,
|
||||
sandboxManager: config.sandboxManager,
|
||||
};
|
||||
|
||||
const scheduler = new Scheduler({
|
||||
context: agentConfig,
|
||||
context: schedulerContext,
|
||||
messageBus: toolRegistry.messageBus,
|
||||
getPreferredEditor: getPreferredEditor ?? (() => undefined),
|
||||
schedulerId,
|
||||
|
||||
@@ -133,7 +133,7 @@ export class CoreToolScheduler {
|
||||
this.onAllToolCallsComplete = options.onAllToolCallsComplete;
|
||||
this.onToolCallsUpdate = options.onToolCallsUpdate;
|
||||
this.getPreferredEditor = options.getPreferredEditor;
|
||||
this.toolExecutor = new ToolExecutor(this.context.config);
|
||||
this.toolExecutor = new ToolExecutor(this.context);
|
||||
this.toolModifier = new ToolModificationHandler();
|
||||
|
||||
// Subscribe to message bus for ASK_USER policy decisions
|
||||
|
||||
Reference in New Issue
Block a user