benignswarm 0.12.127 → 0.12.128

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.
@@ -256,7 +256,7 @@ export async function harnessStart(p, out, harness) {
256
256
  `If you ran on another machine before, read your latest note first: \`b9s handoffs --agent ${creds.agent}\` (your units, branches and chat are on the server as before).`,
257
257
  ].join("\n");
258
258
  const diagnostic = [];
259
- if (!(await beginTurnGuardAttempt(ref, turnsPerHour, (m) => diagnostic.push(m), process.env, unproductivePerHour, process.env.BSCHAT_MACHINE_SESSION_ID, harness))) {
259
+ if (!(await beginTurnGuardAttempt(ref, turnsPerHour, (m) => diagnostic.push(m), process.env, unproductivePerHour, process.env.BSCHAT_MACHINE_SESSION_ID, harness, session ? probeFor(harness, session, ref) : undefined))) {
260
260
  throw new CliError("turn_mode_fault", refusalReason(diagnostic));
261
261
  }
262
262
  reportMachineStartProgress("onboarding_turn_running");
@@ -580,7 +580,7 @@ export function runClaudeSandboxSelfCheck(bin, settings, maxBudgetUsd, env, cwd,
580
580
  /** Guard a model-spending connectivity preflight independently from the agent's real turn. */
581
581
  export async function runGuardedClaudeSandboxSelfCheck(ref, turnsPerHour, bin, settings, maxBudgetUsd, env, cwd, session, run = runClaudeSandboxSelfCheck, unproductivePerHour = DEFAULT_UNPRODUCTIVE_PER_HOUR) {
582
582
  const diagnostic = [];
583
- if (!(await beginTurnGuardAttempt(ref, turnsPerHour, (message) => diagnostic.push(message), process.env, unproductivePerHour, process.env.BSCHAT_MACHINE_SESSION_ID, "claude-code"))) {
583
+ if (!(await beginTurnGuardAttempt(ref, turnsPerHour, (message) => diagnostic.push(message), process.env, unproductivePerHour, process.env.BSCHAT_MACHINE_SESSION_ID, "claude-code", probeFor("claude-code", session, ref)))) {
584
584
  throw new CliError("turn_mode_fault", refusalReason(diagnostic));
585
585
  }
586
586
  const probe = probeFor("claude-code", session, ref);
@@ -631,7 +631,7 @@ export function assertAntigravitySelfCheck(output) {
631
631
  /** Run the two connectivity checks through the real model tools inside the per-turn sandbox. */
632
632
  export async function runAntigravitySandboxSelfCheck(ref, bin, settings, cwd, session, model, effort, timeoutSeconds, logPath, turnsPerHour = DEFAULT_TURNS_PER_HOUR, env = antigravityTurnEnv("workspace-write"), unproductivePerHour = DEFAULT_UNPRODUCTIVE_PER_HOUR) {
633
633
  const diagnostic = [];
634
- if (!(await beginTurnGuardAttempt(ref, turnsPerHour, (message) => diagnostic.push(message), process.env, unproductivePerHour, process.env.BSCHAT_MACHINE_SESSION_ID, "antigravity"))) {
634
+ if (!(await beginTurnGuardAttempt(ref, turnsPerHour, (message) => diagnostic.push(message), process.env, unproductivePerHour, process.env.BSCHAT_MACHINE_SESSION_ID, "antigravity", probeFor("antigravity", session, ref)))) {
635
635
  throw new CliError("turn_mode_fault", refusalReason(diagnostic));
636
636
  }
637
637
  const prompt = [
@@ -1035,7 +1035,7 @@ async function turnActivity(name, env) {
1035
1035
  return snapshot;
1036
1036
  }
1037
1037
  /** Reserve every actual harness launch, including b9s start's onboarding turn. */
1038
- export async function beginTurnGuardAttempt(name, turnsPerHour, log, env = process.env, unproductivePerHour = DEFAULT_UNPRODUCTIVE_PER_HOUR, machineSessionId = env.BSCHAT_MACHINE_SESSION_ID, harness) {
1038
+ export async function beginTurnGuardAttempt(name, turnsPerHour, log, env = process.env, unproductivePerHour = DEFAULT_UNPRODUCTIVE_PER_HOUR, machineSessionId = env.BSCHAT_MACHINE_SESSION_ID, harness, resample) {
1039
1039
  let current = readState(name, env);
1040
1040
  const creds = loadAgent(name, env);
1041
1041
  const waiting = current.turn_telemetry_completion_pending;
@@ -1078,6 +1078,13 @@ export async function beginTurnGuardAttempt(name, turnsPerHour, log, env = proce
1078
1078
  return false;
1079
1079
  if (!turnMemoryFloorAllows(log))
1080
1080
  return false;
1081
+ // An unverified turn is sampled again here, by whoever is about to start a turn. Only the
1082
+ // watcher's tick did so, and a session start refuses while a turn is unverified: when the watcher
1083
+ // was not running (a restart whose first turn failed and whose sample did not get through), start
1084
+ // was refused on every pass with the hour-old error and nothing ever sampled again. A sample that
1085
+ // fails leaves the turn unverified exactly as before; this adds a sample, never a verdict.
1086
+ if (resample && unverifiedTurn(current.turn_guard))
1087
+ await completePendingTurnGuard(name, resample, log, undefined, undefined, env);
1081
1088
  const before = await turnActivity(name, env);
1082
1089
  current = readState(name, env);
1083
1090
  if (current.turn_guard?.fault) {
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const CLI_VERSION = "0.12.127";
1
+ export const CLI_VERSION = "0.12.128";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "benignswarm",
3
- "version": "0.12.127",
3
+ "version": "0.12.128",
4
4
  "description": "b9s: chat, status board and evidence store for coding agents (benignswarm.org)",
5
5
  "license": "UNLICENSED",
6
6
  "repository": {