{"record":{"id":"488ca73e6171a995","repo":"Yeachan-Heo/oh-my-codex","slug":"detached-leader-authority-missing-before-rollback","errorCode":null,"errorMessage":"detached leader authority missing before rollback","messagePattern":"detached leader authority missing before rollback","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/cli/index.ts","lineNumber":6751,"sourceCode":"                  kind: report.kind,\n                };\n              blockMs(20);\n            }\n            return { acknowledged: false };\n          },\n          attachOrReturn: async () => { if (attachStep) execTmuxFileSync(attachStep.args, { stdio: \"inherit\" }); },\n          rollback: async (_ownedRecord, report) => {\n            const attempt = async (step: DetachedRollbackStep, operation: () => Promise<void> | void): Promise<void> => {\n              report.rollback.attempted.push(step);\n              try { await operation(); } catch (error) { report.rollback.failures.push({ step, status: \"failed\", code: detachedFailureCode(error) }); }\n            };\n            await attempt(\"parent-env\", async () => { if (detachedParentEnvFilePath) await rm(detachedParentEnvFilePath, { force: true }); });\n            await attempt(\"runtime-codex-home\", () => cleanupRuntimeCodexHome(runtimeCodexHomeForCleanup, projectLocalCodexHomeForCleanup));\n            await attempt(\"rollback\", () => { rmSync(releaseMarkerPath, { force: true }); rmSync(`${releaseMarkerPath}.release`, { force: true }); rmSync(`${releaseMarkerPath}.abort`, { force: true }); });\n            if (createdSession) {\n              for (const step of buildDetachedSessionRollbackSteps(sessionName, null, null, null)) {\n                await attempt(`session:${step.name}`, () => {\n                  if (!detachedLeaderAuthority) throw new Error(\"detached leader authority missing before rollback\");\n                  if (rollbackFromPreReportAuthority && step.name === \"kill-session\") {\n                    cleanupDetachedPreReportSession(detachedLeaderAuthority);\n                    return;\n                  }\n                  runDetachedLeaderMutation(detachedLeaderAuthority, step.args);\n                });\n              }\n            }\n          },\n        },\n      );\n      if (launchTerminal.kind === \"attached\" && detachedLeaderPid) {\n        // #3266: propagate the finalized detached child's exit status to the invoking shell.\n        // A rejected status protocol is only benign when the exact owned session\n        // provably survives (manual detach); a destroyed or ambiguous session with\n        // no authenticated finalized status is a protocol failure, never silent success.\n        const attachResolution = resolveDetachedAttachExitStatus(\n          releaseMarkerPath,","sourceCodeStart":6733,"sourceCodeEnd":6769,"githubUrl":"https://github.com/Yeachan-Heo/oh-my-codex/blob/3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2/src/cli/index.ts#L6733-L6769","documentation":"During rollback of a partially created detached session, the step executor requires detachedLeaderAuthority (the captured pane/session/PID fence) before running each rollback mutation. If creation never got far enough to capture authority but createdSession is true, rollback throws this per-step error (collected by attempt()).","triggerScenarios":"tmux new-session succeeded (createdSession=true) but leader authority capture failed or was skipped — e.g. pane id parse failure followed by rollback; or session creation happening via a path that does not populate the authority variable.","commonSituations":"Stacked on errors 187/188: unparseable new-session output leads to no authority, then teardown also fails; custom tmux configs corrupting new-session output are the usual root cause.","solutions":["Resolve the root bootstrap failure first (clean ~/.tmux.conf interference, upgrade tmux — see error 187)","After a failed launch, manually kill the leftover session: `tmux kill-session -t <name from logs>` since rollback could not","Clean all detached state files before the next attempt","Reinstall/rebuild OMX if you modified bootstrap code"],"exampleFix":"# manual cleanup after this error\n$ tmux kill-session -t <detached-session-name>\n$ rm -f ~/.omx/state/detached-*","handlingStrategy":"fallback","validationCode":"if (createdSession && !detachedLeaderAuthority) { await execTmux(`kill-session -t ${sessionName}`); /* manual teardown instead of rollback */ }","typeGuard":null,"tryCatchPattern":"try { launch(); } catch (e) { if (e instanceof AggregateError && e.errors.some((x) => /leader authority missing before rollback/.test(String(x)))) { await manualKillSession(); } throw e; }","preventionTips":["Resolve new-session output parsing issues (clean tmux config) so authority is captured","After this error, manually kill the leftover tmux session","Clean detached state before retrying"],"tags":["detached-launch","rollback","tmux","invariant"],"backgroundTag":"cleanup-step-failed","analyzedSha":"3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2","analyzedAt":"2026-08-27T22:18:39.783Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}