@taskless-app/swarm 0.6.100 → 0.6.101

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/dist/cli.js CHANGED
@@ -4490,7 +4490,7 @@ var init_package = __esm({
4490
4490
  "package.json"() {
4491
4491
  package_default = {
4492
4492
  name: "@taskless-app/swarm",
4493
- version: "0.6.100",
4493
+ version: "0.6.101",
4494
4494
  type: "module",
4495
4495
  description: "Local control plane for a fleet of AI coding agents (drones), coordinating through Taskless. The overmind runs the swarm.",
4496
4496
  keywords: [
@@ -4542,7 +4542,7 @@ var init_package = __esm({
4542
4542
  undici: "^7.30.1",
4543
4543
  zod: "3.25.76"
4544
4544
  },
4545
- gitHead: "a0643b2118fce225b5afbe7ce9c1afbe7cd25d39"
4545
+ gitHead: "9216f89857eb8625eecb9a3ededb87cb65a15dec"
4546
4546
  };
4547
4547
  }
4548
4548
  });
package/dist/overmind.js CHANGED
@@ -14909,7 +14909,7 @@ function parkReasonUnretriable(reason) {
14909
14909
  // package.json
14910
14910
  var package_default = {
14911
14911
  name: "@taskless-app/swarm",
14912
- version: "0.6.100",
14912
+ version: "0.6.101",
14913
14913
  type: "module",
14914
14914
  description: "Local control plane for a fleet of AI coding agents (drones), coordinating through Taskless. The overmind runs the swarm.",
14915
14915
  keywords: [
@@ -14961,7 +14961,7 @@ var package_default = {
14961
14961
  undici: "^7.30.1",
14962
14962
  zod: "3.25.76"
14963
14963
  },
14964
- gitHead: "a0643b2118fce225b5afbe7ce9c1afbe7cd25d39"
14964
+ gitHead: "9216f89857eb8625eecb9a3ededb87cb65a15dec"
14965
14965
  };
14966
14966
 
14967
14967
  // src/version.ts
@@ -16328,6 +16328,31 @@ function reviewCyclesExhausted(run2) {
16328
16328
  function needsFixIteration(run2) {
16329
16329
  return run2.review_verdict === "changes" || isNegativeVerifyVerdict(toVerifyVerdict(run2.verify_verdict));
16330
16330
  }
16331
+ function fixPartnerHold(input) {
16332
+ const reviewOpen = input.reviewVerdict == null;
16333
+ const verifyOpen = input.verifyVerdict == null;
16334
+ const waitingOn = verifyOpen && input.verifierWorking ? "verifier" : reviewOpen && input.reviewerWorking ? "reviewer" : null;
16335
+ if (!waitingOn) return { action: "wake" };
16336
+ const elapsed = input.verdictAtMs == null ? 0 : input.nowMs - input.verdictAtMs;
16337
+ if (!Number.isFinite(elapsed)) return { action: "partial", waitingOn };
16338
+ if (elapsed < input.waitMs) return { action: "wait", waitingOn };
16339
+ return { action: "partial", waitingOn };
16340
+ }
16341
+ var VERDICT_HEAD_RE = /\[head ([0-9a-f]{7,40})\]/i;
16342
+ var VERDICT_HEAD_SHA = /^[0-9a-f]{7,40}$/i;
16343
+ function appendVerdictHead(text, sha) {
16344
+ const trimmed = sha?.trim() ?? "";
16345
+ if (!VERDICT_HEAD_SHA.test(trimmed)) return text;
16346
+ if (VERDICT_HEAD_RE.test(text)) return text;
16347
+ return `${text} [head ${trimmed}]`;
16348
+ }
16349
+ function verdictHeadSha(text) {
16350
+ if (!text) return null;
16351
+ return text.match(VERDICT_HEAD_RE)?.[1] ?? null;
16352
+ }
16353
+ function stripVerdictHead(text) {
16354
+ return text.replace(/[ \t]*\[head [0-9a-f]{7,40}\]/gi, "").trim();
16355
+ }
16331
16356
  function reviewTransitionPatch(run2, prUrl) {
16332
16357
  const isFixIteration = needsFixIteration(run2);
16333
16358
  if (isFixIteration) {
@@ -16994,8 +17019,13 @@ ${failText}` : failText }],
16994
17019
  }
16995
17020
  const reviewed = await store.getRun(run2.reviews_run_id);
16996
17021
  const verdictText = verdictLabel(verdict);
17022
+ const reviewHead = await headSha(opts.worktree ?? process.cwd());
16997
17023
  await store.updateRun(run2.reviews_run_id, { review_verdict: verdict });
16998
- await store.addEvent(run2.reviews_run_id, "step", `\u0432\u0435\u0440\u0434\u0438\u043A\u0442 \u0440\u0435\u0432\u044C\u044E \u043E\u0442 ${run2.name}: ${verdictText}${summary ? ` \u2014 ${summary}` : ""}`);
17024
+ await store.addEvent(
17025
+ run2.reviews_run_id,
17026
+ "step",
17027
+ appendVerdictHead(`\u0432\u0435\u0440\u0434\u0438\u043A\u0442 \u0440\u0435\u0432\u044C\u044E \u043E\u0442 ${run2.name}: ${verdictText}${summary ? ` \u2014 ${summary}` : ""}`, reviewHead)
17028
+ );
16999
17029
  const reviewedSlug = reportSlug(reviewed?.task_slug);
17000
17030
  let shots = { attachments: [], warning: "" };
17001
17031
  let commentWarning = "";
@@ -17061,8 +17091,13 @@ ${failText}` : failText }],
17061
17091
  }
17062
17092
  const verified = await store.getRun(run2.verifies_run_id);
17063
17093
  const verdictText = verifyVerdictLabel(verdict);
17094
+ const verifyHead = await headSha(opts.worktree ?? process.cwd());
17064
17095
  await store.updateRun(run2.verifies_run_id, { verify_verdict: verdict });
17065
- await store.addEvent(run2.verifies_run_id, "step", `\u0432\u0435\u0440\u0434\u0438\u043A\u0442 \u0432\u0435\u0440\u0438\u0444\u0438\u043A\u0430\u0446\u0438\u0438 \u043E\u0442 ${run2.name}: ${verdictText}${summary ? ` \u2014 ${summary}` : ""}`);
17096
+ await store.addEvent(
17097
+ run2.verifies_run_id,
17098
+ "step",
17099
+ appendVerdictHead(`\u0432\u0435\u0440\u0434\u0438\u043A\u0442 \u0432\u0435\u0440\u0438\u0444\u0438\u043A\u0430\u0446\u0438\u0438 \u043E\u0442 ${run2.name}: ${verdictText}${summary ? ` \u2014 ${summary}` : ""}`, verifyHead)
17100
+ );
17066
17101
  const verifiedSlug = reportSlug(verified?.task_slug);
17067
17102
  let shots = { attachments: [], warning: "" };
17068
17103
  let commentWarning = "";
@@ -22340,8 +22375,32 @@ function promptStandRule(worktree, slug) {
22340
22375
  const prefix = composeProjectPrefix(basename7(raw));
22341
22376
  return prefix ? dockerStandRules(prefix, homedir10()) : "";
22342
22377
  }
22378
+ var FIX_NO_REVIEW_ITEMS = "\u0420\u0435\u0432\u044C\u044E\u0435\u0440 \u043F\u0440\u0430\u0432\u043E\u043A \u043D\u0435 \u043F\u0440\u043E\u0441\u0438\u043B.";
22379
+ var FIX_NO_VERIFY_ITEMS = "\u0412\u0435\u0440\u0438\u0444\u0438\u043A\u0430\u0442\u043E\u0440 \u043F\u043E\u0434\u0442\u0432\u0435\u0440\u0434\u0438\u043B \u2014 \u043E\u0442\u0434\u0435\u043B\u044C\u043D\u044B\u0445 \u043D\u0430\u0445\u043E\u0434\u043E\u043A \u043D\u0435\u0442.";
22380
+ var FIX_NO_VERDICT_YET = "\u0412\u0435\u0440\u0434\u0438\u043A\u0442\u0430 \u043D\u0430 \u044D\u0442\u0443 \u0433\u043E\u043B\u043E\u0432\u0443 \u043D\u0435\u0442.";
22381
+ var FIX_VERDICT_MISSING = "\u0412\u0435\u0440\u0434\u0438\u043A\u0442 \u043D\u0435 \u0441\u043E\u0445\u0440\u0430\u043D\u0438\u043B\u0441\u044F \u0432 \u043B\u0435\u043D\u0442\u0435 \u2014 \u0447\u0438\u0442\u0430\u0439 \u0435\u0433\u043E \u043A\u043E\u043C\u043C\u0435\u043D\u0442\u043E\u043C \u0432 PR (\u043A\u043E\u043C\u0430\u043D\u0434\u0430 \u043D\u0438\u0436\u0435).";
22382
+ function fixShaLine(sha) {
22383
+ return sha && /^[0-9a-f]{7,40}$/i.test(sha) ? `SHA: ${sha}` : "SHA: \u043D\u0435 \u0437\u0430\u043F\u0438\u0441\u0430\u043D";
22384
+ }
22385
+ function renderFixVerdicts(verdict, review, verify) {
22386
+ const reviewBody = review?.body?.trim() || null;
22387
+ const verifyBody = verify?.body?.trim() || null;
22388
+ if (review && verify && (reviewBody || verifyBody)) {
22389
+ return [
22390
+ "### \u041F\u0443\u043D\u043A\u0442\u044B \u0440\u0435\u0432\u044C\u044E\u0435\u0440\u0430",
22391
+ fixShaLine(review.sha),
22392
+ reviewBody ?? (review.recorded ? FIX_VERDICT_MISSING : FIX_NO_VERDICT_YET),
22393
+ "",
22394
+ "### \u041D\u0430\u0445\u043E\u0434\u043A\u0438 \u0432\u0435\u0440\u0438\u0444\u0438\u043A\u0430\u0442\u043E\u0440\u0430",
22395
+ fixShaLine(verify.sha),
22396
+ verifyBody ?? (verify.recorded ? FIX_VERDICT_MISSING : FIX_NO_VERDICT_YET)
22397
+ ].join("\n");
22398
+ }
22399
+ return verdict ?? FIX_VERDICT_MISSING;
22400
+ }
22343
22401
  function buildChangesFixPrompt(args) {
22344
- const { prUrl, slug, branch, base: base3, worktree, verdict } = args;
22402
+ const { prUrl, slug, branch, base: base3, worktree } = args;
22403
+ const verdictBlock = renderFixVerdicts(args.verdict, args.reviewSection, args.verifySection);
22345
22404
  const baseRef = base3 ? `origin/${base3}` : "origin/HEAD";
22346
22405
  const standRule = promptStandRule(worktree, slug);
22347
22406
  return [
@@ -22367,7 +22426,7 @@ function buildChangesFixPrompt(args) {
22367
22426
  "\u041C\u043E\u043B\u0447\u0430 \u043F\u0440\u043E\u043F\u0443\u0449\u0435\u043D\u043D\u044B\u0439 \u043F\u0443\u043D\u043A\u0442 \u2014 \u043D\u0435 \u0441\u0434\u0430\u043D\u043E.",
22368
22427
  "\u0415\u0441\u043B\u0438 \u0432\u0435\u0440\u0434\u0438\u043A\u0442 \u0434\u0430\u0451\u0442 \u0433\u043E\u0442\u043E\u0432\u043E\u0435 \u0440\u0435\u0448\u0435\u043D\u0438\u0435 (\xAB\u0441\u0434\u0435\u043B\u0430\u0439 \u0442\u0430\u043A\xBB), \u0432\u044B\u043F\u043E\u043B\u043D\u0438 \u0435\u0433\u043E \u043A\u0430\u043A \u043D\u0430\u043F\u0438\u0441\u0430\u043D\u043E, \u0430 \u043D\u0435 \u043F\u043E-\u0441\u0432\u043E\u0435\u043C\u0443.",
22369
22428
  "",
22370
- verdict ?? "\u0412\u0435\u0440\u0434\u0438\u043A\u0442 \u043D\u0435 \u0441\u043E\u0445\u0440\u0430\u043D\u0438\u043B\u0441\u044F \u0432 \u043B\u0435\u043D\u0442\u0435 \u2014 \u0447\u0438\u0442\u0430\u0439 \u0435\u0433\u043E \u043A\u043E\u043C\u043C\u0435\u043D\u0442\u043E\u043C \u0432 PR (\u043A\u043E\u043C\u0430\u043D\u0434\u0430 \u043D\u0438\u0436\u0435).",
22429
+ verdictBlock,
22371
22430
  "",
22372
22431
  "## \u0412\u0432\u0435\u0434\u0438 \u0441\u0435\u0431\u044F \u0432 \u043A\u0443\u0440\u0441 \u0421\u0410\u041C \u2014 \u043F\u0430\u043C\u044F\u0442\u0438 \u043F\u0440\u043E\u0448\u043B\u043E\u0439 \u0441\u0435\u0441\u0441\u0438\u0438 \u0443 \u0442\u0435\u0431\u044F \u043D\u0435\u0442",
22373
22432
  "```",
@@ -23889,6 +23948,27 @@ async function liftFixIterationStep(deps, snapshot, st, _stormActive, now, drone
23889
23948
  }
23890
23949
  return run2;
23891
23950
  }
23951
+ function sameCycleCheckerWorking(runs, cycle, respectAwaitingCi) {
23952
+ return runs.some((r) => {
23953
+ if ((r.review_cycle ?? 0) !== cycle) return false;
23954
+ if (r.status === "stalled") return false;
23955
+ if (r.status === "paused" && isLimitWait(r.stop_reason)) return false;
23956
+ if (respectAwaitingCi && isAwaitingCi(r.status, r.stop_reason)) return false;
23957
+ return true;
23958
+ });
23959
+ }
23960
+ function noteFixPartnerTimeout(deps, run2, waitingOn) {
23961
+ const cycle = run2.review_cycle ?? 0;
23962
+ const mark = `\u0432\u0442\u043E\u0440\u043E\u0439 \u0432\u0435\u0440\u0434\u0438\u043A\u0442 \u0442\u043E\u0439 \u0436\u0435 \u0433\u043E\u043B\u043E\u0432\u044B \u043D\u0435 \u0434\u043E\u0436\u0434\u0430\u043B\u0438\u0441\u044C (\u043A\u0440\u0443\u0433 ${cycle})`;
23963
+ if (deps.db.events(run2.id).some((e) => (e.text ?? "").includes(mark))) return;
23964
+ const who = waitingOn === "verifier" ? "\u0432\u0435\u0440\u0438\u0444\u0438\u043A\u0430\u0442\u043E\u0440" : "\u0440\u0435\u0432\u044C\u044E\u0435\u0440";
23965
+ const mins = Math.max(1, Math.round(CHANGES_FRESH_WAKE_AFTER_MS / 6e4));
23966
+ deps.db.addEvent(
23967
+ run2.id,
23968
+ "step",
23969
+ `${mark}: ${who} \u0435\u0449\u0451 \u043D\u0435 \u0432\u044B\u043D\u0435\u0441 \u0432\u0435\u0440\u0434\u0438\u043A\u0442 \u0437\u0430 ${mins} \u043C\u0438\u043D \u2014 \u0444\u0438\u043A\u0441-\u0438\u0442\u0435\u0440\u0430\u0446\u0438\u044F \u0438\u0434\u0451\u0442 \u0441 \u0442\u0435\u043C, \u0447\u0442\u043E \u0435\u0441\u0442\u044C (TASWM-665)`
23970
+ );
23971
+ }
23892
23972
  async function wakeAuthorOnChanges(deps, snapshot, now, droneCap) {
23893
23973
  if (!deps.respawn) return false;
23894
23974
  const run2 = deps.db.getRun(snapshot.id);
@@ -23899,7 +23979,26 @@ async function wakeAuthorOnChanges(deps, snapshot, now, droneCap) {
23899
23979
  noteGrokBalanceSkip(deps, run2, "\u0444\u0438\u043A\u0441-\u0438\u0442\u0435\u0440\u0430\u0446\u0438\u044E");
23900
23980
  return false;
23901
23981
  }
23902
- if (deps.db.activeReviewersFor(run2.id).some((r) => r.status !== "stalled" && !isAwaitingCi(r.status, r.stop_reason))) {
23982
+ const cycle = run2.review_cycle ?? 0;
23983
+ const reviewerWorking = run2.review_verdict == null && sameCycleCheckerWorking(deps.db.activeReviewersFor(run2.id), cycle, true);
23984
+ const verifierWorking = run2.verify_verdict == null && sameCycleCheckerWorking(deps.db.activeVerifiersFor(run2.id), cycle, false);
23985
+ const verdictAt = changesVerdictAt(deps.db, run2, now);
23986
+ const partner = fixPartnerHold({
23987
+ nowMs: now,
23988
+ // stampMs, не sqliteMs: у гидрированного прогона `at` бывает ISO, и sqliteMs даёт NaN.
23989
+ // NaN в fixPartnerHold — partial, а не вечное ожидание (метка гейт не держит).
23990
+ verdictAtMs: verdictAt ? stampMs(verdictAt) : null,
23991
+ waitMs: CHANGES_FRESH_WAKE_AFTER_MS,
23992
+ reviewVerdict: run2.review_verdict,
23993
+ verifyVerdict: run2.verify_verdict,
23994
+ reviewerWorking,
23995
+ verifierWorking
23996
+ });
23997
+ if (partner.action === "wait") return false;
23998
+ const gaveUpOnReviewer = partner.action === "partial" && partner.waitingOn === "reviewer";
23999
+ if (!gaveUpOnReviewer && deps.db.activeReviewersFor(run2.id).some(
24000
+ (r) => r.status !== "stalled" && !isAwaitingCi(r.status, r.stop_reason) && !(r.status === "paused" && isLimitWait(r.stop_reason))
24001
+ )) {
23903
24002
  return blockFix(run2, "\u0440\u0435\u0432\u044C\u044E\u0435\u0440 \u0435\u0449\u0451 \u0432 \u0440\u0430\u0431\u043E\u0442\u0435");
23904
24003
  }
23905
24004
  if (deps.resourcesOk && !deps.resourcesOk()) return blockFix(run2, "\u043C\u0430\u0448\u0438\u043D\u0430 \u043F\u0435\u0440\u0435\u0433\u0440\u0443\u0436\u0435\u043D\u0430");
@@ -23979,6 +24078,7 @@ async function wakeAuthorOnChanges(deps, snapshot, now, droneCap) {
23979
24078
  if (run2.stop_reason != null) deps.db.updateRun(run2.id, { stop_reason: null });
23980
24079
  const how = worktreeReady ? "\u0441\u0432\u0435\u0436\u0438\u0439 \u0434\u0440\u043E\u043D \u0441 \u0431\u0440\u0438\u0444\u043E\u043C \u0444\u0438\u043A\u0441-\u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0438 \u0432 \u0442\u043E\u043C \u0436\u0435 worktree" : "\u0441\u0432\u0435\u0436\u0438\u0439 \u0434\u0440\u043E\u043D \u0441 \u0431\u0440\u0438\u0444\u043E\u043C \u0444\u0438\u043A\u0441-\u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0438, worktree \u043F\u0435\u0440\u0435-\u0441\u043E\u0437\u0434\u0430\u0451\u0442\u0441\u044F \u0441 origin";
23981
24080
  deps.db.addEvent(run2.id, "resumed", `${CHANGES_WAKE_MARK} \u2014 ${how}`);
24081
+ if (partner.action === "partial") noteFixPartnerTimeout(deps, run2, partner.waitingOn);
23982
24082
  narrate(deps, `\u0420\u0435\u0432\u044C\u044E\u0435\u0440 \u043F\u043E\u043F\u0440\u043E\u0441\u0438\u043B \u043F\u0440\u0430\u0432\u043A\u0438 \u0443 ${droneLabel(run2)} \u2014 \u043F\u043E\u0434\u043D\u0438\u043C\u0430\u044E \u0441\u0432\u0435\u0436\u0435\u0433\u043E \u0434\u0440\u043E\u043D\u0430 \u043D\u0430 \u0444\u0438\u043A\u0441-\u0438\u0442\u0435\u0440\u0430\u0446\u0438\u044E.`);
23983
24083
  return true;
23984
24084
  } catch (e) {
@@ -25145,20 +25245,24 @@ function clipPickupBody(body) {
25145
25245
  const headLen = Math.max(0, PICKUP_BODY_MAX - note.length - tail2.length);
25146
25246
  return body.slice(0, headLen) + note + tail2;
25147
25247
  }
25148
- function pickedVerdictEventText(how, verdict, body, mark) {
25248
+ function pickedVerdictEventText(how, verdict, body, mark, sha) {
25149
25249
  const review = verdict === "approve" || verdict === "changes";
25150
25250
  const prefix = review ? PICKUP_EVENT_PREFIX : VERIFY_PICKUP_EVENT_PREFIX;
25151
25251
  const label2 = review ? verdictLabel(verdict) : verifyVerdictLabel(verdict);
25152
25252
  const trimmed = body?.trim() ?? "";
25153
25253
  const payload = trimmed ? clipPickupBody(trimmed) : label2;
25154
25254
  const tail2 = mark ? ` [${mark}]` : "";
25155
- return `${prefix} (${how}): ${payload}${tail2}`;
25255
+ return `${appendVerdictHead(`${prefix} (${how}): ${payload}`, sha)}${tail2}`;
25256
+ }
25257
+ async function checkerHeadSha(worktree) {
25258
+ if (!worktree) return null;
25259
+ return headSha(worktree);
25156
25260
  }
25157
25261
  function verdictEventPayload(text) {
25158
25262
  const sep4 = text.startsWith(PICKUP_EVENT_PREFIX) ? "): " : ": ";
25159
25263
  const at = text.indexOf(sep4);
25160
25264
  if (at < 0) return "";
25161
- return text.slice(at + sep4.length).trim().replace(/\s+\[[^\]]*\]\s*$/, "").trim();
25265
+ return stripVerdictHead(text.slice(at + sep4.length).replace(/\s+\[[^\]]*\]\s*$/, "")).trim();
25162
25266
  }
25163
25267
  function isHeaderOnlyVerdict(text) {
25164
25268
  if (!text.startsWith(PICKUP_EVENT_PREFIX) && !text.startsWith("\u0432\u0435\u0440\u0434\u0438\u043A\u0442 \u0440\u0435\u0432\u044C\u044E \u043E\u0442")) return false;
@@ -25172,7 +25276,7 @@ function isVerifyHeaderOnly(text) {
25172
25276
  const sep4 = pickup ? "): " : ": ";
25173
25277
  const at = text.indexOf(sep4);
25174
25278
  if (at < 0) return true;
25175
- const rest = text.slice(at + sep4.length).trim().replace(/\s+\[[^\]]*\]\s*$/, "").trim();
25279
+ const rest = stripVerdictHead(text.slice(at + sep4.length).replace(/\s+\[[^\]]*\]\s*$/, "")).trim();
25176
25280
  return rest.length === 0 || VERIFY_HEADER_LABELS.has(rest);
25177
25281
  }
25178
25282
  function isClippedPickup(text) {
@@ -25190,7 +25294,11 @@ async function salvageVerdictFromPrComment(deps, rv, reviewsRunId, since, ctx) {
25190
25294
  const verdictText = verdictLabel(found.verdict);
25191
25295
  deps.db.updateRun(reviewsRunId, { review_verdict: found.verdict });
25192
25296
  recordReviewFindings(deps, rv, found);
25193
- deps.db.addEvent(reviewsRunId, "step", pickedVerdictEventText(ctx.how, found.verdict, found.body));
25297
+ deps.db.addEvent(
25298
+ reviewsRunId,
25299
+ "step",
25300
+ pickedVerdictEventText(ctx.how, found.verdict, found.body, void 0, await checkerHeadSha(rv.worktree_path))
25301
+ );
25194
25302
  await closeReviewerRun(
25195
25303
  deps,
25196
25304
  rv,
@@ -25212,7 +25320,11 @@ async function salvageVerifyVerdictFromPrComment(deps, vr, verifiesRunId, since,
25212
25320
  if (!found) return false;
25213
25321
  const verdictText = verifyVerdictLabel(found.verdict);
25214
25322
  deps.db.updateRun(verifiesRunId, { verify_verdict: found.verdict });
25215
- deps.db.addEvent(verifiesRunId, "step", pickedVerdictEventText(how, found.verdict, found.body));
25323
+ deps.db.addEvent(
25324
+ verifiesRunId,
25325
+ "step",
25326
+ pickedVerdictEventText(how, found.verdict, found.body, void 0, await checkerHeadSha(vr.worktree_path))
25327
+ );
25216
25328
  await closeReviewerRun(deps, vr, `\u0432\u0435\u0440\u0434\u0438\u043A\u0442 \u0432\u044B\u043D\u0435\u0441\u0435\u043D \u043A\u043E\u043C\u043C\u0435\u043D\u0442\u043E\u043C (${verdictText}), ${how} \u2014 \u0432\u0435\u0440\u0438\u0444\u0438\u043A\u0430\u0446\u0438\u044F \u0437\u0430\u043A\u0440\u044B\u0442\u0430 \u0431\u0435\u0437 \u0441\u043F\u0430\u0432\u043D\u0430 \u0432\u0442\u043E\u0440\u043E\u0433\u043E \u0432\u0435\u0440\u0438\u0444\u0438\u043A\u0430\u0442\u043E\u0440\u0430`);
25217
25329
  narrate(deps, `${droneLabel(vr)} \u043E\u0441\u0442\u0430\u0432\u0438\u043B \u0432\u0435\u0440\u0434\u0438\u043A\u0442 \u0432\u0435\u0440\u0438\u0444\u0438\u043A\u0430\u0446\u0438\u0438 (${verdictText}) \u043A\u043E\u043C\u043C\u0435\u043D\u0442\u043E\u043C \u2014 \u0437\u0430\u0441\u0447\u0438\u0442\u0430\u043B, \u0432\u0442\u043E\u0440\u043E\u0433\u043E \u0432\u0435\u0440\u0438\u0444\u0438\u043A\u0430\u0442\u043E\u0440\u0430 \u043D\u0435 \u043F\u043E\u0434\u043D\u0438\u043C\u0430\u044E.`);
25218
25330
  return true;
@@ -25873,7 +25985,13 @@ async function tickOnce(deps) {
25873
25985
  deps.db.addEvent(
25874
25986
  run2.id,
25875
25987
  "step",
25876
- pickedVerdictEventText("done() \u0431\u044B\u043B \u043D\u0435\u0434\u043E\u0441\u0442\u0443\u043F\u0435\u043D \u0440\u0435\u0432\u044C\u044E\u0435\u0440\u0443", verdictFromComment.verdict, verdictFromComment.body, mark)
25988
+ pickedVerdictEventText(
25989
+ "done() \u0431\u044B\u043B \u043D\u0435\u0434\u043E\u0441\u0442\u0443\u043F\u0435\u043D \u0440\u0435\u0432\u044C\u044E\u0435\u0440\u0443",
25990
+ verdictFromComment.verdict,
25991
+ verdictFromComment.body,
25992
+ mark,
25993
+ await checkerHeadSha(lastAttempt?.worktree_path)
25994
+ )
25877
25995
  );
25878
25996
  narrate(deps, `\u0420\u0435\u0432\u044C\u044E ${droneLabel(run2)} \u2014 \u0432\u0435\u0440\u0434\u0438\u043A\u0442 \u043D\u0430\u0448\u0451\u043B\u0441\u044F \u0432 \u043A\u043E\u043C\u043C\u0435\u043D\u0442\u0430\u0445 PR (${verdictText}), \u0440\u0435\u0441\u043F\u0430\u0432\u043D \u043D\u0435 \u043D\u0443\u0436\u0435\u043D.`);
25879
25997
  await postScrapedVerdictReport(deps, run2.id, run2.task_slug, verdictFromComment.verdict, lastAttempt?.name || "(\u0438\u043C\u044F \u043D\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043D\u043E)", run2.workspace_id, run2.review_cycle ?? 0);
@@ -26702,25 +26820,55 @@ function lastSubmissionSince(db, run2) {
26702
26820
  }
26703
26821
  return run2.created_at;
26704
26822
  }
26705
- async function verdictTextForFixBrief(deps, run2) {
26706
- const fromFeed = lastChangesSummary(deps.db, run2.id);
26707
- const feedBlocked = !!fromFeed && (isHeaderOnlyVerdict(fromFeed) || verdictEventIsApprove(fromFeed));
26708
- if (fromFeed && !feedBlocked) {
26709
- if (!isClippedPickup(fromFeed)) return fromFeed;
26710
- return await fullReviewComment(deps, run2) ?? fromFeed;
26711
- }
26712
- if (run2.review_verdict !== "changes") {
26713
- const verify = lastVerifySummary(deps.db, run2.id);
26714
- if (verify) {
26715
- const headerOnly = isVerifyHeaderOnly(verify);
26716
- if (headerOnly || isClippedPickup(verify)) {
26717
- const fromVerify = await fullVerifyComment(deps, run2);
26718
- if (fromVerify) return fromVerify;
26719
- }
26720
- if (!headerOnly) return verify;
26823
+ function lastTextThisHead(db, runId, match) {
26824
+ const events = db.events(runId);
26825
+ let boundary = -1;
26826
+ for (let i = events.length - 1; i >= 0; i--) {
26827
+ const kind = events[i].kind;
26828
+ if (kind === "pr_opened" || kind === "done") {
26829
+ boundary = i;
26830
+ break;
26721
26831
  }
26722
26832
  }
26723
- return fullReviewComment(deps, run2);
26833
+ for (let i = events.length - 1; i > boundary; i--) {
26834
+ const text = events[i].text ?? "";
26835
+ if (match(text)) return text;
26836
+ }
26837
+ return null;
26838
+ }
26839
+ async function reviewSectionForFix(deps, run2) {
26840
+ const fromFeed = lastTextThisHead(deps.db, run2.id, isVerdictEventText);
26841
+ const sha = verdictHeadSha(fromFeed);
26842
+ const approveFeed = !!fromFeed && verdictEventIsApprove(fromFeed);
26843
+ if (run2.review_verdict === "approve" || run2.review_verdict !== "changes" && approveFeed) {
26844
+ const comment2 = await fullReviewComment(deps, run2);
26845
+ if (comment2) return { body: stripVerdictHead(comment2), sha };
26846
+ return { body: FIX_NO_REVIEW_ITEMS, sha };
26847
+ }
26848
+ if (fromFeed && !isHeaderOnlyVerdict(fromFeed)) {
26849
+ const raw = isClippedPickup(fromFeed) ? await fullReviewComment(deps, run2) ?? fromFeed : fromFeed;
26850
+ return { body: stripVerdictHead(raw), sha: sha ?? verdictHeadSha(raw) };
26851
+ }
26852
+ const comment = await fullReviewComment(deps, run2);
26853
+ if (comment) return { body: stripVerdictHead(comment), sha };
26854
+ return { body: null, sha, recorded: run2.review_verdict === "changes" };
26855
+ }
26856
+ async function verifySectionForFix(deps, run2) {
26857
+ const fromFeed = lastTextThisHead(deps.db, run2.id, (text) => VERIFY_EVENT_PREFIXES.some((p) => text.startsWith(p)));
26858
+ const sha = verdictHeadSha(fromFeed);
26859
+ if (run2.verify_verdict === "confirmed") return { body: FIX_NO_VERIFY_ITEMS, sha };
26860
+ if (fromFeed && !isVerifyHeaderOnly(fromFeed)) {
26861
+ const raw = isClippedPickup(fromFeed) ? await fullVerifyComment(deps, run2) ?? fromFeed : fromFeed;
26862
+ return { body: stripVerdictHead(raw), sha: sha ?? verdictHeadSha(raw) };
26863
+ }
26864
+ const comment = await fullVerifyComment(deps, run2);
26865
+ if (comment) return { body: stripVerdictHead(comment), sha };
26866
+ return { body: null, sha, recorded: isNegativeVerifyVerdict(run2.verify_verdict) };
26867
+ }
26868
+ async function fixBriefParts(deps, run2) {
26869
+ const review = await reviewSectionForFix(deps, run2);
26870
+ const verify = await verifySectionForFix(deps, run2);
26871
+ return { verdict: null, review, verify };
26724
26872
  }
26725
26873
  async function fullReviewComment(deps, run2) {
26726
26874
  if (!deps.verdictComment || !run2.pr_url) return null;
@@ -26785,13 +26933,16 @@ async function respawnRun(deps, run2, mode, nudge) {
26785
26933
  fetchFile: deps.fetchFile,
26786
26934
  onEvent: (text) => deps.db.addEvent(run2.id, "step", text)
26787
26935
  });
26936
+ const fixParts = mode === "fix" ? await fixBriefParts(deps, runToSpawn) : null;
26788
26937
  const freshPrompt = mode === "fix" ? buildChangesFixPrompt({
26789
26938
  prUrl: runToSpawn.pr_url ?? "",
26790
26939
  slug: runToSpawn.task_slug,
26791
26940
  branch: runToSpawn.branch || runToSpawn.task_slug,
26792
26941
  base: base3 || "",
26793
26942
  worktree: wt,
26794
- verdict: await verdictTextForFixBrief(deps, runToSpawn),
26943
+ verdict: fixParts.verdict,
26944
+ reviewSection: fixParts.review,
26945
+ verifySection: fixParts.verify,
26795
26946
  name: runToSpawn.name,
26796
26947
  taskTitle: task?.title ?? null,
26797
26948
  taskUrl: task?.url ?? null,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@taskless-app/swarm",
3
- "version": "0.6.100",
3
+ "version": "0.6.101",
4
4
  "type": "module",
5
5
  "description": "Local control plane for a fleet of AI coding agents (drones), coordinating through Taskless. The overmind runs the swarm.",
6
6
  "keywords": [
@@ -40,7 +40,7 @@
40
40
  "undici": "^7.30.1",
41
41
  "zod": "3.25.76"
42
42
  },
43
- "gitHead": "a0643b2118fce225b5afbe7ce9c1afbe7cd25d39",
43
+ "gitHead": "9216f89857eb8625eecb9a3ededb87cb65a15dec",
44
44
  "scripts": {
45
45
  "overmind": "NODE_OPTIONS=\"${NODE_OPTIONS:-} --conditions=development\" tsx src/overmind.ts",
46
46
  "swarm": "NODE_OPTIONS=\"${NODE_OPTIONS:-} --conditions=development\" tsx src/cli.ts",