-
Notifications
You must be signed in to change notification settings - Fork 35.7k
Use unified timeout setting under shell integration in runCommand #272369
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/toolTerminalCreator.ts
Outdated
Show resolved
Hide resolved
...rkbench/contrib/terminalContrib/chatAgentTools/common/terminalChatAgentToolsConfiguration.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR unifies shell integration timeout configuration by introducing a new general terminal setting terminal.integrated.shellIntegration.timeout that replaces the chat-specific setting. The change allows this timeout to be used more broadly across terminal features, including the runCommand API.
Key Changes:
- Adds new unified
terminal.integrated.shellIntegration.timeoutsetting - Updates chat agent tools to prefer the new setting with fallback to deprecated setting
- Modifies
runCommandto use the unified timeout with adjusted wait logic based on process ready time
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
src/vs/platform/terminal/common/terminal.ts |
Adds ShellIntegrationTimeout enum value for the new unified setting |
src/vs/workbench/contrib/terminal/common/terminalConfiguration.ts |
Defines the new terminal.integrated.shellIntegration.timeout configuration property |
src/vs/workbench/contrib/terminalContrib/chatAgentTools/common/terminalChatAgentToolsConfiguration.ts |
Marks the chat-specific timeout setting as deprecated and references the new unified setting |
src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/toolTerminalCreator.ts |
Updates to prefer the new unified timeout setting with fallback to deprecated chat setting |
src/vs/workbench/contrib/terminal/common/terminal.ts |
Adds processReadyTime property to track when terminal process becomes ready |
src/vs/workbench/contrib/terminal/browser/terminalProcessManager.ts |
Implements tracking of process ready time |
src/vs/workbench/contrib/terminal/browser/terminalInstance.ts |
Refactors runCommand to use unified timeout with elapsed time calculation |
src/vs/workbench/contrib/terminal/browser/terminalCommands.ts |
Adds temporary test command for validating the runCommand timeout behavior |
...rkbench/contrib/terminalContrib/chatAgentTools/common/terminalChatAgentToolsConfiguration.ts
Outdated
Show resolved
Hide resolved
src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/toolTerminalCreator.ts
Outdated
Show resolved
Hide resolved
|
|
||
| if (timeOutValue === undefined || typeof timeOutValue !== 'number' || timeOutValue < 0) { | ||
| const siEnabled = this._configurationService.getValue(TerminalSettingId.ShellIntegrationEnabled) === true; | ||
| // Discuss: This default from copilot chat setting feels pretty slow.. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's slow, but only if things don't work and only for the first command. We need to check the time against when processReady happens
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is what I have now below good?
I do math to subtract the processReadyTime from now.
vscode/src/vs/workbench/contrib/terminal/browser/terminalInstance.ts
Lines 935 to 955 in e46d70b
| const processReadyTime = this._processManager.processReadyTime; | |
| if (processReadyTime) { | |
| const elapsed = Date.now() - processReadyTime; | |
| timeoutMs = Math.max(0, timeoutMs - elapsed); | |
| } | |
| // Discuss: Talk about, get clarification one more time. | |
| await Promise.race([ | |
| new Promise<void>(r => { | |
| store.add(this.capabilities.onDidAddCommandDetectionCapability(e => { | |
| commandDetection = e; | |
| if (commandDetection.promptInputModel.state === PromptInputState.Input) { | |
| r(); | |
| } else { | |
| store.add(commandDetection.promptInputModel.onDidStartInput(() => { | |
| r(); | |
| })); | |
| } | |
| })); | |
| }), | |
| timeout(timeoutMs) |
...rkbench/contrib/terminalContrib/chatAgentTools/common/terminalChatAgentToolsConfiguration.ts
Outdated
Show resolved
Hide resolved
src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/toolTerminalCreator.ts
Outdated
Show resolved
Hide resolved
...rkbench/contrib/terminalContrib/chatAgentTools/common/terminalChatAgentToolsConfiguration.ts
Outdated
Show resolved
Hide resolved
src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/toolTerminalCreator.ts
Outdated
Show resolved
Hide resolved
…ering processReadytime
src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/toolTerminalCreator.ts
Show resolved
Hide resolved
src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/toolTerminalCreator.ts
Show resolved
Hide resolved
src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/toolTerminalCreator.ts
Show resolved
Hide resolved
...bench/contrib/terminalContrib/chatAgentTools/browser/terminal.chatAgentTools.contribution.ts
Outdated
Show resolved
Hide resolved
| const newSettingValue = this._configurationService.getValue<unknown>(TerminalSettingId.ShellIntegrationTimeout); | ||
| const deprecatedSettingValue = this._configurationService.getValue<unknown>(TerminalChatAgentToolsSettingId.ShellIntegrationTimeout); | ||
|
|
||
| if (!isNumber(newSettingValue) && isNumber(deprecatedSettingValue)) { | ||
| this._configurationService.updateValue(TerminalSettingId.ShellIntegrationTimeout, deprecatedSettingValue); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do the minimum work to gate this:
const deprecatedSettingValue = this._configurationService.getValue<unknown>(TerminalChatAgentToolsSettingId.ShellIntegrationTimeout);
if (isNumber(deprecatedSettingValue)) {
//...
}That makes it more clear and in the common case saves a couple of function calls.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, yeah.
Something like:
if (isNumber(deprecatedSettingValue)) {
const newSettingValue = configurationService.getValue<unknown>(TerminalSettingId.ShellIntegrationTimeout);
if (!isNumber(newSettingValue)) {
configurationService.updateValue(TerminalSettingId.ShellIntegrationTimeout, deprecatedSettingValue);
}
}
Tried to go one more step, and inverted the first if and return ear, what do you think? 262be84
src/vs/workbench/contrib/terminal/common/terminalConfiguration.ts
Outdated
Show resolved
Hide resolved
Co-authored-by: Daniel Imms <2193314+Tyriar@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Red CI
Resolves: #270813
Main points from: #272369 (comment)