{"record":{"id":"455ea6f6f3b88d17","repo":"Yeachan-Heo/oh-my-codex","slug":"detached-pane-metadata-was-not-committed-by-the-le","errorCode":null,"errorMessage":"detached pane metadata was not committed by the leader","messagePattern":"detached pane metadata was not committed by the leader","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"critical","filePath":"src/cli/index.ts","lineNumber":6686,"sourceCode":"          },\n          capturePane: async () => {\n            const report = readDetachedLeaderReport(releaseMarkerPath);\n            if (!detachedLeaderPaneId || report?.kind !== \"ready\" || report.paneId !== detachedLeaderPaneId || report.leaderPid !== detachedLeaderPid) {\n              throw new Error(\"detached ready report does not bind the leader pane\");\n            }\n            return detachedLeaderPaneId;\n          },\n          updateNameMetadata: async () => {\n            const state = await readSessionState(cwd, detachedSelectedStateEnv);\n            if (state?.session_id !== sessionId || state.tmux_session_name !== sessionName) {\n              throw new Error(\"detached session-name metadata was not committed by the leader\");\n            }\n            return \"committed-released\";\n          },\n          updatePaneMetadata: async (_binding, pane) => {\n            const state = await readSessionState(cwd, detachedSelectedStateEnv);\n            if (state?.session_id !== sessionId || state.tmux_pane_id !== pane) {\n              throw new Error(\"detached pane metadata was not committed by the leader\");\n            }\n            return \"committed-released\";\n          },\n          publishActiveRecord: async () => {\n            const activeRecordPath = contextKey ? madmaxDetachedActiveRecordPath(runsRoot, contextKey) : join(omxRoot(cwd), \"state\", \"detached-active-record.json\");\n            const record = readMadmaxDetachedActiveRecord(activeRecordPath);\n            if (!record || record.launch_nonce !== detachedLaunchNonce || record.leader_pid !== detachedLeaderPid || record.session_id !== sessionId || record.tmux_session_name !== sessionName || record.tmux_pane_id !== detachedLeaderPaneId) throw new Error(\"detached active record does not bind the ready leader\");\n            const bytes = readFileSync(activeRecordPath, \"utf-8\");\n            return { bytes, digest: createHash(\"sha256\").update(bytes).digest(\"hex\"), nonce: detachedLaunchNonce };\n          },\n          finalizeSetupFailure: async () => {},\n          releaseBarrier: async () => {\n            if (!detachedLeaderPid) throw new Error(\"detached leader PID missing before release\");\n            publishDetachedReleaseMarker(releaseMarkerPath, detachedLaunchNonce, sessionId, sessionName, detachedLeaderPid, detachedHudAuthority ?? undefined);\n          },\n          abortAndAwaitFinalization: async () => {\n            // The leader has the retained binding. Publishing abort is the only\n            // outer action permitted after a D9 write failure; a mismatched or","sourceCodeStart":6668,"sourceCodeEnd":6704,"githubUrl":"https://github.com/Yeachan-Heo/oh-my-codex/blob/3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2/src/cli/index.ts#L6668-L6704","documentation":"Same handshake family as 193 but for pane metadata: after the leader is told to commit the pane binding, OMX re-reads session state and requires session_id to match and tmux_pane_id to equal the expected pane. Otherwise the pane metadata commit is considered not performed and establishment fails.","triggerScenarios":"The leader did not write tmux_pane_id for this session_id into session state in time (or wrote a different pane) — leader crash, state file contention, wrong env-selected state path, or tmux pane id churn from splits happening during bootstrap.","commonSituations":"Custom tmux configs that auto-split panes on session creation changing pane ids mid-handshake; stale state files; concurrent launches; slow writes racing the immediate re-read.","solutions":["Clean stale state and retry; ensure the OMX state dir is writable and fast (avoid NFS home dirs)","Disable tmux hooks/plugins that create extra panes/windows on new sessions","Serialize detached launches so state files are not shared","Verify the leader command actually succeeded in tmux (attach and inspect, or check tmux capture-pane)"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"const state = await readSessionState(cwd, env);\nif (state?.session_id !== sessionId || state.tmux_pane_id !== pane) await sleep(50);","typeGuard":"function paneCommitted(s: any, sid: string, pane: string): boolean { return s?.session_id === sid && s?.tmux_pane_id === pane; }","tryCatchPattern":"try { establish(); } catch (e) { if (/pane metadata was not committed/.test(e.message)) { await cleanStaleState(); return establish(); } throw e; }","preventionTips":["Disable tmux hooks that create extra panes during bootstrap","Serialize detached launches sharing state files","Verify the leader command stays alive (no instant-exit spawn commands)"],"tags":["detached-launch","pane-metadata","session-state","race-condition"],"backgroundTag":"state-commit-verification-failed","analyzedSha":"3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2","analyzedAt":"2026-08-27T22:18:39.783Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}