@volter/supercode-orchestrator 0.4.49 → 0.4.51

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/board/cli.mjs CHANGED
@@ -1085,7 +1085,11 @@ async function serve(root, args = {}) {
1085
1085
  process.on('SIGTERM', stop);
1086
1086
  process.on('SIGINT', stop);
1087
1087
  const log = (text) => process.stdout.write(`${new Date().toISOString()} ${text}\n`);
1088
- log(`dispatching the boards of ${root} from ${localMachine()}`);
1088
+ // the orchestrator this serve runs, as installed: a newer install ends the serve after its tick, so whatever keeps it
1089
+ // running starts it again on the new code (a fix reaches the board with no hand relaunch)
1090
+ const installed = () => { try { return JSON.parse(readFileSync(new URL('../package.json', import.meta.url), 'utf8')).version ?? null; } catch { return null; } };
1091
+ const running = installed();
1092
+ log(`dispatching the boards of ${root} from ${localMachine()} (orchestrator ${running ?? 'unknown'})`);
1089
1093
  const stuck = {};
1090
1094
  const warned = {};
1091
1095
  let pausedSaid = false;
@@ -1113,6 +1117,8 @@ async function serve(root, args = {}) {
1113
1117
  } catch (error) {
1114
1118
  log(`tick failed: ${error.message}`);
1115
1119
  }
1120
+ const now = installed();
1121
+ if (running && now && now !== running) { log(`orchestrator ${now} is installed (this serve runs ${running}); stopping, for its keeper to start the new one`); break; }
1116
1122
  // the next tick is due an interval after this one began (a long tick is not followed by a full interval's wait)
1117
1123
  const rest = Math.max(1, interval - Math.floor((Date.now() - began) / 1000));
1118
1124
  for (let waited = 0; waited < rest && !stopped; waited += 1) await new Promise((done) => setTimeout(done, 1000));
@@ -580,13 +580,20 @@ function launchPane(board, task, runId, lane, fleet, { input = null, slot = 'wor
580
580
  const tail = model ? ['--model', model] : [];
581
581
  const base = ['open', '--new', 'claude', '--detach', '--on', task.machine, '--cwd', task.workspace_path];
582
582
  // the slot's last session: kept when live, resumed when lost, never another slot's (a reviewer's is its own)
583
- const prev = tx(board, (db) => lastSession(db, task.id, slot));
583
+ // a close its session's own command asked for is carried out first, so its pane is gone before the slot's next
584
+ // session starts (never two processes on one session)
585
+ let prev = tx(board, (db) => lastSession(db, task.id, slot));
586
+ if (prev?.close_requested && !prev.closed_at) {
587
+ closeRequested(board, { undelivered: [] });
588
+ prev = tx(board, (db) => lastSession(db, task.id, slot));
589
+ }
584
590
  let session = null;
585
591
  let replaced = null;
586
592
  if (prev?.forgotten) replaced = { session_id: prev.session_id, why: 'the workflow let it go' };
587
593
  else if (prev && prev.machine === machine) {
588
- // a session the board closed is not kept, whatever a fleet reading taken before the close still lists
589
- if (!prev.closed_at && sessionAlive(fleet, prev)) {
594
+ // a session the board closed, or one whose close its own command asked for (the next tick's sweep closes that
595
+ // run's pane), is not kept, whatever a fleet reading taken before the close still lists
596
+ if (!prev.closed_at && !prev.close_requested && sessionAlive(fleet, prev)) {
590
597
  // the session is kept; the heartbeat's count belongs to the run that ended, so the new run starts it again
591
598
  const { missing_since: _m, goal_turns: _t, goal_nudged_at: _n, close_requested: _q, closed_at: _c, ...kept } = prev;
592
599
  session = { ...kept, mode: 'adopt', launched_at: now(), seen_at: now() };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@volter/supercode-orchestrator",
3
- "version": "0.4.49",
3
+ "version": "0.4.51",
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": {