polygram 0.33.0 → 0.33.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/polygram.js CHANGED
@@ -68,6 +68,7 @@ const { createBuildSdkOptions } = require('./lib/sdk/build-options');
68
68
  const { createSdkCallbacks } = require('./lib/sdk/callbacks');
69
69
  const {
70
70
  createCodexRuntimeController,
71
+ resolveCodexStartupRecovery,
71
72
  } = require('./lib/codex/runtime-controller');
72
73
  const {
73
74
  buildCodexSpawnContext,
@@ -3510,6 +3511,12 @@ async function main() {
3510
3511
  db = dbClient.open(DB_PATH);
3511
3512
  console.log(`[db] opened ${DB_PATH}`);
3512
3513
  try {
3514
+ const startupRecovery = await resolveCodexStartupRecovery(pidClaim, {
3515
+ claimThrowsOnSurvivingPredecessor:
3516
+ processGuard.CLAIM_PID_FILE_THROWS_ON_SURVIVING_PREDECESSOR === true,
3517
+ persistedLeaseStatus: db.getCodexLease()?.status ?? null,
3518
+ supervisorGraceMs: processGuard.CODEX_SUPERVISOR_GRACE_MS,
3519
+ });
3513
3520
  codexRuntimeController = createCodexRuntimeController({
3514
3521
  config,
3515
3522
  db,
@@ -3520,6 +3527,7 @@ async function main() {
3520
3527
  path.join(process.env.HOME || DATA_DIR, '.claude'),
3521
3528
  ],
3522
3529
  logger: console,
3530
+ startupRecovery,
3523
3531
  });
3524
3532
  } catch (error) {
3525
3533
  codexRuntimeController = null;
@@ -3531,9 +3539,9 @@ async function main() {
3531
3539
  try {
3532
3540
  const codexBoot = codexRuntimeController.initialize();
3533
3541
  codexManagerOptions = codexBoot.managerOptions;
3534
- if (codexBoot.recovery.status === 'quarantined') {
3542
+ if (codexBoot.recovery.status !== 'clear') {
3535
3543
  console.warn(
3536
- `[codex] runtime quarantined at boot (${codexBoot.recovery.reason || 'unknown'})`,
3544
+ `[codex] runtime recovery blocked at boot (${codexBoot.recovery.reason || 'unknown'})`,
3537
3545
  );
3538
3546
  }
3539
3547
  } catch (error) {