Yeachan-Heo/oh-my-codex · error · AutoresearchGoalError

Autoresearch goal ${mission.slug} cannot complete until prof

Error message

Autoresearch goal ${mission.slug} cannot complete until professor-critic validation records verdict=pass in ${mission.completion_path}.

What it means

completeAutoresearchGoal requires that a professor-critic validation pass is recorded: the completion document must exist, have passed === true and verdict === 'pass'. Completing a goal without a passing validation verdict is rejected.

Source

Thrown at src/autoresearch/goal.ts:236

  mission.updated_at = now;
  await writeMission(cwd, mission);
  await writeFile(autoresearchGoalCompletionPath(cwd, mission.slug), `${JSON.stringify(completion, null, 2)}\n`, 'utf-8');
  await appendLedger(cwd, mission.slug, {
    ts: now,
    event: options.verdict === 'pass' ? 'validation_passed' : options.verdict === 'fail' ? 'validation_failed' : 'validation_blocked',
    slug: mission.slug,
    status: mission.status,
    evidence,
    artifact_path: options.artifactPath,
  });
  return { mission, completion };
}

export async function completeAutoresearchGoal(cwd: string, slug: string, options: CompleteAutoresearchGoalOptions = {}): Promise<{ mission: AutoresearchGoalMission; completion: AutoresearchGoalCompletion }> {
  const mission = await readAutoresearchGoal(cwd, slug);
  const completion = await readAutoresearchGoalCompletion(cwd, mission.slug);
  if (!completion || !completion.passed || completion.verdict !== 'pass') {
    throw new AutoresearchGoalError(`Autoresearch goal ${mission.slug} cannot complete until professor-critic validation records verdict=pass in ${mission.completion_path}.`);
  }
  const reconciliation = reconcileAutoresearchCodexGoalSnapshot(
    options.codexGoal === undefined ? null : parseCodexGoalSnapshot(options.codexGoal),
    mission,
    { requireSnapshot: true, requireComplete: true },
  );
  if (!reconciliation.ok) throw new AutoresearchGoalError(formatCodexGoalReconciliation(reconciliation));
  const completedAt = iso(options.now);
  mission.status = 'complete';
  mission.updated_at = completedAt;
  mission.completed_at = completedAt;
  await writeMission(cwd, mission);
  await appendLedger(cwd, mission.slug, {
    ts: completedAt,
    event: 'goal_completed',
    slug: mission.slug,
    status: mission.status,
    evidence: completion.evidence,

View on GitHub (pinned to 3ad79a8a6f)

Solutions

  1. Run the professor-critic validation and record verdict=pass via recordAutoresearchGoalVerdict first
  2. Inspect ${mission.completion_path} (printed in the message) and confirm passed === true and verdict === 'pass'
  3. If the critic verdict was fail, address the feedback and re-run validation before completing
  4. Ensure the completion file was not deleted or written under a different slug

Example fix

// before
await completeAutoresearchGoal(repoRoot, 'fix-leak'); // throws: no passing verdict
// after
await recordAutoresearchGoalVerdict(repoRoot, { slug: 'fix-leak', evidence: '...', /* verdict pass */ });
await completeAutoresearchGoal(repoRoot, 'fix-leak');
Defensive patterns

Strategy: validation

Validate before calling

const completion = await readAutoresearchGoalCompletion(cwd, slug);
if (!completion || !completion.passed || completion.verdict !== 'pass') {
  throw new Error('Cannot complete goal: professor-critic verdict=pass not yet recorded.');
}

Type guard

function hasPassingCompletion(c: { passed?: boolean; verdict?: string } | null): boolean {
  return !!c && c.passed === true && c.verdict === 'pass';
}

Try / catch

try { await completeAutoresearchGoal(cwd, slug); }
catch (e) { if (e instanceof AutoresearchGoalError && e.message.includes('verdict=pass')) { /* run critic validation, record verdict, retry */ } else throw e; }

Prevention

When it happens

Trigger: Calling completeAutoresearchGoal(cwd, slug) before recordAutoresearchGoalVerdict has written a passing completion, or when the completion file records a non-pass verdict (fail, or passed === false).

Common situations: Automation that runs completion immediately after candidate work without the critic validation step, a failed or missing professor-critic run, or reading the wrong completion file after renaming the mission.

Related errors


AI-assisted analysis of Yeachan-Heo/oh-my-codex@3ad79a8a6f (2026-08-27). Data as JSON: /api/errors/5756460d03a2af68. Report an issue: GitHub.