mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-21 02:24:09 -07:00
fix(core): preserve shell execution config fields on update (#25113)
This commit is contained in:
committed by
GitHub
parent
31069329bb
commit
86f5a198bd
@@ -304,6 +304,53 @@ describe('Server Config (config.ts)', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('setShellExecutionConfig', () => {
|
||||
it('should preserve existing shell execution fields that are not being updated', () => {
|
||||
const config = new Config({
|
||||
...baseParams,
|
||||
sandbox: {
|
||||
enabled: true,
|
||||
command: 'windows-native',
|
||||
networkAccess: false,
|
||||
},
|
||||
shellBackgroundCompletionBehavior: 'notify',
|
||||
});
|
||||
|
||||
expect(config.getShellExecutionConfig()).toEqual(
|
||||
expect.objectContaining({
|
||||
sandboxConfig: expect.objectContaining({
|
||||
enabled: true,
|
||||
command: 'windows-native',
|
||||
networkAccess: false,
|
||||
}),
|
||||
backgroundCompletionBehavior: 'notify',
|
||||
}),
|
||||
);
|
||||
|
||||
config.setShellExecutionConfig({
|
||||
terminalWidth: 123,
|
||||
terminalHeight: 45,
|
||||
showColor: true,
|
||||
pager: 'cat',
|
||||
sanitizationConfig: config.sanitizationConfig,
|
||||
sandboxManager: config.sandboxManager,
|
||||
});
|
||||
|
||||
expect(config.getShellExecutionConfig()).toEqual(
|
||||
expect.objectContaining({
|
||||
terminalWidth: 123,
|
||||
terminalHeight: 45,
|
||||
sandboxConfig: expect.objectContaining({
|
||||
enabled: true,
|
||||
command: 'windows-native',
|
||||
networkAccess: false,
|
||||
}),
|
||||
backgroundCompletionBehavior: 'notify',
|
||||
}),
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
// Reset mocks if necessary
|
||||
vi.clearAllMocks();
|
||||
|
||||
@@ -3334,6 +3334,7 @@ export class Config implements McpContext, AgentLoopContext {
|
||||
|
||||
setShellExecutionConfig(config: ShellExecutionConfig): void {
|
||||
this.shellExecutionConfig = {
|
||||
...this.shellExecutionConfig,
|
||||
terminalWidth:
|
||||
config.terminalWidth ?? this.shellExecutionConfig.terminalWidth,
|
||||
terminalHeight:
|
||||
|
||||
Reference in New Issue
Block a user