{"record":{"id":"c3f8e1ac28a90f17","repo":"stablyai/orca","slug":"orca-could-not-safely-move-this-legacy-codex-sessi","errorCode":null,"errorMessage":"Orca could not safely move this legacy Codex session into your system Codex home. Retry resume; if it still fails, check that both Codex session folders are readable and writable.","messagePattern":"Orca could not safely move this legacy Codex session into your system Codex home\\. Retry resume; if it still fails, check that both Codex session folders are readable and writable\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/main/codex/codex-legacy-session-resume.ts","lineNumber":56,"sourceCode":"    return { useRealCodexHome: false, substituteCodexHome }\n  }\n  const paths = resolveCodexSessionBackfillPaths(options.systemCodexHomePath)\n  const legacyCodexHomePath = options.legacyCodexHomePath ?? dirname(paths.managedSessionsRoot)\n  const managedSessionsRoot = join(legacyCodexHomePath, 'sessions')\n  if (\n    args.agent !== 'codex' ||\n    args.executionHostId !== LOCAL_EXECUTION_HOST_ID ||\n    !args.codexHome ||\n    !sameRuntimePath(args.codexHome, legacyCodexHomePath) ||\n    !options.isHostSystemDefaultRealHome()\n  ) {\n    return { useRealCodexHome: false }\n  }\n\n  const sourcePath = resolve(args.filePath)\n  const relativePath = relative(resolve(managedSessionsRoot), sourcePath)\n  if (!isDatedRolloutRelativePath(relativePath)) {\n    throw new Error(RETRYABLE_RESUME_ERROR)\n  }\n  const targetPath = join(paths.systemSessionsRoot, relativePath)\n  const key = `${normalizeRuntimePathForComparison(sourcePath)}\\0${normalizeRuntimePathForComparison(targetPath)}`\n  let task = materializations.get(key)\n  if (!task) {\n    task = materializeLegacyRollout(sourcePath, targetPath, paths.auditLogPath)\n    materializations.set(key, task)\n    void task.then(\n      () => {\n        if (materializations.get(key) === task) {\n          materializations.delete(key)\n        }\n      },\n      () => {\n        if (materializations.get(key) === task) {\n          materializations.delete(key)\n        }\n      }","sourceCodeStart":38,"sourceCodeEnd":74,"githubUrl":"https://github.com/stablyai/orca/blob/1136503c6a231a16dce8f921f6fadb63d181e8db/src/main/codex/codex-legacy-session-resume.ts#L38-L74","documentation":"Thrown (RETRYABLE_RESUME_ERROR) when preparing a legacy shared Codex session resume and the source file's path relative to the managed sessions root does not match the dated rollout layout (YYYY/MM/DD/rollout-*.jsonl[.zst]). isDatedRolloutRelativePath rejected it, so Orca refuses to relocate a file whose location it cannot safely map into the system Codex home.","triggerScenarios":"args.filePath lives outside sessions/YYYY/MM/DD/; the relative path escapes the root (starts with '..' or is absolute); the filename doesn't match rollout-*.jsonl or rollout-*.jsonl.zst; the path has the wrong number of segments (not exactly 4).","commonSituations":"A legacy session file was moved by the user into a non-standard layout; the codexHome path comparison resolved to a different root than expected; a rollout was renamed; the sessions root was restructured.","solutions":["Confirm args.filePath is under <legacyCodexHomePath>/sessions/YYYY/MM/DD/rollout-*.jsonl(.zst).","If the file was moved, restore it to the dated rollout path the session bridge originally wrote.","Verify args.codexHome and options.legacyCodexHomePath resolve to the same runtime path (sameRuntimePath).","Retry resume once the path is corrected — the message itself says retry is safe.","If the layout is genuinely non-standard, the resume declines gracefully only if isDatedRolloutRelativePath passes; reorganize the file."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"import { relative, resolve, sep } from 'node:path'\nfunction isDatedRolloutRelativePath(p: string): boolean {\n  if (!p || p.startsWith('..') || resolve(p) === p) return false\n  const parts = p.split(sep)\n  return parts.length === 4 && /^\\d{4}$/.test(parts[0]) && /^\\d{2}$/.test(parts[1]) && /^\\d{2}$/.test(parts[2]) && /^rollout-.+\\.jsonl(?:\\.zst)?$/.test(parts[3])\n}\n// Before calling prepareLegacySharedCodexSessionResume:\nconst rel = relative(resolve(join(legacyCodexHome, 'sessions')), resolve(args.filePath))\nif (!isDatedRolloutRelativePath(rel)) {\n  // decline resume; don't call the preparer\n}","typeGuard":null,"tryCatchPattern":"try {\n  await prepareLegacySharedCodexSessionResume(args, options)\n} catch (error) {\n  if (error instanceof Error && error.message === RETRYABLE_RESUME_ERROR) {\n    // surface a retry prompt to the user; do not auto-retry in a tight loop\n  } else throw error\n}","preventionTips":["Keep legacy rollouts under sessions/YYYY/MM/DD/rollout-*.jsonl(.zst).","Validate the dated layout before invoking the resume preparer.","Don't manually relocate or rename rollout files.","Ensure args.codexHome matches the legacy home path the bridge expects."],"tags":["codex","session-resume","legacy","path-validation","filesystem"],"backgroundTag":null,"analyzedSha":"1136503c6a231a16dce8f921f6fadb63d181e8db","analyzedAt":"2026-08-12T23:15:58.167Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}