@volter/supercode-orchestrator 0.5.63 → 0.5.64

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 +17 -3
  2. package/package.json +1 -1
@@ -2396,7 +2396,7 @@ export async function plan({ root, lanes, settings, slugs = null, params = {} })
2396
2396
  const board = openBoard(root, slug);
2397
2397
  try {
2398
2398
  board.label = boardLabel(root, slug);
2399
- await activatePullRequestReviews(board, entry, report, [], { dry: true });
2399
+ await activatePullRequestReviews(board, entry, report, [], { dry: true, fleet });
2400
2400
  startCards(board, fleet, lanes, settings, report, entry, [], { dry: true, held });
2401
2401
  } finally { board.close(); }
2402
2402
  out.push(report);
@@ -2417,7 +2417,19 @@ function noCodeReviewDue(board, id) {
2417
2417
 
2418
2418
  /** An opened PR asks for the declared review transition once the arc's tasks are closed. */
2419
2419
  // A task written in the card's own Tasks section that did not become a subtask holds its review too.
2420
- async function activatePullRequestReviews(board, entry, report, effects, { only = null, dry = false } = {}) {
2420
+ /** The arc's session still in a turn: its review, and the close of that session the request brings (end_run), wait for
2421
+ * the turn to end, so work in flight is never cut (t_f34710bc's coder had a proof take running when its review was
2422
+ * requested at 15:01:13Z on 2026-10-04, and the close ended it). A session the reading cannot place waits on nothing. */
2423
+ function turnInFlight(board, id, fleet) {
2424
+ if (!fleet?.ok) return null;
2425
+ const session = currentRun(board.db, id)?.metadata?.supercode;
2426
+ if (!session?.session_id || session.surface === 'headless' || session.close_requested) return null;
2427
+ let turn = fleet.sessions?.find((x) => x.address === addressOf(session))?.turn ?? null;
2428
+ if (turn == null && session.surface === 'native') try { turn = nativeReading(nativeSessions(session.machine, session.harness ?? 'claude-code', session.session_id), session).row?.activity?.turn ?? null; } catch { /* unread: waits on nothing */ }
2429
+ return turn === 'working' ? `its session ${addressOf(session)} is in a turn; the review is requested once the turn ends` : null;
2430
+ }
2431
+
2432
+ async function activatePullRequestReviews(board, entry, report, effects, { only = null, dry = false, fleet = null } = {}) {
2421
2433
  const candidates = view(board, db => db.prepare(`SELECT t.id FROM tasks t JOIN supercode_cards c ON c.task_id=t.id
2422
2434
  WHERE c.subtask_of IS NULL AND c.every IS NULL
2423
2435
  AND t.workspace_kind!='scratch' ${only ? 'AND t.id=?' : ''}`).all(...(only ? [only] : [])));
@@ -2435,6 +2447,8 @@ async function activatePullRequestReviews(board, entry, report, effects, { only
2435
2447
  const ready = view(board, eligible);
2436
2448
  if (!ready) continue;
2437
2449
  if (ready !== true) { report.queued.push([id, `review waits: ${ready.length} open task(s) in the card's Tasks: ${ready[0].id} ${ready[0].title}`]); continue; }
2450
+ const inTurn = turnInFlight(board, id, fleet);
2451
+ if (inTurn) { report.queued.push([id, `review waits: ${inTurn}`]); continue; }
2438
2452
  let payload = null;
2439
2453
  try {
2440
2454
  payload = openReviewPullRequests(board, id);
@@ -2604,7 +2618,7 @@ export async function tick({ root, lanes, settings, only = null, slugs = null, d
2604
2618
  report.unsettled = [];
2605
2619
  report.promoted = recomputeReady(board, effects, report.unsettled);
2606
2620
  tx(board,db=>auditEndedRuns(db,board,entry));
2607
- if (dispatch) await activatePullRequestReviews(board, entry, report, effects, { only });
2621
+ if (dispatch) await activatePullRequestReviews(board, entry, report, effects, { only, fleet });
2608
2622
  if (dispatch && !stopping) startCards(board, fleet, lanes, settings, report, entry, effects, { only, held });
2609
2623
  phase('start');
2610
2624
  if (dispatch && !only && !report.paused) observeIdle(board, fleet, settings, report, entry, effects);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@volter/supercode-orchestrator",
3
- "version": "0.5.63",
3
+ "version": "0.5.64",
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": {