{"record":{"id":"238388b0f4e37174","repo":"coleam00/Archon","slug":"approved-but-failed-to-resume-workflow-result-w","errorCode":null,"errorMessage":"Approved but failed to resume workflow '${result.workflowName}': ${err.message}\nThe approval was recorded. Run 'bun run cli workflow resume ${resolvedId}' to retry.","messagePattern":"Approved but failed to resume workflow '(.+?)': (.+?)\nThe approval was recorded\\. Run 'bun run cli workflow resume (.+?)' to retry\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/cli/src/commands/workflow.ts","lineNumber":4602,"sourceCode":"    const discoveryCwd = result.codebaseId\n      ? await resolveDiscoveryCwdForCodebase(resolvedId, result.codebaseId, 'approve')\n      : undefined;\n\n    await workflowRunCommand(result.workingPath, result.workflowName, result.userMessage ?? '', {\n      // Continue from the source this run froze, not a fresh capture of the target.\n      continuationRun: (await workflowDb.getWorkflowRun(resolvedId)) ?? undefined,\n      resume: true,\n      codebaseId: result.codebaseId ?? undefined,\n      conversationId: platformConversationId,\n      discoveryCwd,\n    });\n  } catch (error) {\n    const err = error as Error;\n    getLog().error(\n      { err, runId: resolvedId, workflowName: result.workflowName },\n      'cli.workflow_approve_resume_failed'\n    );\n    throw new Error(\n      `Approved but failed to resume workflow '${result.workflowName}': ${err.message}\\n` +\n        `The approval was recorded. Run 'bun run cli workflow resume ${resolvedId}' to retry.`,\n      { cause: err }\n    );\n  }\n}\n\n/**\n * Reject a paused workflow run by ID.\n * If the workflow has an on_reject prompt, auto-resumes with the rejection feedback;\n * otherwise marks the run as cancelled.\n *\n * `runId` may be the short id printed by `workflow runs` (see resolveRunIdArg).\n */\nexport async function workflowRejectCommand(\n  runId: string,\n  reason?: string,\n  json?: boolean,","sourceCodeStart":4584,"sourceCodeEnd":4620,"githubUrl":"https://github.com/coleam00/Archon/blob/0773b9745896ef0612e709c80845a0f7db315b19/packages/cli/src/commands/workflow.ts#L4584-L4620","documentation":"The approval itself succeeded, but the subsequent automatic resume of the workflow in its working path threw. The CLI wraps the original error so the operator knows the decision was recorded and gives the exact resume command to retry, instead of implying the approval failed.","triggerScenarios":"`workflow approve <id>` where approveWorkflow succeeds but the resume step fails — e.g. the working directory was deleted, permissions changed, the child process fails to spawn, the run already reached a terminal state, or a transient DB/lock error during resume.","commonSituations":"Workspaces cleaned up by scripts or `/tmp` reaping while a run awaited approval; Docker container removed between approval and resume; another operator already resumed or cancelled the run concurrently; file-permission changes after checkout.","solutions":["Run the suggested retry: `bun run cli workflow resume <resolvedId>` — this is the designed recovery path.","Inspect the underlying `cause` / the `cli.workflow_approve_resume_failed` log entry for the real failure (missing dir, permissions, spawn error).","Verify the working_path directory exists and is writable; restore it or point the record at a valid checkout if it was deleted.","Check the run's current state — if another actor already resumed or finished it, no retry is needed."],"exampleFix":"// before\ncatch (error) { throw error; } // ambiguous: did approval record?\n// after\ncatch (error) {\n  getLog().error({ err: error, runId }, 'cli.workflow_approve_resume_failed');\n  throw new Error(`Approved but failed to resume: ${(error as Error).message}\\nRun 'bun run cli workflow resume ${runId}' to retry.`, { cause: error });\n}","handlingStrategy":"retry","validationCode":"const stat = await fs.promises.stat(run.working_path).catch(() => null);\nif (!stat?.isDirectory()) throw new Error(`Workspace ${run.working_path} missing; restore before approving.`);","typeGuard":"null","tryCatchPattern":"try {\n  await approveWorkflow(resolvedId, comment);\n  await resumeWorkflow(resolvedId);\n} catch (err) {\n  getLog().error({ err, runId: resolvedId }, 'cli.workflow_approve_resume_failed');\n  console.error(`Approval recorded. Retry with: bun run cli workflow resume ${resolvedId}`);\n  process.exitCode = 1;\n}","preventionTips":["Do not delete or clean workspace directories while runs await gates","Retry with `workflow resume <id>` instead of re-approving","Check run state before retrying — another actor may have resumed it","Keep workspaces on storage that survives between approval and resume"],"tags":["cli","workflow","resume","filesystem"],"backgroundTag":"resume-after-gate-failed","analyzedSha":"0773b9745896ef0612e709c80845a0f7db315b19","analyzedAt":"2026-09-01T02:28:07.064Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}