lastlight-core 0.32.2 → 0.33.1
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/config/default.yaml +81 -0
- package/dist/admin/board-cache.d.ts +81 -0
- package/dist/admin/board-cache.js +303 -0
- package/dist/admin/board-cache.js.map +1 -0
- package/dist/admin/board-stream.d.ts +47 -0
- package/dist/admin/board-stream.js +45 -0
- package/dist/admin/board-stream.js.map +1 -0
- package/dist/admin/board.d.ts +284 -0
- package/dist/admin/board.js +369 -0
- package/dist/admin/board.js.map +1 -0
- package/dist/admin/routes.js +943 -13
- package/dist/admin/routes.js.map +1 -1
- package/dist/config/config.d.ts +88 -0
- package/dist/config/config.js +156 -0
- package/dist/config/config.js.map +1 -1
- package/dist/connectors/github-webhook.d.ts +16 -0
- package/dist/connectors/github-webhook.js +105 -8
- package/dist/connectors/github-webhook.js.map +1 -1
- package/dist/connectors/types.d.ts +9 -2
- package/dist/cron/issue-discovery.d.ts +120 -0
- package/dist/cron/issue-discovery.js +127 -0
- package/dist/cron/issue-discovery.js.map +1 -0
- package/dist/cron/runner.d.ts +25 -1
- package/dist/cron/runner.js +53 -10
- package/dist/cron/runner.js.map +1 -1
- package/dist/engine/build-decisions.d.ts +91 -0
- package/dist/engine/build-decisions.js +295 -0
- package/dist/engine/build-decisions.js.map +1 -0
- package/dist/engine/build-gate.d.ts +78 -0
- package/dist/engine/build-gate.js +423 -0
- package/dist/engine/build-gate.js.map +1 -0
- package/dist/engine/github/github.d.ts +213 -6
- package/dist/engine/github/github.js +340 -6
- package/dist/engine/github/github.js.map +1 -1
- package/dist/engine/pr-decisions.d.ts +23 -0
- package/dist/engine/pr-decisions.js.map +1 -1
- package/dist/engine/router.js +108 -1
- package/dist/engine/router.js.map +1 -1
- package/dist/engine/stage-advance.d.ts +92 -0
- package/dist/engine/stage-advance.js +129 -0
- package/dist/engine/stage-advance.js.map +1 -0
- package/dist/engine/stage-labels.d.ts +57 -0
- package/dist/engine/stage-labels.js +58 -0
- package/dist/engine/stage-labels.js.map +1 -0
- package/dist/engine/stage-observer.d.ts +79 -0
- package/dist/engine/stage-observer.js +221 -0
- package/dist/engine/stage-observer.js.map +1 -0
- package/dist/index.js +110 -2
- package/dist/index.js.map +1 -1
- package/dist/logging/phase-log.d.ts +6 -0
- package/dist/logging/phase-log.js +16 -0
- package/dist/logging/phase-log.js.map +1 -1
- package/dist/state/activity-store.d.ts +45 -1
- package/dist/state/activity-store.js +44 -0
- package/dist/state/activity-store.js.map +1 -1
- package/dist/state/execution-store.d.ts +48 -0
- package/dist/state/execution-store.js +112 -0
- package/dist/state/execution-store.js.map +1 -1
- package/dist/state/schema/pg.d.ts +2 -2
- package/dist/state/schema/sqlite.d.ts +2 -2
- package/dist/state/workflow-run-store.d.ts +75 -0
- package/dist/state/workflow-run-store.js +151 -7
- package/dist/state/workflow-run-store.js.map +1 -1
- package/dist/workflows/resume.js +45 -2
- package/dist/workflows/resume.js.map +1 -1
- package/dist/workflows/simple.d.ts +40 -1
- package/dist/workflows/simple.js +113 -2
- package/dist/workflows/simple.js.map +1 -1
- package/package.json +3 -3
- package/workflows/cron-autonomy.yaml +24 -0
- package/workflows/prompts/pr.md +18 -1
|
@@ -0,0 +1,423 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The BUILD dispatch gate — the IMPURE half of `./build-decisions.ts`.
|
|
3
|
+
*
|
|
4
|
+
* `resolveBuildTrigger` is a pure function over one resolved input record. This
|
|
5
|
+
* module is what stands between it and the world: it RESOLVES those inputs from
|
|
6
|
+
* the config and the state DB, logs the verdict, and applies the one consequence
|
|
7
|
+
* that belongs to the DECISION rather than to the route. Nothing here re-decides
|
|
8
|
+
* anything — every branch of the policy lives in the pure function, and a second
|
|
9
|
+
* copy of any of it here is the exact drift the pure/impure split exists to stop.
|
|
10
|
+
*
|
|
11
|
+
* It is the issue-side mirror of `applyPrDispatchGate` (`./dispatcher.ts`), and
|
|
12
|
+
* the header there states the rule this one also follows: a consequence that
|
|
13
|
+
* belongs to the decision is applied HERE, so no caller can forget it. On this
|
|
14
|
+
* path that consequence is the stage-label advance, which is not decoration —
|
|
15
|
+
* it is **guard 2** of the four-guard loop-safety argument
|
|
16
|
+
* (`./build-decisions.ts`, `./stage-advance.ts`).
|
|
17
|
+
*
|
|
18
|
+
* **Why its own module rather than `dispatcher.ts`.** The PR gate lives there
|
|
19
|
+
* because the dispatcher is where the webhook route decides for itself. Nothing
|
|
20
|
+
* on the issue side needs that: the gate has exactly one caller today
|
|
21
|
+
* (`dispatchWorkflow`) and the two Phase 4 surfaces — the backstop sweep and
|
|
22
|
+
* `/api/run` — reach the same choke point. Keeping it out of a 1,000-line module
|
|
23
|
+
* keeps the footprint of this feature small enough to read in one sitting.
|
|
24
|
+
*/
|
|
25
|
+
import { getAutonomyConfig, getHoldLabel, isAutonomousRepo } from "../config/config.js";
|
|
26
|
+
import { issueTriggerId, resolveBuildTrigger } from "./build-decisions.js";
|
|
27
|
+
import { advanceStage } from "./stage-advance.js";
|
|
28
|
+
import { recordActivity } from "../activity.js";
|
|
29
|
+
import { logger } from "../logging/logger.js";
|
|
30
|
+
const log = logger("build-gate");
|
|
31
|
+
export async function applyBuildDispatchGate(args, deps) {
|
|
32
|
+
// ── 1. THE STAGE ─────────────────────────────────────────────────────────
|
|
33
|
+
//
|
|
34
|
+
// The stage is what names the workflow, the labels and the gates, so an
|
|
35
|
+
// unknown one leaves the gate with nothing to enforce. Fail CLOSED: a stage
|
|
36
|
+
// dispatch we cannot identify must not run un-gated, because everything below
|
|
37
|
+
// — the idempotency key, the hold, the label advance — is keyed on names only
|
|
38
|
+
// the stage carries. An operator who renamed a stage gets no build and one
|
|
39
|
+
// warning, rather than an ungoverned one.
|
|
40
|
+
const stage = getAutonomyConfig().stages[args.stage];
|
|
41
|
+
if (!stage) {
|
|
42
|
+
const reason = `unknown-stage: \`${args.stage}\` is not in \`autonomy.stages\`, so there is no workflow, no labels and no gates to run behind`;
|
|
43
|
+
log.warn("Build gate refused an unknown stage", {
|
|
44
|
+
repo: args.repo,
|
|
45
|
+
issueNumber: args.issueNumber,
|
|
46
|
+
stage: args.stage,
|
|
47
|
+
reason,
|
|
48
|
+
});
|
|
49
|
+
return { decision: "skip", reason };
|
|
50
|
+
}
|
|
51
|
+
// ── 2. THE INPUTS ────────────────────────────────────────────────────────
|
|
52
|
+
//
|
|
53
|
+
// Resolved once, here, so the pure function reads a single consistent record
|
|
54
|
+
// — the same rule `resolvePrState` follows for the PR side.
|
|
55
|
+
const triggerId = issueTriggerId(args.repo, args.issueNumber);
|
|
56
|
+
const budget = getAutonomyConfig().budget;
|
|
57
|
+
const [owner, name] = args.repo.split("/");
|
|
58
|
+
// Read → decide → reserve under ONE in-process lock. The fan-out gates every
|
|
59
|
+
// discovered issue in parallel, and a run row is only written later, inside
|
|
60
|
+
// the dispatch — so without the lock and the reservation every gate in a
|
|
61
|
+
// tick reads the same count, and seven issues against a ceiling of one all
|
|
62
|
+
// dispatched (nearform, 2026-09-16).
|
|
63
|
+
const decision = await withGateLock(async () => {
|
|
64
|
+
// Every day-scoped budget input is measured from the same instant, resolved
|
|
65
|
+
// ONCE here. Two reads that each called "start of today" separately could
|
|
66
|
+
// straddle midnight and answer about different days.
|
|
67
|
+
const sinceIso = startOfUtcDayIso();
|
|
68
|
+
const [alreadyBuilt, inFlight, activeRuns, buildsForRepoToday, dailyStats, repoSpend] = await Promise.all([
|
|
69
|
+
// GUARD 3 — the real lock. A fact in our own database, in ANY status, that
|
|
70
|
+
// no GitHub outage can move.
|
|
71
|
+
deps.db.runs.hasRunForTrigger(triggerId, stage.workflow),
|
|
72
|
+
// `activeForTrigger`, not `getByTrigger`: both mean "queued | running |
|
|
73
|
+
// paused for this trigger", but `getByTrigger` answers for ANY workflow, so
|
|
74
|
+
// a live issue-triage run on the same issue would read as a build in
|
|
75
|
+
// flight. The constraint being protected is two agents in one build
|
|
76
|
+
// workspace, which is scoped to the stage's own workflow — and it is what
|
|
77
|
+
// the decision's `run-in-flight:` reason claims in prose.
|
|
78
|
+
deps.db.runs.activeForTrigger([stage.workflow], triggerId),
|
|
79
|
+
// The concurrency input. `listActive()` + a filter, NOT `countRunning()`:
|
|
80
|
+
// that one counts every running workflow in the harness — a PR review, a
|
|
81
|
+
// triage, a cron fan-out — so the autonomy pipeline's own ceiling would be
|
|
82
|
+
// consumed by work it has nothing to do with, and a busy deployment would
|
|
83
|
+
// refuse every autonomous build while running none.
|
|
84
|
+
deps.db.runs.listActive(),
|
|
85
|
+
// Guard 4's counter. Runs STARTED for this repo today, in any status.
|
|
86
|
+
deps.db.runs.countRunsForRepoSince(stage.workflow, args.repo, sinceIso),
|
|
87
|
+
// `dailyStats(1)` is the inclusive window [today, today] — one bucket, and
|
|
88
|
+
// it is synthesised as a zero row when nothing has run, so the array is
|
|
89
|
+
// never empty. Read defensively anyway: a spend input that read `undefined`
|
|
90
|
+
// as "over budget" would refuse every build on a quiet morning.
|
|
91
|
+
deps.db.executions.dailyStats(1),
|
|
92
|
+
deps.db.executions.repoCostSince(owner ?? "", name ?? "", sinceIso),
|
|
93
|
+
]);
|
|
94
|
+
// `queued` and `running` only. A `paused` run is waiting on a human at an
|
|
95
|
+
// approval gate: it holds no agent and no sandbox slot, so counting it let a
|
|
96
|
+
// handful of plans awaiting review stop the whole pipeline. (It still blocks
|
|
97
|
+
// a rebuild of ITS issue — that is `inFlight` above, which keeps `paused`.)
|
|
98
|
+
const liveRows = activeRuns.filter((run) => run.workflowName === stage.workflow &&
|
|
99
|
+
isAutonomousRun(run) &&
|
|
100
|
+
(run.status === "queued" || run.status === "running")).length;
|
|
101
|
+
// Dispatches this gate approved whose run row does not exist yet — see
|
|
102
|
+
// `pendingReservations`. Without them every gate in one sweep tick reads the
|
|
103
|
+
// same pre-burst count.
|
|
104
|
+
const pending = await pendingReservations(deps.db, stage.workflow, triggerId);
|
|
105
|
+
const concurrentAutonomousBuilds = liveRows + pending.length;
|
|
106
|
+
const spendTodayUsd = dailyStats[dailyStats.length - 1]?.costUsd ?? 0;
|
|
107
|
+
const decision = resolveBuildTrigger({
|
|
108
|
+
repo: args.repo,
|
|
109
|
+
issueNumber: args.issueNumber,
|
|
110
|
+
labels: args.labels,
|
|
111
|
+
addedLabel: args.addedLabel,
|
|
112
|
+
route: args.route,
|
|
113
|
+
senderIsBot: args.senderIsBot,
|
|
114
|
+
autonomyEnabled: isAutonomousRepo(args.repo),
|
|
115
|
+
alreadyBuilt,
|
|
116
|
+
runInFlight: !!inFlight,
|
|
117
|
+
holdLabel: getHoldLabel(),
|
|
118
|
+
concurrentAutonomousBuilds,
|
|
119
|
+
// A reserved dispatch for this repo has not STARTED a run yet, but it will.
|
|
120
|
+
buildsForRepoToday: buildsForRepoToday + pending.filter((r) => r.repo === args.repo).length,
|
|
121
|
+
spendTodayUsd,
|
|
122
|
+
repoSpendTodayUsd: repoSpend.costUsd,
|
|
123
|
+
}, budget);
|
|
124
|
+
if (decision.decision === "dispatch")
|
|
125
|
+
reserve(deps.db, stage.workflow, triggerId, args.repo);
|
|
126
|
+
return decision;
|
|
127
|
+
});
|
|
128
|
+
// ── 3. THE LOG ───────────────────────────────────────────────────────────
|
|
129
|
+
//
|
|
130
|
+
// One line per dispatch, in the same shape `applyPrDispatchGate` logs: the
|
|
131
|
+
// decision AND the reason that produced it, because the reason is the single
|
|
132
|
+
// source the comment and the admin panel also render.
|
|
133
|
+
log.info("Build gate decision", {
|
|
134
|
+
workflow: stage.workflow,
|
|
135
|
+
repo: args.repo,
|
|
136
|
+
issueNumber: args.issueNumber,
|
|
137
|
+
decision: decision.decision,
|
|
138
|
+
reason: decision.reason,
|
|
139
|
+
});
|
|
140
|
+
if (decision.decision === "skip") {
|
|
141
|
+
await applySkipConsequence(args, stage, decision, deps);
|
|
142
|
+
return { decision: "skip", reason: decision.reason };
|
|
143
|
+
}
|
|
144
|
+
// ── 4. GUARD 2 — advance the label BEFORE the run starts ─────────────────
|
|
145
|
+
//
|
|
146
|
+
// Load-bearing, and the ORDERING is the whole point. The Phase 4 backstop
|
|
147
|
+
// sweep queries `label:<enter>`; while the entry label is still on the issue,
|
|
148
|
+
// every sweep tick and every re-delivered webhook sees a pipeline entry it is
|
|
149
|
+
// entitled to pick up. Moving the label off here — before the run exists —
|
|
150
|
+
// makes a re-dispatch structurally impossible rather than merely caught.
|
|
151
|
+
//
|
|
152
|
+
// A FAILED advance must not block the dispatch. `advanceStage` never throws
|
|
153
|
+
// for exactly this reason: the labels are the human-readable projection of
|
|
154
|
+
// the fact, and guard 3 (`hasRunForTrigger`) is the fact. So the cost of a
|
|
155
|
+
// failure here is visibility, not a double build — but it IS guard 2 silently
|
|
156
|
+
// degrading, so it gets a warning rather than passing unremarked.
|
|
157
|
+
const advance = await advanceStage({
|
|
158
|
+
owner: owner ?? "",
|
|
159
|
+
repo: name ?? "",
|
|
160
|
+
issueNumber: args.issueNumber,
|
|
161
|
+
from: stage.enter,
|
|
162
|
+
to: stage.running,
|
|
163
|
+
// A run is STARTING, so neither terminal verdict holds any more. Nothing
|
|
164
|
+
// else ever clears them: this advance removes `enter`, and the terminal
|
|
165
|
+
// observer removes `running` — so without this an issue that failed and
|
|
166
|
+
// was then re-run successfully keeps `agent-blocked` alongside its new
|
|
167
|
+
// `ready-for-human`, and the board files it under the older verdict.
|
|
168
|
+
// Best-effort by contract; a stale label is untidy, never unsafe.
|
|
169
|
+
alsoRemove: [stage.on_success, stage.on_failure],
|
|
170
|
+
}, { github: deps.github });
|
|
171
|
+
if (!advance.advanced || !advance.removed) {
|
|
172
|
+
log.warn("Stage label advance degraded — the sweep's re-pickup guard is weaker for this issue", {
|
|
173
|
+
workflow: stage.workflow,
|
|
174
|
+
repo: args.repo,
|
|
175
|
+
issueNumber: args.issueNumber,
|
|
176
|
+
from: stage.enter,
|
|
177
|
+
to: stage.running,
|
|
178
|
+
advanced: advance.advanced,
|
|
179
|
+
removed: advance.removed,
|
|
180
|
+
reason: advance.reason,
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
// The stage's gates travel back to the caller rather than being applied here:
|
|
184
|
+
// they belong to the RUN, which does not exist yet. The union happens where
|
|
185
|
+
// the run's effective approval map is composed (`workflows/simple.ts`).
|
|
186
|
+
return { decision: "dispatch", reason: decision.reason, gates: stage.gates };
|
|
187
|
+
}
|
|
188
|
+
const RESERVATION_TTL_MS = 5 * 60_000;
|
|
189
|
+
const reservationsByDb = new WeakMap();
|
|
190
|
+
function reservationsFor(db) {
|
|
191
|
+
let held = reservationsByDb.get(db);
|
|
192
|
+
if (!held) {
|
|
193
|
+
held = new Map();
|
|
194
|
+
reservationsByDb.set(db, held);
|
|
195
|
+
}
|
|
196
|
+
return held;
|
|
197
|
+
}
|
|
198
|
+
function reserve(db, workflow, triggerId, repo) {
|
|
199
|
+
reservationsFor(db).set(`${workflow}\u0000${triggerId}`, { workflow, triggerId, repo, at: Date.now() });
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* The live reservations for `workflow`, pruning realised and expired ones.
|
|
203
|
+
* `ownTriggerId` is excluded: the board gates an issue, then `dispatchWorkflow`
|
|
204
|
+
* gates it again, and a dispatch must not be refused by its own reservation.
|
|
205
|
+
*/
|
|
206
|
+
async function pendingReservations(db, workflow, ownTriggerId) {
|
|
207
|
+
const held = reservationsFor(db);
|
|
208
|
+
const now = Date.now();
|
|
209
|
+
const out = [];
|
|
210
|
+
for (const [key, r] of held) {
|
|
211
|
+
if (r.workflow !== workflow)
|
|
212
|
+
continue;
|
|
213
|
+
if (now - r.at > RESERVATION_TTL_MS) {
|
|
214
|
+
held.delete(key);
|
|
215
|
+
continue;
|
|
216
|
+
}
|
|
217
|
+
const latest = await db.runs.latestForTrigger([workflow], r.triggerId);
|
|
218
|
+
if (latest && Date.parse(latest.startedAt) >= r.at) {
|
|
219
|
+
held.delete(key);
|
|
220
|
+
continue;
|
|
221
|
+
}
|
|
222
|
+
if (r.triggerId !== ownTriggerId)
|
|
223
|
+
out.push(r);
|
|
224
|
+
}
|
|
225
|
+
return out;
|
|
226
|
+
}
|
|
227
|
+
/** Serialises the gate's read → decide → reserve step within this process. */
|
|
228
|
+
let gateTail = Promise.resolve();
|
|
229
|
+
function withGateLock(fn) {
|
|
230
|
+
const next = gateTail.then(fn, fn);
|
|
231
|
+
gateTail = next.catch(() => undefined);
|
|
232
|
+
return next;
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* Midnight UTC today, as an ISO string — the boundary every day-scoped budget
|
|
236
|
+
* is measured from.
|
|
237
|
+
*
|
|
238
|
+
* UTC rather than a deployment-local day because that is what the ledger
|
|
239
|
+
* already buckets on (`dayBucket()` slices the first ten characters of the
|
|
240
|
+
* stored ISO timestamp), so a local-midnight boundary here would disagree with
|
|
241
|
+
* the numbers on the dashboard's own stats page. Every reason string that names
|
|
242
|
+
* this ceiling says "midnight UTC" out loud for the same reason.
|
|
243
|
+
*/
|
|
244
|
+
function startOfUtcDayIso(now = new Date()) {
|
|
245
|
+
return new Date(Date.UTC(now.getUTCFullYear(), now.getUTCMonth(), now.getUTCDate())).toISOString();
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* Was this run dispatched by the autonomy pipeline?
|
|
249
|
+
*
|
|
250
|
+
* The flag is stamped on the run's `context` at dispatch. `context` is a JSON
|
|
251
|
+
* column typed `Record<string, unknown>` — anything at all may be in it, and on
|
|
252
|
+
* an old row nothing is — so this is a defensive read with an explicit `=== true`
|
|
253
|
+
* rather than a truthiness test: the question is "did the pipeline stamp this",
|
|
254
|
+
* and a run carrying the string `"false"` is not an answer of yes.
|
|
255
|
+
*/
|
|
256
|
+
function isAutonomousRun(run) {
|
|
257
|
+
const ctx = run.context;
|
|
258
|
+
if (!ctx || typeof ctx !== "object")
|
|
259
|
+
return false;
|
|
260
|
+
return ctx._autonomous === true;
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
263
|
+
* The greppable case name out of a `"<case>: <explanation>"` reason.
|
|
264
|
+
*
|
|
265
|
+
* Reading the CASE off the reason is blessed by `build-decisions.ts`'s own
|
|
266
|
+
* module header — the grammar exists precisely so the case stays greppable
|
|
267
|
+
* without a parallel enum to keep in sync. Reading the PROSE would not be: the
|
|
268
|
+
* one skip with a durable consequence keys on the typed `budgetExhausted`
|
|
269
|
+
* field, never on this.
|
|
270
|
+
*/
|
|
271
|
+
function caseOf(reason) {
|
|
272
|
+
const colon = reason.indexOf(":");
|
|
273
|
+
return colon > 0 ? reason.slice(0, colon) : reason;
|
|
274
|
+
}
|
|
275
|
+
/**
|
|
276
|
+
* What a skip costs — recorded, never silent, but PROPORTIONATE.
|
|
277
|
+
*
|
|
278
|
+
* `pr-escalation.ts` states the doctrine this follows: a skip that is terminal
|
|
279
|
+
* for the problem owes a human an explanation on the subject itself, and a skip
|
|
280
|
+
* that is merely "come back later" owes them nothing but a log line. Applying
|
|
281
|
+
* the loud treatment to a transient skip is not a harmless excess — a cron that
|
|
282
|
+
* re-ticks every twenty minutes would comment every twenty minutes, which is
|
|
283
|
+
* the #256 failure shape (a notice with no de-duplication) rebuilt on a new
|
|
284
|
+
* subject.
|
|
285
|
+
*
|
|
286
|
+
* So, three tiers:
|
|
287
|
+
*
|
|
288
|
+
* | case | log | activity row | comment |
|
|
289
|
+
* |-------------------------|------|--------------|---------|
|
|
290
|
+
* | `concurrency-exhausted` | info | no | no |
|
|
291
|
+
* | `repo-quota-exhausted` | warn | yes | no |
|
|
292
|
+
* | `budget-exhausted` | warn | yes | once |
|
|
293
|
+
*
|
|
294
|
+
* `concurrency-exhausted` clears itself in minutes and fires on every sweep
|
|
295
|
+
* tick while it holds, so a row per tick would be noise in the one stream whose
|
|
296
|
+
* value is that a human can read it. The day quota is worth a row — it is a
|
|
297
|
+
* ceiling somebody configured and may want to raise — but not a comment: the
|
|
298
|
+
* issue is still going to be built, just not today. Only the spend ceiling is
|
|
299
|
+
* terminal for the day in a way the issue itself should carry.
|
|
300
|
+
*
|
|
301
|
+
* Every skip NOT in that table (`on-hold`, `not-autonomous`, `already-built`,
|
|
302
|
+
* `run-in-flight`) is silent here by design, as it was in Phase 1.
|
|
303
|
+
*
|
|
304
|
+
* Never throws: `recordActivity` swallows its own failures, and the GitHub half
|
|
305
|
+
* is best-effort. A refusal that failed to be recorded is still a refusal.
|
|
306
|
+
*/
|
|
307
|
+
async function applySkipConsequence(args, stage, decision, deps) {
|
|
308
|
+
const skipCase = caseOf(decision.reason);
|
|
309
|
+
if (skipCase !== "repo-quota-exhausted" && skipCase !== "budget-exhausted")
|
|
310
|
+
return;
|
|
311
|
+
const triggerId = issueTriggerId(args.repo, args.issueNumber);
|
|
312
|
+
// A ceiling somebody configured has been hit. `warn`, not `info`: this is the
|
|
313
|
+
// level an operator filters for when asking "is the pipeline stuck, or just
|
|
314
|
+
// quiet?", and both cases are answers to that question.
|
|
315
|
+
log.warn("Build gate refused a dispatch on a budget ceiling", {
|
|
316
|
+
workflow: stage.workflow,
|
|
317
|
+
repo: args.repo,
|
|
318
|
+
issueNumber: args.issueNumber,
|
|
319
|
+
case: skipCase,
|
|
320
|
+
reason: decision.reason,
|
|
321
|
+
});
|
|
322
|
+
await recordActivity(deps.db, {
|
|
323
|
+
action: "autonomy.skip",
|
|
324
|
+
// Nobody asked for this — the pipeline refused itself.
|
|
325
|
+
actorType: "system",
|
|
326
|
+
targetType: "issue",
|
|
327
|
+
targetId: triggerId,
|
|
328
|
+
// `denied`, not `ok`: the row records an action that did NOT happen, which
|
|
329
|
+
// is the same reading `pr.retry` gives a gate-refused retry.
|
|
330
|
+
outcome: "denied",
|
|
331
|
+
detail: { case: skipCase, workflow: stage.workflow, reason: decision.reason },
|
|
332
|
+
});
|
|
333
|
+
// The typed field, not the case name, is what gates the comment — and it is
|
|
334
|
+
// set on exactly one branch.
|
|
335
|
+
const exhausted = decision.budgetExhausted;
|
|
336
|
+
if (!exhausted)
|
|
337
|
+
return;
|
|
338
|
+
const github = deps.github;
|
|
339
|
+
const [owner, name] = args.repo.split("/");
|
|
340
|
+
if (!github || !owner || !name)
|
|
341
|
+
return;
|
|
342
|
+
// ── The de-duplication, keyed on a DURABLE FACT ──────────────────────────
|
|
343
|
+
//
|
|
344
|
+
// The label's absence is the key, exactly as `noticeForkPr` keys on its
|
|
345
|
+
// persisted record rather than on scanning comments for its own prose. This
|
|
346
|
+
// is the only thing standing between "one comment" and "one comment every
|
|
347
|
+
// twenty minutes for the rest of the day": the budget does not clear until
|
|
348
|
+
// midnight, so every sweep tick between now and then reaches this same
|
|
349
|
+
// branch. A body-text marker would not do — it costs an API scan per tick and
|
|
350
|
+
// breaks the moment the wording changes — and neither would a timestamp,
|
|
351
|
+
// which we would have nowhere to put.
|
|
352
|
+
//
|
|
353
|
+
// `args.labels` is the issue's CURRENT label set, the same snapshot the hold
|
|
354
|
+
// check read.
|
|
355
|
+
if (args.labels.includes(stage.on_failure))
|
|
356
|
+
return;
|
|
357
|
+
// Label FIRST, comment second — the crash-window argument `noticeForkPr`
|
|
358
|
+
// makes about its record. Crash between the two and the issue carries the
|
|
359
|
+
// blocked label with no explanation: wrong, but bounded and recoverable by a
|
|
360
|
+
// human taking the label off. Crash the other way round and the issue carries
|
|
361
|
+
// a comment with no label, so the dedup key was never written and every tick
|
|
362
|
+
// until midnight comments again. Between one missing sentence and an
|
|
363
|
+
// unbounded comment loop, the durable write goes first.
|
|
364
|
+
//
|
|
365
|
+
// Note this is `advanceStage` with a `to` and NO `from`: it ADDS the blocked
|
|
366
|
+
// label and removes nothing. The entry label must stay exactly where it is —
|
|
367
|
+
// the build has not run, so the issue has not left the queue, and the sweep
|
|
368
|
+
// re-picking it tomorrow is the intended behaviour. Advancing to `running`
|
|
369
|
+
// here would be the opposite of the truth.
|
|
370
|
+
const advance = await advanceStage({ owner, repo: name, issueNumber: args.issueNumber, to: stage.on_failure }, { github });
|
|
371
|
+
if (!advance.added) {
|
|
372
|
+
// No durable key was written, so a comment now would repeat on the next
|
|
373
|
+
// tick. Say nothing; the activity row above is still the record.
|
|
374
|
+
log.warn("Could not label a budget-exhausted issue — saying nothing, since a comment with no label would repeat every tick", {
|
|
375
|
+
repo: args.repo,
|
|
376
|
+
issueNumber: args.issueNumber,
|
|
377
|
+
label: stage.on_failure,
|
|
378
|
+
reason: advance.reason,
|
|
379
|
+
});
|
|
380
|
+
return;
|
|
381
|
+
}
|
|
382
|
+
try {
|
|
383
|
+
await github.postComment(owner, name, args.issueNumber, renderBudgetExhaustedComment({
|
|
384
|
+
scope: exhausted.scope,
|
|
385
|
+
limitUsd: exhausted.limitUsd,
|
|
386
|
+
spentUsd: exhausted.spentUsd,
|
|
387
|
+
repo: args.repo,
|
|
388
|
+
blockedLabel: stage.on_failure,
|
|
389
|
+
}));
|
|
390
|
+
}
|
|
391
|
+
catch (err) {
|
|
392
|
+
log.warn("Budget-exhausted comment failed", {
|
|
393
|
+
repo: args.repo,
|
|
394
|
+
issueNumber: args.issueNumber,
|
|
395
|
+
err,
|
|
396
|
+
});
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
/**
|
|
400
|
+
* The budget-exhausted comment. Pure, so its wording is table-testable — the
|
|
401
|
+
* same split `renderEscalationComment` makes.
|
|
402
|
+
*
|
|
403
|
+
* Three things it has to say, and nothing else. **Which ceiling**, with the
|
|
404
|
+
* configured number, because "I am out of budget" is unactionable and "I have
|
|
405
|
+
* spent $10.40 of this repo's $10.00" tells somebody exactly what to change.
|
|
406
|
+
* **When it resets**, because the default assumption is that a blocked bot
|
|
407
|
+
* stays blocked. And **both exits**, because this comment is the only place
|
|
408
|
+
* most people will ever learn there are any — the `pr-escalation.ts` rule that
|
|
409
|
+
* every exit which works must be named, and every exit named must work.
|
|
410
|
+
*
|
|
411
|
+
* Short on purpose: it is an interruption on somebody's issue, not a report.
|
|
412
|
+
*/
|
|
413
|
+
export function renderBudgetExhaustedComment(args) {
|
|
414
|
+
const ceiling = args.scope === "harness"
|
|
415
|
+
? `my daily model budget across every repository ($${args.limitUsd.toFixed(2)})`
|
|
416
|
+
: `the daily model budget for \`${args.repo}\` ($${args.limitUsd.toFixed(2)})`;
|
|
417
|
+
return (`I'm not starting a build here: I've hit ${ceiling}, having spent ` +
|
|
418
|
+
`$${args.spentUsd.toFixed(2)} so far today. It resets at midnight UTC.\n\n` +
|
|
419
|
+
`Two ways on from here: remove the \`${args.blockedLabel}\` label to re-arm me — ` +
|
|
420
|
+
`I'll pick this up again once the budget has reset — or ask whoever runs this ` +
|
|
421
|
+
`deployment to raise the limit.`);
|
|
422
|
+
}
|
|
423
|
+
//# sourceMappingURL=build-gate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build-gate.js","sourceRoot":"","sources":["../../src/engine/build-gate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAExF,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAC3E,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAO9C,MAAM,GAAG,GAAG,MAAM,CAAC,YAAY,CAAC,CAAC;AAmCjC,MAAM,CAAC,KAAK,UAAU,sBAAsB,CAC1C,IAAmB,EACnB,IAAmB;IAEnB,4EAA4E;IAC5E,EAAE;IACF,wEAAwE;IACxE,4EAA4E;IAC5E,8EAA8E;IAC9E,8EAA8E;IAC9E,2EAA2E;IAC3E,0CAA0C;IAC1C,MAAM,KAAK,GAAG,iBAAiB,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACrD,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,MAAM,MAAM,GAAG,oBAAoB,IAAI,CAAC,KAAK,iGAAiG,CAAC;QAC/I,GAAG,CAAC,IAAI,CAAC,qCAAqC,EAAE;YAC9C,IAAI,EAAE,IAAI,CAAC,IA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