Skip to content

Commit 0c99075

Browse files
committed
feat: enable background bash execution on Windows
1 parent 0cc4332 commit 0c99075

File tree

4 files changed

+15
-19
lines changed

4 files changed

+15
-19
lines changed

docs/system-prompt.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,5 +62,4 @@ You are in a git worktree at ${workspacePath}
6262
}
6363
```
6464

65-
6665
{/* END SYSTEM_PROMPT_DOCS */}

src/cli/run.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,13 @@ async function main(): Promise<void> {
269269
const partialService = new PartialService(config, historyService);
270270
const initStateManager = new InitStateManager(config);
271271
const backgroundProcessManager = new BackgroundProcessManager();
272-
const aiService = new AIService(config, historyService, partialService, initStateManager, backgroundProcessManager);
272+
const aiService = new AIService(
273+
config,
274+
historyService,
275+
partialService,
276+
initStateManager,
277+
backgroundProcessManager
278+
);
273279
ensureProvidersConfig(config);
274280

275281
const session = new AgentSession({

src/node/services/tools/bash.ts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -239,16 +239,6 @@ export const createBashTool: ToolFactory = (config: ToolConfiguration) => {
239239

240240
// Handle background execution
241241
if (run_in_background) {
242-
// TODO: Add Windows support for background processes (process groups work differently)
243-
if (process.platform === "win32") {
244-
return {
245-
success: false,
246-
error: "Background execution is not yet supported on Windows",
247-
exitCode: -1,
248-
wall_duration_ms: 0,
249-
};
250-
}
251-
252242
if (!config.workspaceId || !config.backgroundProcessManager || !config.runtime) {
253243
return {
254244
success: false,

tests/integration/backgroundBash.test.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ describeIntegration("Background Bash Execution", () => {
120120
const startEvents = await sendMessageAndWait(
121121
env,
122122
workspaceId,
123-
'Use the bash tool with run_in_background=true to run: sleep 30',
123+
"Use the bash tool with run_in_background=true to run: sleep 30",
124124
HAIKU_MODEL,
125125
BACKGROUND_TOOLS,
126126
30000
@@ -144,7 +144,8 @@ describeIntegration("Background Bash Execution", () => {
144144
// Verify the process appears in the list
145145
const responseText = extractTextFromEvents(listEvents);
146146
expect(
147-
responseText.includes(processId!) || toolOutputContains(listEvents, "bash_background_list", processId!)
147+
responseText.includes(processId!) ||
148+
toolOutputContains(listEvents, "bash_background_list", processId!)
148149
).toBe(true);
149150

150151
// Clean up: terminate the background process
@@ -196,7 +197,7 @@ describeIntegration("Background Bash Execution", () => {
196197
const startEvents = await sendMessageAndWait(
197198
env,
198199
workspaceId,
199-
'Use bash with run_in_background=true to run: sleep 300',
200+
"Use bash with run_in_background=true to run: sleep 300",
200201
HAIKU_MODEL,
201202
BACKGROUND_TOOLS,
202203
30000
@@ -236,8 +237,8 @@ describeIntegration("Background Bash Execution", () => {
236237
const listResponse = extractTextFromEvents(listEvents);
237238
expect(
238239
listResponse.toLowerCase().includes("killed") ||
239-
listResponse.toLowerCase().includes("terminated") ||
240-
toolOutputContains(listEvents, "bash_background_list", "killed")
240+
listResponse.toLowerCase().includes("terminated") ||
241+
toolOutputContains(listEvents, "bash_background_list", "killed")
241242
).toBe(true);
242243
} finally {
243244
await cleanup();
@@ -313,8 +314,8 @@ describeIntegration("Background Bash Execution", () => {
313314
// The main assertion is that the process was tracked
314315
expect(
315316
hasExited ||
316-
listResponse.includes(processId!) ||
317-
toolOutputContains(listEvents, "bash_background_list", processId!)
317+
listResponse.includes(processId!) ||
318+
toolOutputContains(listEvents, "bash_background_list", processId!)
318319
).toBe(true);
319320
} finally {
320321
await cleanup();

0 commit comments

Comments
 (0)