Skip to content

Commit f16a4f7

Browse files
fix: put 'run' subcommand first in args
1 parent 40be908 commit f16a4f7

1 file changed

Lines changed: 5 additions & 7 deletions

File tree

src/tools/opencode.tool.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@ function spawnOpenCodeProcess(
7878
const taskManager = getTaskManager();
7979

8080
// Build command arguments
81-
8281
const args: string[] = [
82+
CLI.SUBCOMMANDS.RUN,
8383
"--format", "json",
8484
CLI.FLAGS.MODEL, model,
8585
];
@@ -88,9 +88,6 @@ function spawnOpenCodeProcess(
8888
args.push(CLI.FLAGS.AGENT, agent);
8989
}
9090

91-
// Add the 'run' subcommand
92-
args.push(CLI.SUBCOMMANDS.RUN);
93-
9491
// Combine task with output guidance if provided
9592
const fullPrompt = outputGuidance
9693
? `${task}\n\nOutput guidance: ${outputGuidance}`
@@ -309,10 +306,9 @@ export function spawnContinueProcess(
309306
const taskManager = getTaskManager();
310307

311308
// Build command arguments for session continuation
312-
313309
const args: string[] = [
310+
CLI.SUBCOMMANDS.RUN,
314311
"--format", "json",
315-
"run",
316312
"--session", sessionId,
317313
];
318314

@@ -326,7 +322,7 @@ export function spawnContinueProcess(
326322

327323
Logger.debug(`Spawning OpenCode continuation: ${CLI.COMMANDS.OPENCODE} ${args.map(a => `"${a}"`).join(" ")}`);
328324

329-
// Spawn the process
325+
// Spawn of process
330326
const proc = spawn(CLI.COMMANDS.OPENCODE, args, {
331327
stdio: ["ignore", "pipe", "pipe"],
332328
shell: true,
@@ -388,6 +384,8 @@ export function spawnContinueProcess(
388384
} else if (signal) {
389385
taskManager.failTask(taskId, `Process killed by signal ${signal}`);
390386
}
387+
// If code is 0 but status is still working, the step_finish event should have handled completion
388+
// This is a fallback for edge cases
391389
}
392390

393391
activeProcesses.delete(taskId);

0 commit comments

Comments
 (0)