INNER CODE UNIT · TypeScript

syncCleanup

lidge-jun/opencodex · src/cli/index.ts:648

  const syncCleanup = () => {
    if (cleaned) return cleanupSucceeded;
    cleaned = true;
    try { catalogHealer?.stop(); } catch { /* best-effort */ }
    try { routingHealer?.stop(); } catch { /* best-effort */ }
    try { guardian.stop(); } catch { /* best-effort */ }
    try { historyGuardian?.stop(); } catch { /* best-effort */ }
    try { healthSentinel?.stop(); } catch { /* best-effort */ }
    // Dashboard drain-and-restart (#563) must not tear down injection: the replacement
    // process expects Codex/Grok/env fences to still be in place. A sibling owns none of them.
    const teardown = preserveConnectedClientRoutingOnExit(decideStartExitTeardown({ sibling: siblingStart, recycling: isRecyclingForExit(), ocxService: process.env.OCX_SERVICE }));
    const restoreGuard = stopRestoreWriteGuard();
    if (teardown.revertSystemEnv) {
      try { revertSystemEnv(); } catch { /* best-effort */ }
    }
    removePid(process.pid);
    removeRuntimePort(process.pid);
    if (teardown.restoreNativeCodex) {

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…