Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -967,7 +967,7 @@ export class RunInTerminalTool extends Disposable implements IToolImpl {
});
if (rewriteResult) {
rewrittenCommand = rewriteResult.rewritten;
forDisplayCommand = rewriteResult.forDisplay ?? forDisplayCommand;
forDisplayCommand = forDisplayCommand ?? rewriteResult.forDisplay;
if (rewriteResult.isSandboxWrapped) {
isSandboxWrapped = true;
} else if (rewriteResult.isSandboxWrapped === false) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,30 @@ suite('RunInTerminalTool', () => {
const terminalData = preparedInvocation.toolSpecificData as IChatTerminalToolInvocationData;
strictEqual(terminalData.commandLine.isSandboxWrapped, true);
});

test('should not show sandbox wrapper in chat when sandboxed async command is detached', async () => {
runInTerminalTool.setBackendOs(OperatingSystem.Linux);
setConfig(TerminalChatAgentToolsSettingId.DetachBackgroundProcesses, true);
sandboxEnabled = true;
sandboxPrereqResult = {
enabled: true,
sandboxConfigPath: '/tmp/vscode-sandbox-settings.json',
failedCheck: undefined,
};
terminalSandboxService.wrapCommand = (command: string) => ({
command: `sandbox-runtime ${command}`,
isSandboxWrapped: true,
});

const preparedInvocation = await executeToolTest({ command: 'echo hello', mode: 'async' });

ok(preparedInvocation, 'Expected prepared invocation to be defined');
strictEqual((preparedInvocation.invocationMessage as IMarkdownString).value, 'Running `echo hello` in sandbox');

const terminalData = preparedInvocation.toolSpecificData as IChatTerminalToolInvocationData;
strictEqual(terminalData.commandLine.forDisplay, 'echo hello');
strictEqual(terminalData.commandLine.toolEdited, 'nohup sandbox-runtime echo hello &');
});
});

suite('automatic sandbox retry', () => {
Expand Down
Loading