@tablation/crew 0.137.7 → 0.137.9
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 +29 -19
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -6894,6 +6894,7 @@ import { createHash as createHash6, randomUUID } from "crypto";
|
|
|
6894
6894
|
import { readFileSync as readFileSync20, writeFileSync as writeFileSync15, existsSync as existsSync19, mkdirSync as mkdirSync14, rmSync as rmSync10, statSync as statSync7, readdirSync as readdirSync6 } from "fs";
|
|
6895
6895
|
import { join as join22 } from "path";
|
|
6896
6896
|
var EPOCH = "1970-01-01T00:00:00.000Z";
|
|
6897
|
+
var watermarkFile = (scope) => scope ? `.poll-watermark-${scope}` : ".poll-watermark";
|
|
6897
6898
|
var State = class _State {
|
|
6898
6899
|
dir;
|
|
6899
6900
|
constructor(dir) {
|
|
@@ -6910,16 +6911,17 @@ var State = class _State {
|
|
|
6910
6911
|
* evaluated: bumping it inside the first role's check would hide that
|
|
6911
6912
|
* role's new comments from the second.
|
|
6912
6913
|
*/
|
|
6913
|
-
watermark() {
|
|
6914
|
+
watermark(scope) {
|
|
6914
6915
|
try {
|
|
6915
|
-
const v = readFileSync20(this.path(
|
|
6916
|
+
const v = readFileSync20(this.path(watermarkFile(scope)), "utf8").trim();
|
|
6916
6917
|
return v || EPOCH;
|
|
6917
6918
|
} catch {
|
|
6919
|
+
if (scope) return this.watermark();
|
|
6918
6920
|
return EPOCH;
|
|
6919
6921
|
}
|
|
6920
6922
|
}
|
|
6921
|
-
setWatermark(at) {
|
|
6922
|
-
writeFileSync15(this.path(
|
|
6923
|
+
setWatermark(at, scope) {
|
|
6924
|
+
writeFileSync15(this.path(watermarkFile(scope)), `${at}
|
|
6923
6925
|
`);
|
|
6924
6926
|
}
|
|
6925
6927
|
/**
|
|
@@ -6929,10 +6931,10 @@ var State = class _State {
|
|
|
6929
6931
|
* and the write — a race that loses work rather than repeating it, which is
|
|
6930
6932
|
* the wrong way round. Repeating a cycle is free; missing one is not.
|
|
6931
6933
|
*/
|
|
6932
|
-
advanceWatermark(seen) {
|
|
6934
|
+
advanceWatermark(seen, scope) {
|
|
6933
6935
|
const stamps = seen.flatMap((s) => [s.created_at, s.updated_at]).filter((v) => typeof v === "string" && v.length > 0);
|
|
6934
|
-
const next = stamps.length ? stamps.reduce((a, b) => a > b ? a : b) : this.watermark();
|
|
6935
|
-
this.setWatermark(next);
|
|
6936
|
+
const next = stamps.length ? stamps.reduce((a, b) => a > b ? a : b) : this.watermark(scope);
|
|
6937
|
+
this.setWatermark(next, scope);
|
|
6936
6938
|
return next;
|
|
6937
6939
|
}
|
|
6938
6940
|
/** Whole-crew pause, and the per-role sentinels one level down. */
|
|
@@ -17785,7 +17787,7 @@ var STALLED_AFTER_CYCLES = 30;
|
|
|
17785
17787
|
var CYCLE_MS = 120 * 1e3;
|
|
17786
17788
|
var STALLED_AFTER_MS = STALLED_AFTER_CYCLES * CYCLE_MS;
|
|
17787
17789
|
var STALLED_MARKER = calloutHeader("WARNING", "Stalled");
|
|
17788
|
-
var stalledKey = (issueId) => `stalled:${issueId}`;
|
|
17790
|
+
var stalledKey = (issueId, routeScope) => routeScope ? `stalled:${routeScope}:${issueId}` : `stalled:${issueId}`;
|
|
17789
17791
|
var ms = (iso) => {
|
|
17790
17792
|
const n = iso ? Date.parse(iso) : NaN;
|
|
17791
17793
|
return Number.isFinite(n) ? n : 0;
|
|
@@ -17868,10 +17870,15 @@ async function runStalledSweep(o, stalled) {
|
|
|
17868
17870
|
o.dryRun ?? false
|
|
17869
17871
|
);
|
|
17870
17872
|
if (o.dryRun) return r;
|
|
17871
|
-
const
|
|
17872
|
-
|
|
17873
|
+
const scope = o.route ? routeSlug(o.route.route) : void 0;
|
|
17874
|
+
const prefix = scope ? `stalled:${scope}:` : "stalled:";
|
|
17875
|
+
const scoped = r.attention.map((i) => scope ? { ...i, key: stalledKey(i.key.slice("stalled:".length), scope) } : i);
|
|
17876
|
+
const keep = new Set(scoped.map((i) => i.key));
|
|
17877
|
+
for (const item of scoped) await raiseShipAttention({ state: o.state, emit: o.emit, route: o.route, ship: o.ship }, item);
|
|
17873
17878
|
for (const open of o.state.shipAttention().previous()) {
|
|
17874
|
-
if (open.kind
|
|
17879
|
+
if (open.kind !== "stalled" || keep.has(open.key)) continue;
|
|
17880
|
+
const unscoped = !/^stalled:[^:]+:/.test(open.key);
|
|
17881
|
+
if (unscoped || open.key.startsWith(prefix)) clearShipAttention(o.state, open.key);
|
|
17875
17882
|
}
|
|
17876
17883
|
return r;
|
|
17877
17884
|
}
|
|
@@ -18022,7 +18029,7 @@ async function decideCycle(o) {
|
|
|
18022
18029
|
emit.warn("could not mint a record-link URL for at least one attention event this cycle", { step: "sweep" });
|
|
18023
18030
|
}
|
|
18024
18031
|
emit.enter("select");
|
|
18025
|
-
const watermark = state.watermark();
|
|
18032
|
+
const watermark = state.watermark(routeSlug(route2.route));
|
|
18026
18033
|
for (const repo of recheckBaseStops(state, route2)) {
|
|
18027
18034
|
emit.emit(`${repo}: primary checkout is level again \u2014 building lanes resume for that repo`, { step: "select" });
|
|
18028
18035
|
}
|
|
@@ -18068,7 +18075,7 @@ async function decideCycle(o) {
|
|
|
18068
18075
|
attention: attentionCurrent,
|
|
18069
18076
|
unroutable
|
|
18070
18077
|
};
|
|
18071
|
-
const advanced = state.advanceWatermark([...comments, ...tickets]);
|
|
18078
|
+
const advanced = state.advanceWatermark([...comments, ...tickets], routeSlug(route2.route));
|
|
18072
18079
|
if (advanced !== watermark) {
|
|
18073
18080
|
emit.emit(`watermark ${watermark.slice(0, 19)} -> ${advanced.slice(0, 19)}`, {
|
|
18074
18081
|
step: "poll",
|
|
@@ -20859,9 +20866,10 @@ function clearNoopRuns(stateDir, recordId) {
|
|
|
20859
20866
|
delete state[recordId];
|
|
20860
20867
|
writeNoopRuns(stateDir, state);
|
|
20861
20868
|
}
|
|
20862
|
-
function noopAttentionMessage(tag, role, count, nextAt, lastComment2) {
|
|
20869
|
+
function noopAttentionMessage(tag, role, count, nextAt, lastComment2, waitingOnPerson = false) {
|
|
20863
20870
|
const mins = Math.max(1, Math.round((nextAt - Date.now()) / 6e4));
|
|
20864
|
-
|
|
20871
|
+
const next = waitingOnPerson ? "waiting on a person to answer before it is picked up again" : `next attempt in about ${mins} minutes`;
|
|
20872
|
+
return `${tag}: ${role} run ended ${count} time${count === 1 ? "" : "s"} in a row with nothing pushed and no hand-off; ${next}` + (lastComment2 ? `. Its last comment: ${lastComment2.slice(0, 300)}` : "");
|
|
20865
20873
|
}
|
|
20866
20874
|
function noopBounceComment(count, lastComment2) {
|
|
20867
20875
|
return `${NOOP_BOUNCED_MARKER}
|
|
@@ -20875,7 +20883,9 @@ ${lastComment2}
|
|
|
20875
20883
|
async function settleNoopRun(o) {
|
|
20876
20884
|
const tag = o.before.issue_tag ?? o.before.issue_id;
|
|
20877
20885
|
const after = await o.tracker.ticket(o.ticketId);
|
|
20878
|
-
const
|
|
20886
|
+
const flagged = (k) => Boolean(after[k]) && !o.before[k];
|
|
20887
|
+
const noop = o.before[o.columns.status] === o.statuses.building && after[o.columns.status] === o.before[o.columns.status] && after[o.columns.assignee] === o.before[o.columns.assignee] && o.tipBefore === o.tipAfter && !flagged("needs_review") && !flagged("needs_planning") && // A person owes an answer, so an earlier stale entry for this ticket is not a repeat either.
|
|
20888
|
+
!after.needs_review;
|
|
20879
20889
|
if (!noop) {
|
|
20880
20890
|
clearNoopRuns(o.stateDir, o.ticketId);
|
|
20881
20891
|
o.clear(noopRunsKey(o.before.issue_id));
|
|
@@ -20893,7 +20903,7 @@ async function settleNoopRun(o) {
|
|
|
20893
20903
|
kind: "noop_runs",
|
|
20894
20904
|
key: noopRunsKey(o.before.issue_id),
|
|
20895
20905
|
since: (/* @__PURE__ */ new Date()).toISOString(),
|
|
20896
|
-
message: noopAttentionMessage(tag, o.role, verdict.count, verdict.nextAt, last)
|
|
20906
|
+
message: noopAttentionMessage(tag, o.role, verdict.count, verdict.nextAt, last, Boolean(after.needs_planning))
|
|
20897
20907
|
});
|
|
20898
20908
|
return "backoff";
|
|
20899
20909
|
}
|
|
@@ -32866,7 +32876,7 @@ ${where.join("\n")}`);
|
|
|
32866
32876
|
runs: runs.map((x) => describeRun(x, route2, seatIds)),
|
|
32867
32877
|
// Additive (CREW-2857): every live periscope on this ship, from its local record. `version` stays 1.
|
|
32868
32878
|
periscopes,
|
|
32869
|
-
watermark: state.watermark(),
|
|
32879
|
+
watermark: state.watermark(routeSlug(route2.route)),
|
|
32870
32880
|
route: {
|
|
32871
32881
|
name: route2.route,
|
|
32872
32882
|
// Additive (CREW-2248): the running version and the workspace's floor. `version` stays 1.
|
|
@@ -32945,7 +32955,7 @@ periscopes: ${periscopeSummary(cfg)}
|
|
|
32945
32955
|
` : "") + periscopes.map((p) => `periscope: ${p.ticket} ${p.repo} ${p.url} ${p.state}${p.serving ? "" : " (not serving)"} expires ${p.expiresAt}
|
|
32946
32956
|
`).join("") + `crew: ${state.isPaused() ? "paused" : "active"}
|
|
32947
32957
|
release: ${state.releaseSkipReason() ? "paused" : "active"}
|
|
32948
|
-
watermark: ${state.watermark()}
|
|
32958
|
+
watermark: ${state.watermark(routeSlug(route2.route))}
|
|
32949
32959
|
`
|
|
32950
32960
|
);
|
|
32951
32961
|
for (const r of ["dev", "design", "qa"]) {
|
package/package.json
CHANGED