feat(cli): minimalist sandbox status labels (#24582)

This commit is contained in:
Gal Zahavi
2026-04-02 22:22:21 -07:00
committed by GitHub
parent 7de3e4dcf9
commit e54eecca51
2 changed files with 31 additions and 20 deletions
+23 -4
View File
@@ -81,6 +81,7 @@ const mockConfigPlain = {
isTrustedFolder: () => true,
getExtensionRegistryURI: () => undefined,
getContentGeneratorConfig: () => ({ authType: undefined }),
getSandboxEnabled: () => false,
};
const mockConfig = mockConfigPlain as unknown as Config;
@@ -364,7 +365,7 @@ describe('<Footer />', () => {
unmount();
});
it('should display custom sandbox info when SANDBOX env is set', async () => {
it('should display "current process" for custom sandbox when SANDBOX env is set', async () => {
vi.stubEnv('SANDBOX', 'gemini-cli-test-sandbox');
const { lastFrame, unmount } = await renderWithProviders(<Footer />, {
config: mockConfig,
@@ -374,12 +375,12 @@ describe('<Footer />', () => {
sessionStats: mockSessionStats,
},
});
expect(lastFrame()).toContain('test');
expect(lastFrame()).toContain('current process');
vi.unstubAllEnvs();
unmount();
});
it('should display macOS Seatbelt info when SANDBOX is sandbox-exec', async () => {
it('should display "current process" for macOS Seatbelt when SANDBOX is sandbox-exec', async () => {
vi.stubEnv('SANDBOX', 'sandbox-exec');
vi.stubEnv('SEATBELT_PROFILE', 'test-profile');
const { lastFrame, unmount } = await renderWithProviders(<Footer />, {
@@ -387,7 +388,7 @@ describe('<Footer />', () => {
width: 120,
uiState: { isTrustedFolder: true, sessionStats: mockSessionStats },
});
expect(lastFrame()).toMatch(/macOS Seatbelt.*\(test-profile\)/s);
expect(lastFrame()).toContain('current process');
vi.unstubAllEnvs();
unmount();
});
@@ -405,6 +406,24 @@ describe('<Footer />', () => {
unmount();
});
it('should display "all tools" when tool sandboxing is enabled and agent is local', async () => {
vi.stubEnv('SANDBOX', '');
const { lastFrame, unmount } = await renderWithProviders(<Footer />, {
config: Object.assign(
Object.create(Object.getPrototypeOf(mockConfig)),
mockConfig,
{
getSandboxEnabled: () => true,
},
),
width: 120,
uiState: { isTrustedFolder: true, sessionStats: mockSessionStats },
});
expect(lastFrame()).toContain('all tools');
vi.unstubAllEnvs();
unmount();
});
it('should prioritize untrusted message over sandbox info', async () => {
vi.stubEnv('SANDBOX', 'gemini-cli-test-sandbox');
const { lastFrame, unmount } = await renderWithProviders(<Footer />, {