fix: standardize terminal integration timeout values

Replace hardcoded 3000ms timeout with configurable Terminal.shellIntegrationTimeout
in TerminalProcess.ts. This ensures consistent timeout behavior across all
terminal integration features and allows users to control both timeouts through
a single setting.

The error messages are also updated to display the dynamic timeout value,
providing clearer feedback when shell integration issues occur.

Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
This commit is contained in:
Eric Wheeler 2025-04-09 17:25:12 -07:00
parent b8bf634fd2
commit 0b0c438284
2 changed files with 11 additions and 3 deletions

View file

@ -256,6 +256,10 @@ export class Terminal {
Terminal.shellIntegrationTimeout = timeoutMs
}
public static getShellIntegrationTimeout(): number {
return Terminal.shellIntegrationTimeout
}
public static compressTerminalOutput(input: string, lineLimit: number): string {
return truncateOutput(applyRunLengthEncoding(input), lineLimit)
}

View file

@ -254,12 +254,16 @@ export class TerminalProcess extends EventEmitter<TerminalProcessEvents> {
// Emit no_shell_integration event with descriptive message
this.emit(
"no_shell_integration",
"VSCE shell integration stream did not start within 3 seconds. Terminal problem?",
`VSCE shell integration stream did not start within ${Terminal.getShellIntegrationTimeout() / 1000} seconds. Terminal problem?`,
)
// Reject with descriptive error
reject(new Error("VSCE shell integration stream did not start within 3 seconds."))
}, 3000)
reject(
new Error(
`VSCE shell integration stream did not start within ${Terminal.getShellIntegrationTimeout() / 1000} seconds.`,
),
)
}, Terminal.getShellIntegrationTimeout())
// Clean up timeout if stream becomes available
this.once("stream_available", (stream: AsyncIterable<string>) => {