{"record":{"id":"6530587af3ddc198","repo":"openclaw/openclaw","slug":"codex-session-cannot-be-archived-in-its-current-st","errorCode":null,"errorMessage":"Codex session cannot be archived in its current state","messagePattern":"Codex session cannot be archived in its current state","errorType":"validation","errorClass":"CatalogParamsError","httpStatus":null,"severity":"error","filePath":"extensions/codex/src/session-catalog.ts","lineNumber":836,"sourceCode":"    items: flattenTranscriptPageDesc(page),\n    ...(page.nextCursor ? { nextCursor: page.nextCursor } : {}),\n    ...(page.backwardsCursor ? { backwardsCursor: page.backwardsCursor } : {}),\n  };\n}\n\nfunction requireIdleThread(thread: CodexThread, action: \"continue\" | \"archive\"): void {\n  if (\n    thread.status?.type === \"idle\" ||\n    (action === \"archive\" && thread.status?.type === \"notLoaded\")\n  ) {\n    return;\n  }\n  if (thread.status?.type === \"active\") {\n    throw new CatalogParamsError(\n      `Codex session is active in this App Server; wait for it to finish before ${action === \"continue\" ? \"starting a branch\" : \"archiving\"}`,\n    );\n  }\n  throw new CatalogParamsError(\n    action === \"archive\"\n      ? \"Codex session cannot be archived in its current state\"\n      : \"Codex session cannot start a branch in its current state\",\n  );\n}\n\nfunction adoptionSessionKey(threadId: string): string {\n  const digest = createHash(\"sha256\").update(threadId).digest(\"hex\");\n  return `${CODEX_SUPERVISION_SESSION_KEY_PREFIX}${digest}`;\n}\n\nfunction isAdoptionSessionKeyForThread(sessionKey: string, threadId: string): boolean {\n  return adoptionSessionKeyRest(sessionKey) === adoptionSessionKey(threadId);\n}\n\ntype CodexSupervisionMarker = { sourceThreadId: string };\n\nasync function listAdoptedSessionEntries(params: {","sourceCodeStart":818,"sourceCodeEnd":854,"githubUrl":"https://github.com/openclaw/openclaw/blob/01804a75319da4b69c9ab98ceaa30477e22b8c0b/extensions/codex/src/session-catalog.ts#L818-L854","documentation":"Thrown by requireIdleThread when action is 'archive' and the thread status.type is neither 'idle', 'notLoaded' (the two acceptable archive states), nor 'active' (which has its own dedicated message). It covers any unrecognized or intermediate status — a defensive catch-all so the archive path does not proceed against an unexpected App Server state.","triggerScenarios":"requireIdleThread(thread, 'archive') with thread.status.type being some value other than idle/notLoaded/active (e.g. a future status enum, undefined status, or a state the plugin does not know how to handle).","commonSituations":"Codex app-server introduced a new status.type this plugin version does not recognize; thread.status is undefined/malformed; archive attempted during an intermediate transition state the plugin maps to neither active nor idle.","solutions":["Re-read the thread status (control.readThread) and inspect status.type; wait for it to settle into idle/notLoaded before archiving.","Upgrade the plugin to a version that understands the new status type returned by the app-server.","If status.type is unexpected/undefined, treat the thread as non-archivable and report the raw status for diagnostics.","Confirm @openai/codex version pin matches the running app-server."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"const fresh = await control.readThread(threadId, false);\nif (fresh.status?.type !== 'idle' && fresh.status?.type !== 'notLoaded') {\n  // do not attempt archive; report raw status\n}","typeGuard":"function isArchivable(t: { status?: { type?: string } }): boolean {\n  return t.status?.type === 'idle' || t.status?.type === 'notLoaded';\n}","tryCatchPattern":"try { requireIdleThread(thread, 'archive'); } catch (e) { if (e instanceof CatalogParamsError && /cannot be archived/.test(e.message)) reportUnexpectedStatus(thread.status); throw e; }","preventionTips":["Upgrade the plugin when the app-server adds new status types.","Treat unknown status as non-archivable in the UI.","Confirm @openai/codex version alignment."],"tags":["codex","thread-state","archive","unknown-status","version-skew"],"backgroundTag":null,"analyzedSha":"01804a75319da4b69c9ab98ceaa30477e22b8c0b","analyzedAt":"2026-08-12T04:37:58.197Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}