@sagentlab/navarch-runtime 0.1.165 → 0.1.167

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.
@@ -306,10 +306,14 @@ async function runConversationTurn(deps, conversationId, turnId) {
306
306
  if (!run.lost)
307
307
  log.warn(`conversation ${conversationId} turn ${turnId} could not start: ${String(error).slice(0, 300)}`);
308
308
  }
309
- if (prepared && !run.lost) {
309
+ if (prepared && !run.lost && !controller.signal.aborted) {
310
310
  // After this write a crash can never lead to a second launch of this turn id.
311
311
  journal.state = "started";
312
312
  await deps.journal.write(journal);
313
+ }
314
+ // Lease loss, stop or shutdown can occur while the durable write is pending.
315
+ // Recheck authority immediately before calling the adapter.
316
+ if (prepared && !run.lost && !controller.signal.aborted) {
313
317
  run.launchedAt = node_perf_hooks_1.performance.now();
314
318
  const result = await deps.adapter.conversation.run({
315
319
  prompt, bin: deps.bin, ...(deps.model ? { model: deps.model } : {}),
package/dist/session.cjs CHANGED
@@ -761,7 +761,11 @@ async function runClaimedSession(deps, claimed, sessionId, lifecycle) {
761
761
  await gitWorktree.prepare();
762
762
  // Capture once before agent work. The server returns the first baseline
763
763
  // after a restart, so a retry cannot relabel inherited commits as output.
764
- if (claimed.delivery_baseline_required) {
764
+ // Reviews may check out an unmerged PR after prepare(). The production
765
+ // base counts those inherited commits as new work. Read the server's
766
+ // claim-time PR pin even for claims without the required-baseline flag.
767
+ // A continuation with no persisted pin must fail, never capture a late head.
768
+ if (claimed.delivery_baseline_required || task.task_type === "review") {
765
769
  const initialHead = await (0, delivery_cjs_1.captureDeliveryBaseline)(gitWorktree.worktreePath);
766
770
  if (!/^[0-9a-f]{40}$/.test(initialHead))
767
771
  throw new Error("Delivery baseline capture returned an invalid SHA");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sagentlab/navarch-runtime",
3
- "version": "0.1.165",
3
+ "version": "0.1.167",
4
4
  "description": "Navarch machine-side session manager: claims delivery tasks and runs them through local coding agents.",
5
5
  "type": "commonjs",
6
6
  "license": "MIT",