@volter/supercode-orchestrator 0.4.11 → 0.4.12

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.
@@ -69,6 +69,9 @@ import * as events from '../events.mjs';
69
69
  import { httpJobExecutor } from '../hosted.mjs';
70
70
  import { SupercodeHarnessClient } from '@volter/supercode-harness-sdk';
71
71
 
72
+ /** How long a starting daemon waits for a stopping predecessor to release the home's lease. */
73
+ const LEASE_HANDOFF_MS = 20_000;
74
+
72
75
  /// Adapter selector -> constructor. A `platforms:` block picks its adapter by
73
76
  /// `extra.adapter` when it has one and by the block's own name otherwise, so
74
77
  /// `platforms.slack.extra.adapter: chat-sdk` and `platforms.api_server` both
@@ -596,6 +599,13 @@ async function main() {
596
599
  if (!args.once) {
597
600
  // Serialize lease replacement before loading state. An acquisition guard
598
601
  // left by a crash fails closed; inspect it before removing it manually.
602
+ // A service manager's restart starts this one while the last is still stopping (launchd's kickstart -k did, and
603
+ // this one exited 'already serving'): a live predecessor gets a moment to let go before it counts as serving.
604
+ for (let waited = 0; waited < LEASE_HANDOFF_MS; waited += 250) {
605
+ const previous = readLock(root);
606
+ if (!previous || previous.pid === process.pid || !leaseIsLive(previous)) break;
607
+ await new Promise((resolve) => setTimeout(resolve, 250));
608
+ }
599
609
  const guard = join(root, 'orchestrator.acquire');
600
610
  mkdirSync(guard);
601
611
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@volter/supercode-orchestrator",
3
- "version": "0.4.11",
3
+ "version": "0.4.12",
4
4
  "type": "module",
5
5
  "description": "The orchestrator runtime over the Volter Harness ontology: one typed operational model whose folder is its serialization, read and written through the harness orchestration doors (docs/ORCHESTRATOR-IR.md)",
6
6
  "exports": {