{"record":{"id":"d356598fd26ddf58","repo":"coleam00/Archon","slug":"rejected-but-failed-to-resume-workflow-result-w","errorCode":null,"errorMessage":"Rejected but failed to resume workflow '${result.workflowName}': ${err.message}\nThe rejection was recorded. Run 'bun run cli workflow resume ${resolvedId}' to retry.","messagePattern":"Rejected but failed to resume workflow '(.+?)': (.+?)\nThe rejection 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":4740,"sourceCode":"    const discoveryCwd = result.codebaseId\n      ? await resolveDiscoveryCwdForCodebase(resolvedId, result.codebaseId, 'reject')\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_reject_resume_failed'\n    );\n    throw new Error(\n      `Rejected but failed to resume workflow '${result.workflowName}': ${err.message}\\n` +\n        `The rejection was recorded. Run 'bun run cli workflow resume ${resolvedId}' to retry.`,\n      { cause: err }\n    );\n  }\n}\n\n/**\n * Resolve a paused workflow run with any of its gate's declared decisions (#2707 step 2).\n * `approve`/`reject` delegate to the existing commands' exact behavior (the general-purpose\n * function underneath is the same `respondToWorkflow`, which is sugar over\n * `approveWorkflow`/`rejectWorkflow` for those two ids); any other declared decision always\n * resolves immediately and auto-resumes, mirroring `approve`'s shape.\n *\n * `runId` may be the short id printed by `workflow runs` (see resolveRunIdArg).\n */\nexport async function workflowRespondCommand(\n  runId: string,","sourceCodeStart":4722,"sourceCodeEnd":4758,"githubUrl":"https://github.com/coleam00/Archon/blob/0773b9745896ef0612e709c80845a0f7db315b19/packages/cli/src/commands/workflow.ts#L4722-L4758","documentation":"The rejection was successfully recorded, but the follow-up automatic resume threw. The CLI logs `cli.workflow_reject_resume_failed`, wraps the original error with `cause`, and tells the operator the exact resume command, making clear the rejection does not need to be repeated.","triggerScenarios":"`workflow reject <id>` where recording the rejection succeeds but resuming fails: working directory deleted or unwritable, child spawn failure, run concurrently moved to terminal state by another actor, or transient storage/DB error.","commonSituations":"Workspace cleaned up while the run awaited a gate decision; container/checkout removed; two operators acting on the same run simultaneously; NFS/permission issues in shared workspaces.","solutions":["Run `bun run cli workflow resume <resolvedId>` as the error suggests.","Read the `cause` and the `cli.workflow_reject_resume_failed` log entry to identify the real failure.","Recreate or restore the working directory if it was deleted, then retry the resume.","Check run state first — if it is already terminal (completed/cancelled elsewhere), skip the retry."],"exampleFix":"// before\ncatch (error) { console.error(error); process.exit(1); } // rejection state unclear\n// after\ncatch (error) {\n  getLog().error({ err: error, runId: resolvedId }, 'cli.workflow_reject_resume_failed');\n  throw new Error(`Rejected but failed to resume: ${(error as Error).message}\\nThe rejection was recorded. Run 'bun run cli workflow resume ${resolvedId}' 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} gone; restore before rejecting (resume would fail).`);","typeGuard":"null","tryCatchPattern":"try {\n  await rejectWorkflow(resolvedId, comment);\n  await resumeWorkflow(resolvedId);\n} catch (err) {\n  getLog().error({ err, runId: resolvedId }, 'cli.workflow_reject_resume_failed');\n  console.error(`Rejection recorded. Retry with: bun run cli workflow resume ${resolvedId}`);\n  process.exitCode = 1;\n}","preventionTips":["Never re-reject after this error — the rejection is recorded","Inspect the wrapped `cause` before retrying","Verify run state to detect concurrent actors","Preserve gate-awaiting workspaces across cleanup jobs"],"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"}