Fix opencode model flag format and add agent execution logging
OpenCode expects --model in provider/model format (e.g. opencode-go/minimax-m2.7) but buildAgentCommand was passing just the model ID. This caused opencode to silently fail with no output across all iterations. Also add logging for agent execution start/finish with exit code, output size, and duration to help diagnose future failures.
This commit is contained in:
@@ -118,7 +118,14 @@ export function buildAgentCommand(config: AgentConfig, prompt: string, workDir:
|
||||
const args = [runtime.cliCommand];
|
||||
|
||||
if (runtime.headlessFlag) args.push(runtime.headlessFlag);
|
||||
if (runtime.modelFlag && config.modelId) args.push(runtime.modelFlag, config.modelId);
|
||||
|
||||
if (runtime.modelFlag && config.modelId) {
|
||||
// OpenCode expects --model in provider/model format
|
||||
const modelArg = config.runtime === "opencode" && config.provider
|
||||
? `${config.provider}/${config.modelId}`
|
||||
: config.modelId;
|
||||
args.push(runtime.modelFlag, modelArg);
|
||||
}
|
||||
|
||||
if (runtime.promptFlag) {
|
||||
args.push(runtime.promptFlag, prompt);
|
||||
|
||||
@@ -308,6 +308,8 @@ async function runIteration(
|
||||
priorIterations,
|
||||
});
|
||||
|
||||
console.log(`[orchestrator] Running agent ${task.spec.agentId} for task ${task.id} iter ${n} in ${workDir}`);
|
||||
|
||||
const execResult = await executeAgent({
|
||||
agentId: task.spec.agentId,
|
||||
prompt,
|
||||
@@ -315,6 +317,8 @@ async function runIteration(
|
||||
signal: currentAbort?.signal,
|
||||
});
|
||||
|
||||
console.log(`[orchestrator] Agent finished: exit=${execResult.exitCode} killed=${execResult.killed} stdout=${execResult.stdout.length}b stderr=${execResult.stderr.length}b duration=${execResult.durationMs}ms`);
|
||||
|
||||
if (execResult.killed && currentAbort?.signal.aborted) {
|
||||
await updateIteration(task.id, n, {
|
||||
status: "failed",
|
||||
|
||||
Reference in New Issue
Block a user