Skip to content

Commit 624a18b

Browse files
authored
Fix steady increase in terminal benchmark agent timeouts since 4/16 (#313059)
1 parent 1bc2aba commit 624a18b

1 file changed

Lines changed: 16 additions & 10 deletions

File tree

src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/runInTerminalTool.ts

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1739,22 +1739,28 @@ export class RunInTerminalTool extends Disposable implements IToolImpl {
17391739
* on a secondary prompt (e.g. heredoc continuation `> `), so the text
17401740
* explicitly:
17411741
* 1. Tells the model this note is NOT a signal to end the turn.
1742-
* 2. Leads with `get_terminal_output` as the safe recovery action.
1743-
* 3. Offers `send_to_terminal` / `vscode_askQuestions` only for real prompts.
1742+
* 2. In auto-approve mode, leads with `send_to_terminal` for non-secret
1743+
* prompts to minimize round-trips, with a `get_terminal_output` fallback.
1744+
* 3. In default mode, leads with `get_terminal_output` as the safe
1745+
* recovery action and offers `vscode_askQuestions` only for real prompts.
17441746
* `kill_terminal` is only advertised on the timeout branch — suggesting it
17451747
* in the general case leads the model to terminate valid interactive
17461748
* sessions (e.g. `npm init`) instead of driving them.
17471749
*/
17481750
private _buildInputNeededSteeringText(chatSessionResource: URI, termId: string, mentionTimeout: boolean): string {
17491751
const isAutoApproved = isSessionAutoApproveLevel(chatSessionResource, this._configurationService, this._chatWidgetService, this._chatService);
1750-
const realInputBranch = isAutoApproved
1751-
? `determine the answer and call ${TerminalToolId.SendToTerminal} with id="${termId}" (which returns the next few lines of output). Repeat one prompt at a time.`
1752-
: `call the vscode_askQuestions tool to ask the user, then send each answer using ${TerminalToolId.SendToTerminal} with id="${termId}" (which returns the next few lines of output). Repeat one prompt at a time.`;
1753-
const lines = [
1754-
`This note is not a signal to end the turn — pick one of the actions below and continue.`,
1755-
` 1. If the command may still be producing output or the shell prompt has not returned, call ${TerminalToolId.GetTerminalOutput} with id="${termId}" to continue polling. This is the default and safest action when unsure.`,
1756-
` 2. Only if the output clearly ends with a real input prompt (password:, Continue? (y/n), etc. — a normal shell prompt like \`$\` or \`#\` does NOT count), ${realInputBranch}`,
1757-
];
1752+
const lines: string[] = [];
1753+
lines.push(`This note is not a signal to end the turn — pick one of the actions below and continue.`);
1754+
if (isAutoApproved) {
1755+
// In auto-approve mode, prioritize direct action to minimize round-trips.
1756+
// askQuestions auto-responds in autopilot, so secret prompts should not be
1757+
// routed there — the model should skip secrets it cannot answer.
1758+
lines.push(` 1. If the output clearly ends with a non-secret input prompt (Continue? (y/n), Enter selection, etc. — a normal shell prompt like \`$\` or \`#\` does NOT count), determine the answer and immediately call ${TerminalToolId.SendToTerminal} with id="${termId}" (which returns the next few lines of output). Repeat one prompt at a time. Never guess passwords, passphrases, tokens, or other secrets — if the prompt requires a secret you do not have, inform the user and stop.`);
1759+
lines.push(` 2. If the command may still be producing output or the shell prompt has not returned, call ${TerminalToolId.GetTerminalOutput} with id="${termId}" to continue polling.`);
1760+
} else {
1761+
lines.push(` 1. If the command may still be producing output or the shell prompt has not returned, call ${TerminalToolId.GetTerminalOutput} with id="${termId}" to continue polling. This is the default and safest action when unsure.`);
1762+
lines.push(` 2. Only if the output clearly ends with a real input prompt (password:, Continue? (y/n), etc. — a normal shell prompt like \`$\` or \`#\` does NOT count), call the vscode_askQuestions tool to ask the user, then send each answer using ${TerminalToolId.SendToTerminal} with id="${termId}" (which returns the next few lines of output). Repeat one prompt at a time.`);
1763+
}
17581764
if (mentionTimeout) {
17591765
lines.push(` 3. A timeout does not mean the command failed — call ${TerminalToolId.GetTerminalOutput} with id="${termId}" to continue polling. Only call ${TerminalToolId.KillTerminal} if the command is genuinely hung and you need to retry with a different approach.`);
17601766
}

0 commit comments

Comments
 (0)