@volter/supercode-orchestrator 0.5.131 → 0.5.132

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.
Files changed (2) hide show
  1. package/board/dispatch.mjs +13 -5
  2. package/package.json +1 -1
@@ -642,7 +642,7 @@ async function stopSession(board, session) {
642
642
  return;
643
643
  }
644
644
  if (session.pane) {
645
- const r = await runtimeDoor(normalMachine(session.machine??localMachine())===localMachine()?null:session.machine,'harness.v1.panes.close',{pane:session.pane},{env:commandEnv(),timeout:60_000,as:boardAddress(board.label)});
645
+ const r = await runtimeDoor(normalMachine(session.machine??localMachine())===localMachine()?null:session.machine,'harness.v1.panes.close',{pane:session.pane,...(session.launch_key?{launch:session.launch_key}:{})},{env:commandEnv(),timeout:60_000,as:boardAddress(board.label)});
646
646
  // a door that timed out or could not be reached says nothing about the pane: the close waits for the next round
647
647
  const transient = doorTransient(r);
648
648
  if (r.code !== 0 || json(r.stdout.trim(), null)?.closed !== session.pane) throw new Error(`${transient ? 'close deferred: ' : ''}closing pane ${session.pane}: ${(r.stderr || r.stdout || `exit ${r.code}`).trim().slice(-500)}`);
@@ -1141,12 +1141,20 @@ export async function closeRequested(board, report, { taskId = null, caller = nu
1141
1141
  }
1142
1142
  // A final refusal stops further close attempts. Only an authorized observation of this exact pane may establish
1143
1143
  // absence: panes.list can be filtered or carry missing context keys. Unknown/invisible keeps the original failure.
1144
- const finalFailure = closeRefused(session);
1144
+ // A refusal's reason can end (the machine's daemon was replaced by one that reads the launch's starter): the same
1145
+ // reading says whether this board's close of the pane would be admitted now (`yours`), and a close it would admit
1146
+ // is tried again, unless an unended run works in the pane. A machine that does not say stays refused.
1147
+ let finalFailure = closeRefused(session);
1145
1148
  if (finalFailure) {
1146
1149
  if (!session.pane) continue;
1147
- const r = await doorOn(session.machine ?? localMachine(), 'harness.v1.panes.presence', { pane: session.pane }, { timeout: 10_000, as: boardAddress(board.label) });
1150
+ const r = await doorOn(session.machine ?? localMachine(), 'harness.v1.panes.presence', { pane: session.pane, ...(session.launch_key ? { launch: session.launch_key } : {}) }, { timeout: 10_000, as: boardAddress(board.label) });
1148
1151
  const observed = r.code === 0 ? json(r.stdout.trim(), null) : null;
1149
- if (observed?.pane !== session.pane || observed.present !== false) continue;
1152
+ if (observed?.pane !== session.pane) continue;
1153
+ if (observed.present === true && observed.yours === true) {
1154
+ if (view(board, (db) => db.prepare(`SELECT metadata FROM task_runs r WHERE r.ended_at IS NULL OR EXISTS (SELECT 1 FROM tasks t WHERE t.current_run_id = r.id)`).all())
1155
+ .some((r) => { const s = json(r.metadata, {})?.supercode; return s?.pane === session.pane && normalMachine(s.machine) === normalMachine(session.machine); })) continue;
1156
+ finalFailure = false;
1157
+ } else if (observed.present !== false) continue;
1150
1158
  }
1151
1159
  const active = view(board, (db) => db.prepare(`SELECT r.id, r.metadata FROM task_runs r WHERE r.ended_at IS NULL OR EXISTS (SELECT 1 FROM tasks t WHERE t.current_run_id = r.id)`).all());
1152
1160
  // Persist retries even for historical ends that did not have a close_session action. The close is claimed in the
@@ -1226,7 +1234,7 @@ export async function closeRequested(board, report, { taskId = null, caller = nu
1226
1234
  setRunSession(db, row.id, { ...current, close_attempted_at: at, close_attempts: Number(current.close_attempts ?? 0) + 1, close_error: error, ...(final ? { close_failed_at: at } : {}) });
1227
1235
  // Retain every attempt's latest fact, but avoid an unbounded thread of identical failures.
1228
1236
  if (current.close_error !== error) event(db, row.task_id, 'session_close_failed', { session_id: session.session_id, pane: session.pane, error, retry: !final }, row.id);
1229
- if (final) event(db, row.task_id, 'run_incident', { observation: 'close_failed', run: row.id, reason: `the board could not close ${addressOf(session)} and will not try again: ${error}`, session: session.session_id, machine: session.machine, pane: session.pane ?? null, evidence: { error } }, row.id);
1237
+ if (final && current.close_error !== error) event(db, row.task_id, 'run_incident', { observation: 'close_failed', run: row.id, reason: `the board could not close ${addressOf(session)} and will not try again: ${error}`, session: session.session_id, machine: session.machine, pane: session.pane ?? null, evidence: { error } }, row.id);
1230
1238
  } else if (!current.close_confirmed_at) {
1231
1239
  // a close another closer already confirmed (a claim that expired under it) is said once, by that closer
1232
1240
  const { close_error: _error, ...rest } = current;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@volter/supercode-orchestrator",
3
- "version": "0.5.131",
3
+ "version": "0.5.132",
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": {