mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-22 11:04:42 -07:00
fix(cli): filter subagent sessions from resume history (#19698)
This commit is contained in:
@@ -41,14 +41,15 @@ import type { Config } from '../config/config.js';
|
||||
import { MockTool } from '../test-utils/mock-tool.js';
|
||||
import { getDirectoryContextString } from '../utils/environmentContext.js';
|
||||
import { z } from 'zod';
|
||||
import { getErrorMessage } from '../utils/errors.js';
|
||||
import { promptIdContext } from '../utils/promptIdContext.js';
|
||||
import {
|
||||
logAgentStart,
|
||||
logAgentFinish,
|
||||
logRecoveryAttempt,
|
||||
} from '../telemetry/loggers.js';
|
||||
import { LlmRole } from '../telemetry/types.js';
|
||||
import {
|
||||
LlmRole,
|
||||
AgentStartEvent,
|
||||
AgentFinishEvent,
|
||||
RecoveryAttemptEvent,
|
||||
@@ -1250,7 +1251,7 @@ describe('LocalAgentExecutor', () => {
|
||||
);
|
||||
|
||||
await expect(executor.run({ goal: 'test' }, signal)).rejects.toThrow(
|
||||
`Failed to create chat object: ${initError}`,
|
||||
`Failed to create chat object: ${getErrorMessage(initError)}`,
|
||||
);
|
||||
|
||||
// Ensure the error was reported via the activity callback
|
||||
@@ -1258,7 +1259,7 @@ describe('LocalAgentExecutor', () => {
|
||||
expect.objectContaining({
|
||||
type: 'ERROR',
|
||||
data: expect.objectContaining({
|
||||
error: `Error: Failed to create chat object: ${initError}`,
|
||||
error: `Error: Failed to create chat object: ${getErrorMessage(initError)}`,
|
||||
}),
|
||||
}),
|
||||
);
|
||||
|
||||
@@ -33,8 +33,8 @@ import {
|
||||
import {
|
||||
AgentStartEvent,
|
||||
AgentFinishEvent,
|
||||
RecoveryAttemptEvent,
|
||||
LlmRole,
|
||||
RecoveryAttemptEvent,
|
||||
} from '../telemetry/types.js';
|
||||
import type {
|
||||
LocalAgentDefinition,
|
||||
@@ -48,6 +48,7 @@ import {
|
||||
DEFAULT_MAX_TURNS,
|
||||
DEFAULT_MAX_TIME_MINUTES,
|
||||
} from './types.js';
|
||||
import { getErrorMessage } from '../utils/errors.js';
|
||||
import { templateString } from './utils.js';
|
||||
import { DEFAULT_GEMINI_MODEL, isAutoModel } from '../config/models.js';
|
||||
import type { RoutingContext } from '../routing/routingStrategy.js';
|
||||
@@ -826,16 +827,19 @@ export class LocalAgentExecutor<TOutput extends z.ZodTypeAny> {
|
||||
systemInstruction,
|
||||
[{ functionDeclarations: tools }],
|
||||
startHistory,
|
||||
undefined,
|
||||
undefined,
|
||||
'subagent',
|
||||
);
|
||||
} catch (error) {
|
||||
} catch (e: unknown) {
|
||||
await reportError(
|
||||
error,
|
||||
e,
|
||||
`Error initializing Gemini chat for agent ${this.definition.name}.`,
|
||||
startHistory,
|
||||
'startChat',
|
||||
);
|
||||
// Re-throw as a more specific error after reporting.
|
||||
throw new Error(`Failed to create chat object: ${error}`);
|
||||
throw new Error(`Failed to create chat object: ${getErrorMessage(e)}`);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user