INNER CODE UNIT · TypeScript

owner

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

  const owner = await probeOwnerPastRestartParent(() => findProxyOwnerBeforeJournalRecovery({ probeConfiguredPort: true, deferPidCleanup: true }), restartParent);
  if (!owner.live) siblingStart = await recoverStartStateUnderOwnershipLease({
    supervised: supervisedServiceChild,
    acquireLease: () => acquireOwnershipMutationLease(serviceStatePaths()),
    decide: () => serviceChildOwnershipDecisionForClassifiedChild(supervisedServiceChild),
    stayOut: refusal => { console.error("❌ " + refusal); process.exit(serviceStayOutExitCode()); },
    recover: () => recoverStartJournalAfterOwnerRecheck(owner, siblingStart),
  });
  if (owner.live) {
    // Rationale and the full decision table live on `decideStartWithLiveOwner`.
    const decision = decideStartWithLiveOwner({
      livePort: owner.live.port,
      livePid: owner.live.pid, ...restartParent,
    });
    if (decision === "service-stay-out") {
      // A live owner is an intentional stay-out, not an unexpected child exit.
      console.log(`Proxy already running (PID ${owner.live.pid ?? owner.pidSnapshot ?? "unknown"}, port ${owner.live.port}); service wrapper staying out of the way.`);
      process.exit(serviceStayOutExitCode());

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…