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

autoresearch_resume_terminal_run

autoresearch_resume_terminal_run

Error message

autoresearch_resume_terminal_run:${runId}

What it means

resumeAutoresearchRuntime throws (code autoresearch_resume_terminal_run) when the loaded manifest's status is anything other than 'running'. Runs that already completed, failed, or were discarded are terminal and cannot be resumed.

Source

Thrown at src/autoresearch/runtime.ts:971

    runDir,
    instructionsFile,
    manifestFile,
    ledgerFile,
    latestEvaluatorFile,
    resultsFile,
    stateFile,
    candidateFile,
    repoRoot: projectRoot,
    worktreePath,
    taskDescription,
  };
}

export async function resumeAutoresearchRuntime(projectRoot: string, runId: string): Promise<PreparedAutoresearchRuntime> {
  await assertAutoresearchLockAvailable(projectRoot);
  const manifest = await loadAutoresearchRunManifest(projectRoot, runId);
  if (manifest.status !== 'running') {
    throw new Error(`autoresearch_resume_terminal_run:${runId}`);
  }
  if (!existsSync(manifest.worktree_path)) {
    throw new Error(`autoresearch_resume_missing_worktree:${manifest.worktree_path}`);
  }
  await ensureRuntimeExcludes(manifest.worktree_path);
  await ensureAutoresearchWorktreeDependencies(projectRoot, manifest.worktree_path);
  assertResetSafeWorktree(manifest.worktree_path);
  await startMode('autoresearch', `autoresearch resume ${runId}`, 1, projectRoot);
  await activateAutoresearchRun(manifest);
  await updateModeState('autoresearch', {
    current_phase: 'running',
    run_id: manifest.run_id,
    run_tag: manifest.run_tag,
    mission_dir: manifest.mission_dir,
    mission_file: manifest.mission_file,
    sandbox_file: manifest.sandbox_file,
    mission_slug: manifest.mission_slug,
    repo_root: manifest.repo_root,

View on GitHub (pinned to 3ad79a8a6f)

Solutions

  1. Read the manifest at .omx/logs/autoresearch/<runId>/manifest.json and confirm its status; if not 'running', do not resume
  2. If you need another cycle, start a new autoresearch run instead of resuming the terminal one
  3. Make CI resume steps conditional on the manifest status being 'running'
  4. If the status looks wrong (run actually still mid-flight), investigate why it was finalized before overriding anything

Example fix

// before
await resumeAutoresearchRuntime(repoRoot, runId); // throws for completed run
// after
const m = JSON.parse(await readFile(join(repoRoot, '.omx/logs/autoresearch', runId, 'manifest.json'), 'utf8'));
if (m.status === 'running') await resumeAutoresearchRuntime(repoRoot, runId);
else await prepareAutoresearchRuntime(repoRoot, newTask); // start a new run
Defensive patterns

Strategy: validation

Validate before calling

import { readFile } from 'node:fs/promises';
const manifest = JSON.parse(await readFile(join(repoRoot, '.omx', 'logs', 'autoresearch', runId, 'manifest.json'), 'utf-8'));
if (manifest.status !== 'running') {
  throw new Error(`Run ${runId} is terminal (${manifest.status}); start a new run instead.`);
}

Type guard

function isRunningManifest(v: unknown): v is { status: 'running'; worktree_path: string } {
  return typeof v === 'object' && v !== null && (v as any).status === 'running';
}

Try / catch

try { await resumeAutoresearchRuntime(repoRoot, runId); }
catch (e) { if (e instanceof Error && e.message.startsWith('autoresearch_resume_terminal_run')) { /* start a new run instead of resuming */ } throw e; }

Prevention

When it happens

Trigger: Calling resumeAutoresearchRuntime(repoRoot, runId) for a run whose manifest.json has status 'complete', 'failed', 'aborted', etc. — commonly re-running a resume command after the run already finished successfully.

Common situations: CI retrying a job step after the run completed, double-executing a resume script, or manually flipping status in the manifest earlier.

Understand the failure class

Background: "Invalid state transition" errors: "status must be X, actually Y", "already rejected/charging/uninstalled", "cannot ... while running" — what they mean when a library rejects your call — this error's family across 31 libraries.

Related errors


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