{"record":{"id":"932d5084fd1532f9","repo":"Yeachan-Heo/oh-my-codex","slug":"session-pointer-committed-but-lock-release-left-r","errorCode":null,"errorMessage":"Session pointer committed, but lock release left recovery evidence.","messagePattern":"Session pointer committed, but lock release left recovery evidence\\.","errorType":"exception","errorClass":"CommittedLaunchBlockedError","httpStatus":null,"severity":"warning","filePath":"src/hooks/session.ts","lineNumber":3775,"sourceCode":"      ...(historyEntry.active_session_id ? { active_session_id: historyEntry.active_session_id } : {}),\n      ...(historyEntry.preserved_active_session_id ? { preserved_active_session_id: historyEntry.preserved_active_session_id } : {}),\n      timestamp: endTime,\n    }).catch(() => {});\n    traceSessionFinalizationOperation('session-end-log-done');\n  } catch (error) {\n    primary = error;\n  }\n\n  traceSessionFinalizationOperation('lock-release-start');\n  const releaseFailures = await releasePointerLock(lock);\n  traceSessionFinalizationOperation('lock-release-done');\n  if (primary) {\n    if (isSessionPointerLaunchAbort(primary) && releaseFailures.length > 0) {\n      throw recoveryAbort(context, primary as ResolvedSessionPointerAbort, releaseFailures, 'lock-release');\n    }\n    throw primary;\n  }\n  if (releaseFailures.length > 0) throw releaseFailureError(releaseFailures);\n  emitDegradedDurabilityWarning('session pointer end', tracker);\n  return revalidation;\n}\n\n/** Reset session-scoped HUD/metrics files at launch. */\nexport async function resetSessionMetrics(cwd: string, sessionId?: string): Promise<void> {\n  const context = resolveSessionPointerContext(cwd);\n  const omxDir = omxRoot(context.cwd);\n  await nodeMkdir(omxDir, { recursive: true });\n  await transactionDependencies.fs.mkdir(context.baseStateDir, { recursive: true });\n\n  const now = new Date().toISOString();\n  await nodeWriteFile(join(omxDir, 'metrics.json'), JSON.stringify({\n    total_turns: 0,\n    session_turns: 0,\n    last_activity: now,\n    session_input_tokens: 0,\n    session_output_tokens: 0,","sourceCodeStart":3757,"sourceCodeEnd":3793,"githubUrl":"https://github.com/Yeachan-Heo/oh-my-codex/blob/3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2/src/hooks/session.ts#L3757-L3793","documentation":"After a successful primary operation, the finalizer releases the pointer lock; if releasePointerLock returns failures, releaseFailureError(releaseFailures) is thrown with this message — the session pointer WAS committed, but the lock could not be fully released, leaving recovery evidence behind. The underlying release failures are included for diagnosis. Unlike error 1346, the data change succeeded; only cleanup failed.","triggerScenarios":"releasePointerLock failing to delete lock artifacts (stale lock file, rmdir/unlink errors) after the pointer transaction committed successfully — releaseFailures.length > 0 with no primary abort.","commonSituations":"Leftover lock files from prior crashed runs blocking cleanup removal; restrictive permissions on the lock directory; filesystems with delayed directory entry visibility (NFS, some CI runners); external processes recreating/holding lock files.","solutions":["Treat the session data as committed; run the explicit recovery/cleanup routine to remove leftover lock evidence","Inspect the lockPath directory and remove stale lock artifacts manually if recovery tooling is unavailable","Fix directory permissions so lock files can be unlinked","Add post-run hygiene (or a scheduled recovery pass) that clears stale locks before new sessions start"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Pre-clean stale lock artifacts before starting a session\nawait clearStalePointerLocks(lockPathDir, /* olderThan */ ms('1h'));","typeGuard":"function isReleaseFailure(e: unknown): boolean {\n  return typeof (e as { message?: string })?.message === 'string' &&\n    (e as { message: string }).message.includes('lock release left recovery evidence');\n}","tryCatchPattern":"catch (e) {\n  if (isReleaseFailure(e)) {\n    // data committed; schedule recovery cleanup and continue (warning, not fatal)\n    scheduleRecoveryCleanup(context);\n  } else throw e;\n}","preventionTips":["Treat this as non-fatal: the session pointer was committed successfully","Run periodic recovery passes to clear lock evidence","Keep lock directories on reliable local filesystems"],"tags":["session-pointer","lock","cleanup","filesystem"],"backgroundTag":"stale-lock-file","analyzedSha":"3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2","analyzedAt":"2026-08-27T22:18:39.783Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}