Fix opencode model flag format and add agent execution logging
All checks were successful
CI / lint-and-test (push) Successful in 40s
Deploy Production / deploy (push) Successful in 1m27s
CI / build (push) Successful in 2m7s

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:
Julia McGhee
2026-03-22 14:06:02 +00:00
parent 8316796d81
commit 03cae22082
2 changed files with 12 additions and 1 deletions

View File

@@ -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);

View File

@@ -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",