fix(cli): filter subagent sessions from resume history (#19698)

This commit is contained in:
Abhi
2026-02-21 12:41:27 -05:00
committed by GitHub
parent dfd7721e69
commit d2d345f41a
7 changed files with 116 additions and 9 deletions
+8 -4
View File
@@ -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)}`);
}
}