Skip to content

Commit ef2bc7b

Browse files
committed
🤖 fix: block background execution for SSH/remote workspaces
Add supportsBackgroundExecution property to Runtime interface to detect runtime capability. SSH workspaces return clear error message instead of failing with ENOENT or running on wrong host. TODO comments added for future SSH support via nohup/setsid.
1 parent 78e19d3 commit ef2bc7b

File tree

4 files changed

+26
-0
lines changed

4 files changed

+26
-0
lines changed

src/node/runtime/LocalRuntime.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ import { expandTilde } from "./tildeExpansion";
3939
export class LocalRuntime implements Runtime {
4040
private readonly srcBaseDir: string;
4141

42+
/** LocalRuntime supports background execution via detached process groups */
43+
readonly supportsBackgroundExecution = true;
44+
4245
constructor(srcBaseDir: string) {
4346
// Expand tilde to actual home directory path for local file system operations
4447
this.srcBaseDir = expandTilde(srcBaseDir);

src/node/runtime/Runtime.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,13 @@ export interface Runtime {
364364
* @returns Result with new workspace path and source branch, or error
365365
*/
366366
forkWorkspace(params: WorkspaceForkParams): Promise<WorkspaceForkResult>;
367+
368+
/**
369+
* Whether this runtime supports background process execution.
370+
* LocalRuntime: true (uses detached process groups)
371+
* SSHRuntime: false (TODO: implement via nohup/setsid + file-based output capture)
372+
*/
373+
readonly supportsBackgroundExecution: boolean;
367374
}
368375

369376
/**

src/node/runtime/SSHRuntime.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,12 @@ export class SSHRuntime implements Runtime {
7171
private readonly config: SSHRuntimeConfig;
7272
private readonly controlPath: string;
7373

74+
/**
75+
* SSHRuntime does not yet support background execution.
76+
* TODO: Implement via nohup/setsid + file-based output capture on remote host
77+
*/
78+
readonly supportsBackgroundExecution = false;
79+
7480
constructor(config: SSHRuntimeConfig) {
7581
// Note: srcBaseDir may contain tildes - they will be resolved via resolvePath() before use
7682
// The WORKSPACE_CREATE IPC handler resolves paths before storing in config

src/node/services/tools/bash.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,16 @@ export const createBashTool: ToolFactory = (config: ToolConfiguration) => {
249249
};
250250
}
251251

252+
// TODO: Add SSH runtime support for background processes (nohup/setsid + file-based output)
253+
if (!config.runtime.supportsBackgroundExecution) {
254+
return {
255+
success: false,
256+
error: "Background execution is not yet supported for SSH/remote workspaces",
257+
exitCode: -1,
258+
wall_duration_ms: 0,
259+
};
260+
}
261+
252262
if (!config.workspaceId || !config.backgroundProcessManager) {
253263
return {
254264
success: false,

0 commit comments

Comments
 (0)