feat(core): Add configurable inactivity timeout for shell commands (#13531)

This commit is contained in:
Gal Zahavi
2025-11-26 13:43:33 -08:00
committed by GitHub
parent 87edeb4e32
commit 0d29385e1b
9 changed files with 124 additions and 7 deletions
+16
View File
@@ -750,6 +750,22 @@ describe('Server Config (config.ts)', () => {
});
});
describe('Shell Tool Inactivity Timeout', () => {
it('should default to 300000ms (300 seconds) when not provided', () => {
const config = new Config(baseParams);
expect(config.getShellToolInactivityTimeout()).toBe(300000);
});
it('should convert provided seconds to milliseconds', () => {
const params: ConfigParameters = {
...baseParams,
shellToolInactivityTimeout: 10, // 10 seconds
};
const config = new Config(params);
expect(config.getShellToolInactivityTimeout()).toBe(10000);
});
});
describe('ContinueOnFailedApiCall Configuration', () => {
it('should default continueOnFailedApiCall to false when not provided', () => {
const config = new Config(baseParams);
+8
View File
@@ -297,6 +297,7 @@ export interface ConfigParameters {
continueOnFailedApiCall?: boolean;
retryFetchErrors?: boolean;
enableShellOutputEfficiency?: boolean;
shellToolInactivityTimeout?: number;
fakeResponses?: string;
recordResponses?: string;
ptyInfo?: string;
@@ -411,6 +412,7 @@ export class Config {
private readonly continueOnFailedApiCall: boolean;
private readonly retryFetchErrors: boolean;
private readonly enableShellOutputEfficiency: boolean;
private readonly shellToolInactivityTimeout: number;
readonly fakeResponses?: string;
readonly recordResponses?: string;
private readonly disableYoloMode: boolean;
@@ -547,6 +549,8 @@ export class Config {
this.continueOnFailedApiCall = params.continueOnFailedApiCall ?? true;
this.enableShellOutputEfficiency =
params.enableShellOutputEfficiency ?? true;
this.shellToolInactivityTimeout =
(params.shellToolInactivityTimeout ?? 300) * 1000; // 5 minutes
this.extensionManagement = params.extensionManagement ?? true;
this.enableExtensionReloading = params.enableExtensionReloading ?? false;
this.storage = new Storage(this.targetDir);
@@ -1308,6 +1312,10 @@ export class Config {
return this.enableShellOutputEfficiency;
}
getShellToolInactivityTimeout(): number {
return this.shellToolInactivityTimeout;
}
getShellExecutionConfig(): ShellExecutionConfig {
return this.shellExecutionConfig;
}