From e133e06e3c1fd6b0865e525b64280e1e76010979 Mon Sep 17 00:00:00 2001 From: Brace Sproul Date: Wed, 28 May 2025 18:23:51 -0700 Subject: [PATCH] feat: Set a default env obj for calling shell tool (#45) * feat: Set a default env obj for calling shell tool * cr --- apps/open-swe/src/tools/shell.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/apps/open-swe/src/tools/shell.ts b/apps/open-swe/src/tools/shell.ts index f7241a1b..c8529b20 100644 --- a/apps/open-swe/src/tools/shell.ts +++ b/apps/open-swe/src/tools/shell.ts @@ -11,6 +11,11 @@ const logger = createLogger(LogLevel.INFO, "ShellTool"); const DEFAULT_COMMAND_TIMEOUT = 60_000; // 1 minute +const DEFAULT_ENV = { + // Prevents corepack from showing a y/n download prompt which causes the command to hang + COREPACK_ENABLE_DOWNLOAD_PROMPT: "0", +}; + const shellToolSchema = z.object({ command: z.array(z.string()).describe("The command to run"), workdir: z @@ -48,6 +53,7 @@ export const shellTool = tool( const result = await sandbox.commands.run(command.join(" "), { timeoutMs: timeout ?? DEFAULT_COMMAND_TIMEOUT, cwd: workdir, + envs: DEFAULT_ENV, }); if (result.error) {