{"record":{"id":"c2b803e9f6272635","repo":"Yeachan-Heo/oh-my-codex","slug":"shutdown-shared-session-kind-replaceall-c2b803","errorCode":null,"errorMessage":"shutdown_shared_session_${kind.replaceAll(' ', '_')}_identity_changed:${paneId}","messagePattern":"shutdown_shared_session_(.+?)_identity_changed:(.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/team/runtime.ts","lineNumber":5186,"sourceCode":"      paneId: string;\n      pid: number;\n      owner: string | null;\n    };\n    const freezeSharedPaneAuthorization = (\n      paneId: string,\n      kind: 'HUD pane' | 'restore leader pane',\n      expectedPid?: number | null,\n    ): FrozenSharedPaneAuthorization => {\n      const proof = readExactPaneProofSync(paneId);\n      if (proof.status !== 'live') {\n        throw new Error(`shutdown_shared_session_${kind.replaceAll(' ', '_')}_proof_unavailable:${paneId}`);\n      }\n      if (typeof expectedPid === 'number') {\n        if (!Number.isSafeInteger(expectedPid) || expectedPid <= 0) {\n          throw new Error(`shutdown_shared_session_${kind.replaceAll(' ', '_')}_pid_missing:${paneId}`);\n        }\n        if (proof.pid !== expectedPid) {\n          throw new Error(`shutdown_shared_session_${kind.replaceAll(' ', '_')}_identity_changed:${paneId}`);\n        }\n      }\n      const owner = readPaneTeamOwnerTagResult(paneId);\n      if (owner.status === 'error') {\n        throw new Error(`shutdown_shared_session_${kind.replaceAll(' ', '_')}_owner_unavailable:${paneId}:${owner.error}`);\n      }\n      if (owner.status !== 'value' || !tmuxPaneOwnerId || owner.value !== tmuxPaneOwnerId) {\n        throw new Error(`shutdown_shared_session_${kind.replaceAll(' ', '_')}_owner_changed:${paneId}`);\n      }\n      return { paneId, pid: proof.pid, owner: owner.value };\n    };\n    const assertSharedPaneAuthorizationContinuous = (\n      authorization: FrozenSharedPaneAuthorization,\n      kind: 'HUD pane' | 'restore leader pane',\n    ): void => {\n      const scope = sharedSessionTopology ? 'shared_session' : 'detached_session';\n      const proof = readExactPaneProofSync(authorization.paneId);\n      if (proof.status !== 'live' || proof.pid !== authorization.pid) {","sourceCodeStart":5168,"sourceCodeEnd":5204,"githubUrl":"https://github.com/Yeachan-Heo/oh-my-codex/blob/3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2/src/team/runtime.ts#L5168-L5204","documentation":"Thrown during shared-session shutdown when the live pane proof's PID no longer matches the expected (persisted) PID. It protects against killing a process that now occupies the same pane id but is not the original HUD/restore-leader process.","triggerScenarios":"freezeSharedPaneAuthorization succeeds in reading a live proof, but proof.pid !== expectedPid — tmux reused the pane id for a new process, or the recorded PID is from a previous run.","commonSituations":"tmux pane was respawned (respawn-pane, automatic-rename cycles) reusing the %id; leftover config from a crashed previous session; PID wraparound after long uptime.","solutions":["Reset persisted pane ids/PIDs (hud_pane_id, hud_pane_pid) so shutdown re-discovers panes instead of trusting stale ids","Kill the orphaned/foreign pane manually and restart the team session","Verify no other tool is respawning panes inside the shared session"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"const live = readExactPaneProofSync(paneId); if (live.status !== 'live' || (expectedPid && live.pid !== expectedPid)) { /* drop pin */ }","typeGuard":null,"tryCatchPattern":"catch (e) { if (String(e.message).includes('_identity_changed:')) clearPersistedPaneIds(); }","preventionTips":["Treat pane id + pid pairs as opaque and short-lived","Re-derive pane pins after any respawn"],"tags":["tmux","pid-mismatch","pane-reuse","shutdown"],"backgroundTag":"stale-resource-id","analyzedSha":"3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2","analyzedAt":"2026-08-27T22:18:39.783Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}