{"record":{"id":"b9b21e21ecc82ec7","repo":"jackwener/OpenCLI","slug":"could-not-resolve-a-stable-codex-conversation-iden","errorCode":null,"errorMessage":"Could not resolve a stable Codex conversation identity.","messagePattern":"Could not resolve a stable Codex conversation identity\\.","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/codex/_actions.js","lineNumber":101,"sourceCode":"export async function readConversationProjects(page) {\n    const projects = unwrapEvaluateResult(await page.evaluate(`(${collectCodexProjectsFromDocument.toString()})()`));\n    if (!Array.isArray(projects)) {\n        throw new CommandExecutionError('Codex sidebar extraction returned an invalid payload.');\n    }\n    return projects;\n}\n\nexport async function resolveActionConversation(page, kwargs) {\n    const selected = await openCodexConversation(page, kwargs);\n    const projects = await readConversationProjects(page);\n    const resolved = selected\n        ? findCodexConversation(projects, selected)\n        : findActiveCodexConversation(projects);\n    if (!resolved) {\n        const hint = hasConversationTarget(kwargs)\n            ? 'The selected Codex conversation was not visible after selection.'\n            : 'Pass --project/--conversation/--index/--thread-id, or keep the active conversation visible in the sidebar.';\n        throw new CommandExecutionError('Could not resolve a stable Codex conversation identity.', hint);\n    }\n    if (!resolved.conversation.threadId) {\n        throw new CommandExecutionError(\n            'Could not resolve a stable Codex conversation identity.',\n            'The selected sidebar row is missing its Codex thread id; selectors may have drifted.',\n        );\n    }\n    return {\n        project: resolved.project.project,\n        projectPath: resolved.project.projectPath,\n        conversation: resolved.conversation.title,\n        threadId: resolved.conversation.threadId,\n        pinned: resolved.conversation.pinned,\n        index: resolved.conversation.index,\n    };\n}\n\nfunction conversationRefForError(ref) {","sourceCodeStart":83,"sourceCodeEnd":119,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/codex/_actions.js#L83-L119","documentation":"After (optionally) opening a conversation, resolveActionConversation matches the selected row against the extracted sidebar projects. If no project/conversation matches the requested --project/--conversation/--index/--thread-id (or no active conversation is visible), it throws this CommandExecutionError with a hint about how to disambiguate.","triggerScenarios":"Calling a Codex action whose target conversation is not present in the sidebar after selection: wrong --thread-id, index out of range, conversation archived/renamed, or the sidebar did not refresh after clicking the target.","commonSituations":"Stale thread ids from old sessions, conversations not visible because another project filter is active, slow sidebar updates after programmatic navigation.","solutions":["Pass an explicit --project/--conversation/--index/--thread-id that matches a visible sidebar row","Keep the target conversation visible/open in the Codex sidebar before running the action","Run `opencli codex projects` (or list) to see what the library currently resolves","Re-run after the sidebar finishes refreshing"],"exampleFix":"// before\nawait action(page, {}); // relies on active conversation\n// after\nawait action(page, { threadId: 'abc-123' }); // explicit target","handlingStrategy":"try-catch","validationCode":"const projects = await readConversationProjects(page);\nconst visible = projects.flatMap(p => p.conversations);\nif (kwargs.threadId && !visible.some(c => c.threadId === kwargs.threadId)) {\n  throw new Error(`Conversation ${kwargs.threadId} not visible in sidebar`);\n}","typeGuard":"function hasConversationTarget(kwargs) {\n  return Boolean(kwargs && (kwargs.project || kwargs.conversation || kwargs.index != null || kwargs.threadId));\n}","tryCatchPattern":"try {\n  await action(page, kwargs);\n} catch (e) {\n  if (e instanceof CommandExecutionError && e.message.includes('stable Codex conversation identity')) {\n    console.error(e.hint || 'Pass --project/--conversation/--index/--thread-id');\n  } else throw e;\n}","preventionTips":["Always pass an explicit --thread-id in scripts instead of relying on the active conversation","List current conversations before acting to confirm the target exists","Wait for sidebar refresh after navigation before resolving","Handle archived/renamed conversations by re-listing ids"],"tags":["browser-automation","ui-selector","resolution-failed"],"backgroundTag":"conversation-not-resolved","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}