fix(core): make subagents aware of active approval modes (#23608)

This commit is contained in:
AK
2026-05-01 15:21:38 -07:00
committed by GitHub
parent de8fdcfa16
commit 40b384de2c
9 changed files with 124 additions and 8 deletions
@@ -15,6 +15,20 @@ import { Box, Text } from 'ink';
import { act, useState, type JSX } from 'react';
import { useAlternateBuffer } from '../hooks/useAlternateBuffer.js';
import { SHELL_COMMAND_NAME } from '../constants.js';
vi.mock('@google/gemini-cli-core', async (importOriginal) => {
const actual =
await importOriginal<typeof import('@google/gemini-cli-core')>();
return {
...actual,
validatePlanPath: vi
.fn()
.mockResolvedValue('Storage must be initialized before use'),
validatePlanContent: vi
.fn()
.mockResolvedValue('Storage must be initialized before use'),
};
});
import {
UIStateContext,
useUIState,
@@ -672,9 +686,15 @@ describe('MainContent', () => {
}),
);
const { lastFrame, unmount } = await renderWithProviders(<MainContent />, {
uiState: uiState as Partial<UIState>,
config: makeFakeConfig({ useAlternateBuffer: false }),
let lastFrame!: () => string;
let unmount!: () => void;
await act(async () => {
const res = await renderWithProviders(<MainContent />, {
uiState: uiState as Partial<UIState>,
config: makeFakeConfig({ useAlternateBuffer: false }),
});
lastFrame = res.lastFrame;
unmount = res.unmount;
});
await waitFor(() => {
@@ -683,6 +703,8 @@ describe('MainContent', () => {
expect(output).not.toContain('Hidden content');
// The output should contain the confirmation header
expect(output).toContain('Ready to start implementation?');
// Wait for the async error message to appear
expect(output).toContain('File not found: /path/to/plan');
});
// Snapshot will reveal if there are extra blank lines
@@ -101,7 +101,7 @@ exports[`MainContent > renders a ToolConfirmationQueue without an extra line whe
╭──────────────────────────────────────────────────────────────────────────────╮
│ Ready to start implementation? │
│ │
│ Error reading plan: Storage must be initialized before use
│ Error reading plan: File not found: /path/to/plan
╰──────────────────────────────────────────────────────────────────────────────╯
"
`;