fix(plan): Fix AskUser evals (#22074)

This commit is contained in:
Adib234
2026-03-13 09:30:19 -04:00
committed by GitHub
parent 2d05396dd2
commit 263b8cd3b3
3 changed files with 101 additions and 34 deletions

View File

@@ -487,7 +487,7 @@ export class AppRig {
}
async waitForPendingConfirmation(
toolNameOrDisplayName?: string | RegExp,
toolNameOrDisplayName?: string | RegExp | string[],
timeout = 30000,
): Promise<PendingConfirmation> {
const matches = (p: PendingConfirmation) => {
@@ -498,6 +498,12 @@ export class AppRig {
p.toolDisplayName === toolNameOrDisplayName
);
}
if (Array.isArray(toolNameOrDisplayName)) {
return (
toolNameOrDisplayName.includes(p.toolName) ||
toolNameOrDisplayName.includes(p.toolDisplayName || '')
);
}
return (
toolNameOrDisplayName.test(p.toolName) ||
toolNameOrDisplayName.test(p.toolDisplayName || '')

View File

@@ -353,6 +353,7 @@ export class TestRig {
testName: string,
options: {
settings?: Record<string, unknown>;
state?: Record<string, unknown>;
fakeResponsesPath?: string;
} = {},
) {
@@ -382,6 +383,9 @@ export class TestRig {
// Create a settings file to point the CLI to the local collector
this._createSettingsFile(options.settings);
// Create persistent state file
this._createStateFile(options.state);
}
private _cleanDir(dir: string) {
@@ -473,6 +477,24 @@ export class TestRig {
);
}
private _createStateFile(overrideState?: Record<string, unknown>) {
if (!this.homeDir) throw new Error('TestRig homeDir is not initialized');
const userGeminiDir = join(this.homeDir, GEMINI_DIR);
mkdirSync(userGeminiDir, { recursive: true });
const state = deepMerge(
{
terminalSetupPromptShown: true, // Default to true in tests to avoid blocking prompts
},
overrideState ?? {},
);
writeFileSync(
join(userGeminiDir, 'state.json'),
JSON.stringify(state, null, 2),
);
}
createFile(fileName: string, content: string) {
const filePath = join(this.testDir!, fileName);
writeFileSync(filePath, content);