lastlight-core 0.22.0 → 0.23.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.
Files changed (103) hide show
  1. package/config/default.yaml +70 -2
  2. package/dist/config/config.d.ts +35 -0
  3. package/dist/config/config.js +152 -3
  4. package/dist/config/config.js.map +1 -1
  5. package/dist/config/repo-config.d.ts +7 -0
  6. package/dist/config/repo-config.js +15 -0
  7. package/dist/config/repo-config.js.map +1 -1
  8. package/dist/connectors/github-webhook.d.ts +17 -0
  9. package/dist/connectors/github-webhook.js +150 -17
  10. package/dist/connectors/github-webhook.js.map +1 -1
  11. package/dist/connectors/types.d.ts +48 -1
  12. package/dist/cron/dependabot-discovery.d.ts +68 -11
  13. package/dist/cron/dependabot-discovery.js +78 -20
  14. package/dist/cron/dependabot-discovery.js.map +1 -1
  15. package/dist/cron/jobs.d.ts +4 -0
  16. package/dist/cron/jobs.js +38 -4
  17. package/dist/cron/jobs.js.map +1 -1
  18. package/dist/cron/review-discovery.d.ts +33 -20
  19. package/dist/cron/review-discovery.js +23 -30
  20. package/dist/cron/review-discovery.js.map +1 -1
  21. package/dist/engine/agent-executor.d.ts +1 -1
  22. package/dist/engine/agent-executor.js +1 -1
  23. package/dist/engine/agent-executor.js.map +1 -1
  24. package/dist/engine/dispatcher.d.ts +98 -1
  25. package/dist/engine/dispatcher.js +248 -231
  26. package/dist/engine/dispatcher.js.map +1 -1
  27. package/dist/engine/executors/shared.d.ts +43 -0
  28. package/dist/engine/executors/shared.js +65 -0
  29. package/dist/engine/executors/shared.js.map +1 -1
  30. package/dist/engine/fix-harvest.d.ts +169 -0
  31. package/dist/engine/fix-harvest.js +345 -0
  32. package/dist/engine/fix-harvest.js.map +1 -0
  33. package/dist/engine/fix-markers.d.ts +184 -0
  34. package/dist/engine/fix-markers.js +329 -0
  35. package/dist/engine/fix-markers.js.map +1 -0
  36. package/dist/engine/fix-scratch.d.ts +76 -0
  37. package/dist/engine/fix-scratch.js +77 -0
  38. package/dist/engine/fix-scratch.js.map +1 -0
  39. package/dist/engine/github/github.d.ts +212 -5
  40. package/dist/engine/github/github.js +481 -54
  41. package/dist/engine/github/github.js.map +1 -1
  42. package/dist/engine/pr-decisions.d.ts +342 -0
  43. package/dist/engine/pr-decisions.js +721 -0
  44. package/dist/engine/pr-decisions.js.map +1 -0
  45. package/dist/engine/pr-escalation.d.ts +152 -0
  46. package/dist/engine/pr-escalation.js +320 -0
  47. package/dist/engine/pr-escalation.js.map +1 -0
  48. package/dist/engine/pr-notes.d.ts +175 -0
  49. package/dist/engine/pr-notes.js +315 -0
  50. package/dist/engine/pr-notes.js.map +1 -0
  51. package/dist/engine/pr-state.d.ts +313 -0
  52. package/dist/engine/pr-state.js +515 -0
  53. package/dist/engine/pr-state.js.map +1 -0
  54. package/dist/engine/review-check.d.ts +200 -0
  55. package/dist/engine/review-check.js +305 -0
  56. package/dist/engine/review-check.js.map +1 -0
  57. package/dist/engine/router.d.ts +27 -0
  58. package/dist/engine/router.js +156 -22
  59. package/dist/engine/router.js.map +1 -1
  60. package/dist/evals-api.d.ts +7 -0
  61. package/dist/evals-api.js +30 -0
  62. package/dist/evals-api.js.map +1 -1
  63. package/dist/index.js +268 -20
  64. package/dist/index.js.map +1 -1
  65. package/dist/sandbox/index.d.ts +13 -0
  66. package/dist/sandbox/index.js +30 -0
  67. package/dist/sandbox/index.js.map +1 -1
  68. package/dist/sandbox/k8s/init-clone.d.ts +5 -0
  69. package/dist/sandbox/k8s/init-clone.js +27 -0
  70. package/dist/sandbox/k8s/init-clone.js.map +1 -1
  71. package/dist/state/execution-store.d.ts +27 -0
  72. package/dist/state/execution-store.js +45 -0
  73. package/dist/state/execution-store.js.map +1 -1
  74. package/dist/state/workflow-run-store.d.ts +73 -0
  75. package/dist/state/workflow-run-store.js +106 -24
  76. package/dist/state/workflow-run-store.js.map +1 -1
  77. package/dist/workflows/pr-scope.d.ts +63 -0
  78. package/dist/workflows/pr-scope.js +113 -0
  79. package/dist/workflows/pr-scope.js.map +1 -0
  80. package/dist/workflows/resume.js +17 -4
  81. package/dist/workflows/resume.js.map +1 -1
  82. package/dist/workflows/simple.d.ts +94 -1
  83. package/dist/workflows/simple.js +206 -3
  84. package/dist/workflows/simple.js.map +1 -1
  85. package/dist/workflows/target-policy.d.ts +0 -12
  86. package/dist/workflows/target-policy.js +9 -15
  87. package/dist/workflows/target-policy.js.map +1 -1
  88. package/package.json +4 -4
  89. package/skills/README.md +11 -5
  90. package/skills/dependency-impact/SKILL.md +83 -0
  91. package/skills/fixing/SKILL.md +194 -0
  92. package/skills/pr-comment/SKILL.md +4 -1
  93. package/skills/pr-review/SKILL.md +26 -9
  94. package/workflows/cron-dependabot-ci-fix.yaml +8 -5
  95. package/workflows/cron-review.yaml +14 -5
  96. package/workflows/dependabot-ci-fix.yaml +86 -2
  97. package/workflows/dependabot-pr-merge.yaml +13 -1
  98. package/workflows/pr-fix.yaml +84 -1
  99. package/workflows/pr-review.yaml +7 -0
  100. package/workflows/prompts/dependabot-ci-fix.md +70 -17
  101. package/workflows/prompts/dependabot-pr-merge.md +209 -81
  102. package/workflows/prompts/diagnose-ci.md +96 -0
  103. package/workflows/prompts/pr-fix.md +63 -4
@@ -36,12 +36,15 @@
36
36
  * `unknown` and kicks off the recompute; both sweeps re-poll it with a
37
37
  * widening backoff (`resolveMergeableState`, issue #204) before giving up.
38
38
  *
39
- * Both sweeps SKIP any PR carrying the `requires-human` label — the terminal
40
- * flag the dependabot prompts apply when Last Light can't proceed automatically
41
- * (a functional merge left for a human, or a CI fix it couldn't complete). That
42
- * stops the nightly crons re-attempting things we already know we can't land.
43
- * The webhooks are NOT label-gated, so a genuinely new bot push is still handled
44
- * live and the success path clears the label.
39
+ * **These are candidate finders, not policy** (09-state-machine.md → S1/S2).
40
+ * They answer "does this PR look like it needs this workflow?" — a fact about
41
+ * the pull request. Whether we may ACT on it (the `requires-human` escalation
42
+ * guard, the attempt counter, the cost cap, the per-SHA dedup, the fork guard)
43
+ * is decided once by `resolvePrState` + `resolveDispatchDisposition` at the
44
+ * `dispatchWorkflow` choke point, which the webhook route crosses too. The
45
+ * `requires-human` filter used to live here AND in the dispatcher, and the two
46
+ * disagreed by construction: the label was a one-way door on the cron side
47
+ * while the webhook cleared it on success. Now there is one answer.
45
48
  */
46
49
  /**
47
50
  * Last Light dependency-PR lifecycle labels. THE single source of truth for
@@ -54,6 +57,31 @@
54
57
  export const DEP_TRIVIAL_LABEL = "dependency-trivial";
55
58
  export const DEP_FUNCTIONAL_LABEL = "dependency-functional";
56
59
  export const REQUIRES_HUMAN_LABEL = "requires-human";
60
+ /**
61
+ * MAJOR-bump impact tiers (issue #252, 05-impact.md §5.4). Additive: the two
62
+ * labels above keep their meaning, because both are load-bearing for discovery
63
+ * — `dependency-functional` + `requires-human` still means "high impact, a
64
+ * human decides", so nothing about the escalated case changed.
65
+ *
66
+ * These say what the trivial/functional pair cannot: WHY a major was safe to
67
+ * land, or why it was not. Exactly one is ever applied at a time; the merge
68
+ * prompt clears the other two in the same idempotent pass.
69
+ *
70
+ * The hex colours are part of the contract — `github_ensure_labels` creates a
71
+ * missing label with them, so a rename here without the same edit in
72
+ * `workflows/prompts/dependabot-pr-merge.md` produces two label vocabularies on
73
+ * the same repo. `tests/cron/label-vocab.test.ts` pins names and colours
74
+ * against that prompt.
75
+ */
76
+ /** Green, matching `dependency-trivial` — a major that reads as trivial. */
77
+ export const DEP_MAJOR_LOW_LABEL = "dependency-major-low";
78
+ export const DEP_MAJOR_LOW_COLOR = "0e8a16";
79
+ /** Amber, matching `dependency-functional` — landed, but worth a glance. */
80
+ export const DEP_MAJOR_MEDIUM_LABEL = "dependency-major-medium";
81
+ export const DEP_MAJOR_MEDIUM_COLOR = "fbca04";
82
+ /** Red, matching `requires-human` — never auto-merged. */
83
+ export const DEP_MAJOR_HIGH_LABEL = "dependency-major-high";
84
+ export const DEP_MAJOR_HIGH_COLOR = "b60205";
57
85
  /** Bot logins that open dependency-update PRs. */
58
86
  const DEPENDENCY_BOT_LOGINS = new Set(["dependabot[bot]", "renovate[bot]"]);
59
87
  /** Titles a dependency bot uses, for the rare case its login is proxied/squashed. */
@@ -88,11 +116,15 @@ const realSleep = (ms) => new Promise((r) => setTimeout(r, ms));
88
116
  */
89
117
  const MERGE_BLOCKED_STATES = new Set(["behind", "dirty", "blocked"]);
90
118
  /**
91
- * List + filter one repo's open dependency-PR candidates: is-dependency,
92
- * non-draft, NOT carrying the `requires-human` label, oldest-first, capped at
93
- * `maxPerRepo`. Per-repo listing failures are logged and yield `[]`, never
94
- * fatal, so one inaccessible repo doesn't sink the sweep. Shared by both the
95
- * green and red sweeps.
119
+ * List one repo's open dependency-PR candidates: is-dependency, non-draft,
120
+ * oldest-first, capped at `maxPerRepo`. Per-repo listing failures are logged
121
+ * and yield `[]`, never fatal, so one inaccessible repo doesn't sink the sweep.
122
+ * Shared by both the green and red sweeps.
123
+ *
124
+ * No `requires-human` filter: that is a POLICY question, and it is now answered
125
+ * once at dispatch off the snapshot's `escalatedBy` / `escalatedAtSha` — which
126
+ * is what lets a maintainer's push re-arm a PR we escalated, instead of the
127
+ * label being a permanent one-way door with no code path that removes it.
96
128
  */
97
129
  async function listDependencyCandidates(full, gh, maxPerRepo, log) {
98
130
  const [owner, repo] = full.split("/");
@@ -110,8 +142,6 @@ async function listDependencyCandidates(full, gh, maxPerRepo, log) {
110
142
  }
111
143
  return open
112
144
  .filter(isDependencyPr)
113
- // Don't re-attempt what we already flagged as needing a human.
114
- .filter((p) => !p.labels.includes(REQUIRES_HUMAN_LABEL))
115
145
  .sort((a, b) => a.number - b.number) // oldest first (the sweep's fairness order)
116
146
  .slice(0, maxPerRepo)
117
147
  .map((p) => ({
@@ -156,8 +186,10 @@ async function resolveMergeableState(gh, owner, repo, pullNumber, opts) {
156
186
  }
157
187
  /**
158
188
  * Find every green (`mergeable_state: "clean"`) dependency PR across `repos`
159
- * (`owner/repo` full names), EXCLUDING any carrying the `requires-human` label.
160
- * A cold `unknown` read is re-polled (`resolveMergeableState`) before giving up,
189
+ * (`owner/repo` full names). No `requires-human` filter — that is a POLICY
190
+ * question, answered once at the dispatch gate off the PR-state snapshot (see
191
+ * the module header), which is what lets a maintainer's push re-arm a PR we
192
+ * gave up on. A cold `unknown` read is re-polled (`resolveMergeableState`) before giving up,
161
193
  * so a genuinely-mergeable-but-uncomputed PR isn't stranded for want of a second
162
194
  * read (issue #204). Per-repo failures are logged and skipped, never fatal.
163
195
  */
@@ -177,17 +209,41 @@ export async function discoverGreenDependencyPrs(repos, gh, opts = {}) {
177
209
  // Only genuinely-green PRs. `unstable`/`blocked`/`behind`/`dirty` (and a PR
178
210
  // still `unknown` after the re-poll) are left for the real-time webhook or
179
211
  // the next tick once they go clean.
180
- if (state === "clean") {
181
- out.push({ repo: c.full, prNumber: c.number, title: c.title });
212
+ if (state !== "clean")
213
+ continue;
214
+ // `clean` is GitHub's mergeability verdict, not a CI verdict — on a repo
215
+ // with no *required* checks a red PR is still "clean". Ask the checks
216
+ // directly so the cron's green means the same thing the webhook's does.
217
+ if (opts.requireSettledChecks) {
218
+ let conclusion;
219
+ try {
220
+ conclusion = await gh.getChecksConclusion(c.owner, c.repo, c.headSha || c.headRef, {
221
+ excludeApp: opts.botName,
222
+ });
223
+ }
224
+ catch (err) {
225
+ // Fail CLOSED here, uniquely: every other read in this module fails
226
+ // open because a dropped candidate costs one tick, whereas a
227
+ // wrongly-green candidate costs a merged red PR.
228
+ opts.log?.(`[dependabot-discovery] ${c.full}#${c.number}: checks read failed — ${String(err)}`);
229
+ continue;
230
+ }
231
+ if (conclusion !== "passing") {
232
+ opts.log?.(`[dependabot-discovery] ${c.full}#${c.number}: mergeable_state=clean but checks are ${conclusion} — not green`);
233
+ continue;
234
+ }
182
235
  }
236
+ out.push({ repo: c.full, prNumber: c.number, title: c.title });
183
237
  }
184
238
  }
185
239
  return out;
186
240
  }
187
241
  /**
188
242
  * Find every RED dependency PR across `repos` (`owner/repo` full names) that
189
- * `dependabot-ci-fix` can act on, EXCLUDING any carrying the `requires-human`
190
- * label. A PR qualifies when its checks are settled-FAILING, OR its
243
+ * `dependabot-ci-fix` can act on. No `requires-human` filter — see
244
+ * `discoverGreenDependencyPrs` and the module header: whether we may act on an
245
+ * escalated PR is decided at the dispatch gate, not here.
246
+ * A PR qualifies when its checks are settled-FAILING, OR its
191
247
  * `mergeable_state` is `behind` / `dirty` / `blocked` (a merge it can't make on
192
248
  * its own but ci-fix can push toward — see `MERGE_BLOCKED_STATES`). Failing CI
193
249
  * takes precedence in the reported `reason` (there's a concrete build to fix).
@@ -205,7 +261,9 @@ export async function discoverRedDependencyPrs(repos, gh, opts = {}) {
205
261
  try {
206
262
  // Query the exact commit we listed (headSha) so a mid-sweep push can't
207
263
  // make us read a newer commit's checks; fall back to the ref if absent.
208
- conclusion = await gh.getChecksConclusion(c.owner, c.repo, c.headSha || c.headRef);
264
+ conclusion = await gh.getChecksConclusion(c.owner, c.repo, c.headSha || c.headRef, {
265
+ excludeApp: opts.botName,
266
+ });
209
267
  // A settled-failing build is reason enough (and makes the mergeable
210
268
  // signal moot), so skip the potentially-slow `unknown` re-poll for it;
211
269
  // otherwise warm the read so a cold `unknown` that's really behind/dirty/
@@ -1 +1 @@
1
- {"version":3,"file":"dependabot-discovery.js","sourceRoot":"","sources":["../../src/cron/dependabot-discovery.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AAEH;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,oBAAoB,CAAC;AACtD,MAAM,CAAC,MAAM,oBAAoB,GAAG,uBAAuB,CAAC;AAC5D,MAAM,CAAC,MAAM,oBAAoB,GAAG,gBAAgB,CAAC;AAsDrD,kDAAkD;AAClD,MAAM,qBAAqB,GAAG,IAAI,GAAG,CAAC,CAAC,iBAAiB,EAAE,eAAe,CAAC,CAAC,CAAC;AAE5E,qFAAqF;AACrF,MAAM,mBAAmB,GACvB,6EAA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CAAC;AACb,CAAC"}
@@ -1,6 +1,10 @@
1
1
  import type { CronJob } from "./scheduler.js";
2
2
  import type { CronsConfig } from "../config/config.js";
3
3
  import type { StateDb } from "../state/db.js";
4
+ /** What a `condition.unless` predicate is evaluated against. */
5
+ export interface CronConditionContext {
6
+ webhooksEnabled: boolean;
7
+ }
4
8
  /**
5
9
  * Get cron jobs based on configuration.
6
10
  *
package/dist/cron/jobs.js CHANGED
@@ -1,6 +1,41 @@
1
1
  import { getAccessibleManagedRepos } from "../managed-repos.js";
2
2
  import { getCronWorkflows } from "../workflows/loader.js";
3
3
  import { CRON_GLOBALLY_ENABLED_KEY, CRON_NAME_KEY, operatorCrons } from "./repo-crons.js";
4
+ /**
5
+ * `condition.unless: <name>` → the predicate that name means.
6
+ *
7
+ * `jobs.ts` used to compare the field against the literal string
8
+ * `"webhooksEnabled"`, so a cron YAML could express exactly one condition and
9
+ * any other value was silently ignored — a typo turned a conditional cron into
10
+ * an unconditional one with no error. 07-review-triggers.md §7.4b asked for this
11
+ * generalisation and Phase 8 briefly made it moot by deleting the only consumer;
12
+ * 09-state-machine.md → S5 keeps the crons, so it is live again.
13
+ *
14
+ * **An unknown name keeps the cron.** Registration is the safe direction: a
15
+ * globally-off cron still ticks (a repo may opt back in), whereas a silently
16
+ * dropped one produces no ticks, no rows and no error — the exact failure the
17
+ * literal comparison already had.
18
+ */
19
+ const CRON_CONDITION_PREDICATES = {
20
+ webhooksEnabled: (ctx) => ctx.webhooksEnabled,
21
+ };
22
+ /** Names already warned about, so a bad `condition.unless` logs once per boot. */
23
+ const warnedConditions = new Set();
24
+ /** Should this cron be REGISTERED, given its `condition.unless`? */
25
+ function conditionAllows(unless, ctx) {
26
+ if (!unless)
27
+ return true;
28
+ const predicate = CRON_CONDITION_PREDICATES[unless];
29
+ if (!predicate) {
30
+ if (!warnedConditions.has(unless)) {
31
+ warnedConditions.add(unless);
32
+ console.warn(`[cron] unknown condition.unless "${unless}" — registering the cron anyway ` +
33
+ `(known: ${Object.keys(CRON_CONDITION_PREDICATES).join(", ")})`);
34
+ }
35
+ return true;
36
+ }
37
+ return !predicate(ctx);
38
+ }
4
39
  /**
5
40
  * Get cron jobs based on configuration.
6
41
  *
@@ -23,10 +58,9 @@ import { CRON_GLOBALLY_ENABLED_KEY, CRON_NAME_KEY, operatorCrons } from "./repo-
23
58
  export function getJobs(opts) {
24
59
  const jobs = [];
25
60
  let cronDefs = getCronWorkflows();
26
- // Apply conditions
27
- if (opts?.webhooksEnabled) {
28
- cronDefs = cronDefs.filter((def) => def.condition?.unless !== "webhooksEnabled");
29
- }
61
+ // Apply conditions through the predicate map, not a literal string compare.
62
+ const conditionCtx = { webhooksEnabled: !!opts?.webhooksEnabled };
63
+ cronDefs = cronDefs.filter((def) => conditionAllows(def.condition?.unless, conditionCtx));
30
64
  const overrides = opts?.db?.getAllCronOverrides() ?? new Map();
31
65
  // Already includes the legacy `disabled.crons` names (unioned by the config
32
66
  // normaliser). Those are additionally dropped by the asset loader before we
@@ -1 +1 @@
1
- {"version":3,"file":"jobs.js","sourceRoot":"","sources":["../../src/cron/jobs.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,yBAAyB,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAI1F;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,UAAU,OAAO,CAAC,IAKvB;IACC,MAAM,IAAI,GAAc,EAAE,CAAC;IAE3B,IAAI,QAAQ,GAAG,gBAAgB,EAAE,CAAC;IAElC,mBAAmB;IACnB,IAAI,IAAI,EAAE,eAAe,EAAE,CAAC;QAC1B,QAAQ,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,SAAS,EAAE,MAAM,KAAK,iBAAiB,CAAC,CAAC;IACnF,C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,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -1,12 +1,25 @@
1
1
  /**
2
- * Deterministic discovery for the pr-review cron (`check-prs-awaiting-review`).
2
+ * CANDIDATE FINDER for the pr-review cron (`check-prs-awaiting-review`).
3
3
  *
4
- * Finds the open PRs that need a review — open, non-draft, NOT authored by the
5
- * bot, and WITHOUT a bot review at the PR's current head SHA — across `repos`,
6
- * in code (no LLM). The caller fans out one bounded single-PR `pr-review` run
7
- * per result, with `prNumber` + head ref set (see `src/index.ts`) — the exact
8
- * shape the `pr.opened` webhook produces: a fresh per-repo scoped token, a
9
- * pre-clone of the PR head, and a real PR number for `post-review` to post to.
4
+ * Finds the open PRs across `repos` that could plausibly want a review, in code
5
+ * (no LLM). The caller fans out one bounded single-PR `pr-review` run per
6
+ * result, with `prNumber` + head ref set (see `src/index.ts`) — the exact shape
7
+ * the `pr.opened` webhook produces: a fresh per-repo scoped token, a pre-clone
8
+ * of the PR head, and a real PR number for `post-review` to post to.
9
+ *
10
+ * **It holds no policy** (09-state-machine.md → S2). It used to filter drafts
11
+ * and call `getLatestBotReview` per candidate, which made it a third
12
+ * implementation of `review.trigger` alongside the webhook gate and the comment
13
+ * path's silent bypass — in a plan whose whole thesis is "make the policy
14
+ * configurable rather than hardcoded". The split is DISCOVERY vs POLICY, not
15
+ * cron vs webhook: draft, already-reviewed-at-this-head, run-in-flight and the
16
+ * trigger mode are all fields of the `PrState` snapshot that
17
+ * `resolveReviewTrigger` decides over, once, at the dispatch choke point every
18
+ * route crosses.
19
+ *
20
+ * The one filter that stays is not policy but arithmetic: GitHub 422s an
21
+ * attempt to review your own pull request, so a bot-authored PR is not a
22
+ * candidate in the first place.
10
23
  *
11
24
  * This replaces the old `mode: scan` run, whose single agent listed and reviewed
12
25
  * PRs itself inside the sandbox — which couldn't reliably auth (a static token
@@ -27,27 +40,27 @@ export interface ReviewDiscoveryClient {
27
40
  headRef: string;
28
41
  headSha: string;
29
42
  }>>;
30
- /** The bot's most recent review on this PR's CURRENT head SHA, or null when
31
- * the bot hasn't reviewed this SHA yet (re-pushes invalidate a stale review). */
32
- getLatestBotReview(owner: string, repo: string, pullNumber: number, headSha: string, botLogin?: string): Promise<{
33
- state: string;
34
- } | null>;
35
43
  }
36
44
  export interface ReviewDiscoverOptions {
37
45
  log?: (msg: string) => void;
38
46
  /**
39
47
  * Bot login incl. the `[bot]` suffix (e.g. `last-light[bot]`). The bot's own
40
- * PRs are skipped (never self-review), and its review at the current head SHA
41
- * marks a PR done. Defaults to `last-light[bot]`; the caller passes the
42
- * configured `botLogin` so a renamed App slug matches.
48
+ * PRs are not candidates — GitHub refuses a self-review outright. Defaults to
49
+ * `last-light[bot]`; the caller passes the configured `botLogin` so a renamed
50
+ * App slug matches.
43
51
  */
44
52
  botLogin?: string;
45
53
  /**
46
- * Cap the number of runs DISPATCHED per repo per tick (not candidates
47
- * examined) so one busy repo can't spin hundreds of runs at once. The check
48
- * walks all open PRs and stops after this many *unreviewed* ones, so
49
- * already-reviewed PRs in the oldest positions never starve unreviewed PRs
50
- * behind them. Runs also queue against the global admission cap. Default 25.
54
+ * Cap the candidates offered per repo per tick, so one busy repo can't spin
55
+ * hundreds of dispatches at once. Oldest-first, so the cap is stable across
56
+ * ticks rather than starving the same tail every time.
57
+ *
58
+ * This used to cap runs DISPATCHED, walking every open PR and stopping after
59
+ * N *unreviewed* ones. That distinction died with the per-candidate
60
+ * `getLatestBotReview` call: the dispatch gate now answers "already reviewed
61
+ * at this head" from the one `PrState` snapshot it resolves anyway, so a
62
+ * candidate that turns out to be reviewed is a cheap gate skip, not a run.
63
+ * Runs also queue against the global admission cap. Default 25.
51
64
  */
52
65
  maxPerRepo?: number;
53
66
  }
@@ -1,12 +1,25 @@
1
1
  /**
2
- * Deterministic discovery for the pr-review cron (`check-prs-awaiting-review`).
2
+ * CANDIDATE FINDER for the pr-review cron (`check-prs-awaiting-review`).
3
3
  *
4
- * Finds the open PRs that need a review — open, non-draft, NOT authored by the
5
- * bot, and WITHOUT a bot review at the PR's current head SHA — across `repos`,
6
- * in code (no LLM). The caller fans out one bounded single-PR `pr-review` run
7
- * per result, with `prNumber` + head ref set (see `src/index.ts`) — the exact
8
- * shape the `pr.opened` webhook produces: a fresh per-repo scoped token, a
9
- * pre-clone of the PR head, and a real PR number for `post-review` to post to.
4
+ * Finds the open PRs across `repos` that could plausibly want a review, in code
5
+ * (no LLM). The caller fans out one bounded single-PR `pr-review` run per
6
+ * result, with `prNumber` + head ref set (see `src/index.ts`) — the exact shape
7
+ * the `pr.opened` webhook produces: a fresh per-repo scoped token, a pre-clone
8
+ * of the PR head, and a real PR number for `post-review` to post to.
9
+ *
10
+ * **It holds no policy** (09-state-machine.md → S2). It used to filter drafts
11
+ * and call `getLatestBotReview` per candidate, which made it a third
12
+ * implementation of `review.trigger` alongside the webhook gate and the comment
13
+ * path's silent bypass — in a plan whose whole thesis is "make the policy
14
+ * configurable rather than hardcoded". The split is DISCOVERY vs POLICY, not
15
+ * cron vs webhook: draft, already-reviewed-at-this-head, run-in-flight and the
16
+ * trigger mode are all fields of the `PrState` snapshot that
17
+ * `resolveReviewTrigger` decides over, once, at the dispatch choke point every
18
+ * route crosses.
19
+ *
20
+ * The one filter that stays is not policy but arithmetic: GitHub 422s an
21
+ * attempt to review your own pull request, so a bot-authored PR is not a
22
+ * candidate in the first place.
10
23
  *
11
24
  * This replaces the old `mode: scan` run, whose single agent listed and reviewed
12
25
  * PRs itself inside the sandbox — which couldn't reliably auth (a static token
@@ -38,31 +51,11 @@ export async function discoverPrsAwaitingReview(repos, gh, opts = {}) {
38
51
  continue;
39
52
  }
40
53
  const candidates = open
41
- .filter((pr) => !pr.draft && pr.authorLogin !== botLogin)
42
- .sort((a, b) => a.number - b.number); // oldest first — deterministic, fair
43
- // Cap RUNS dispatched, not candidates examined: walk every open PR and stop
44
- // once we've queued `maxPerRepo` UNreviewed ones. Slicing before the review
45
- // check would starve unreviewed PRs behind a block of already-reviewed ones
46
- // (the steady state), deferring them indefinitely.
47
- let dispatched = 0;
54
+ .filter((pr) => pr.authorLogin !== botLogin)
55
+ .sort((a, b) => a.number - b.number) // oldest first — deterministic, fair
56
+ .slice(0, maxPerRepo);
48
57
  for (const pr of candidates) {
49
- if (dispatched >= maxPerRepo)
50
- break;
51
- let reviewed;
52
- try {
53
- reviewed = !!(await gh.getLatestBotReview(owner, repo, pr.number, pr.headSha, botLogin));
54
- }
55
- catch (err) {
56
- // Can't tell → skip this tick rather than risk a duplicate review. The
57
- // next tick retries, and `post-review` is itself idempotent on the head
58
- // SHA, so a missed check here can't cause a double-post downstream.
59
- opts.log?.(`[review-discovery] ${full}#${pr.number}: review lookup failed — ${String(err)}`);
60
- continue;
61
- }
62
- if (reviewed)
63
- continue; // already reviewed at the current head SHA
64
58
  out.push({ repo: full, prNumber: pr.number, title: pr.title, branch: pr.headRef });
65
- dispatched++;
66
59
  }
67
60
  }
68
61
  return out;
@@ -1 +1 @@
1
- {"version":3,"file":"review-discovery.js","sourceRoot":"","sources":["../../src/cron/review-discovery.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAkDH,MAAM,iBAAiB,GAAG,iBAAiB,CAAC;AAC5C,MAAM,oBAAoB,GAAG,EAAE,CAAC;AAEhC,MAAM,CAAC,KAAK,UAAU,yBAAyB,CAC7C,KAAe,EACf,EAAyB,EACzB,OAA8B,EAAE;IAEhC,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,IAAI,iBAAiB,CAAC;IACpD,MAAM,UAAU,GAAG,IAAI,CAAC,UAAU,IAAI,oBAAoB,CAAC;IAC3D,MAAM,GAAG,GAAmB,EAAE,CAAC;IAE/B,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACtC,IAAI,CAAC,KAAK,IAAI,CAAC,IAAI,EAAE,CAAC;YACpB,IAAI,CAAC,GAAG,EAA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C,CAAC;QACpD,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,2EAA2E;YAC3E,+BAA+B;YAC/B,IAAI,CAAC,GAAG,EAAE,CAAC,sBAAsB,IAAI,0BAA0B,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;YAC9E,SAAS;QACX,CAAC;QAED,MAAM,UAAU,GAAG,IAAI;aACpB,MAAM,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,WAAW,KAAK,QAAQ,CAAC;aAC3C,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,qCAAqC;aACzE,KAAK,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC;QAExB,KAAK,MAAM,EAAE,IAAI,UAAU,EAAE,CAAC;YAC5B,GAAG,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,CAAC,OAAO,EAAE,CAAC,CAAC;QACrF,CAAC;IACH,CAAC;IAED,OAAO,GAAG,CAAC;AACb,CAAC"}
@@ -1,7 +1,7 @@
1
1
  import { type ExecutorConfig, type ExecutionResult, type GitSandboxAccess } from "./github/profiles.js";
2
2
  import type { SandboxFactory } from "../sandbox/sandbox.js";
3
3
  import { type CommandSpec } from "./executors/orchestrator.js";
4
- export { RunResultAccumulator, stageSkillBundle, excludeFromGit, detectAccountError, mapStopReason, reclassifySuccess } from "./executors/shared.js";
4
+ export { RunResultAccumulator, stageSkillBundle, excludeFromGit, resetVerifyScript, VERIFY_SCRIPT_NAME, detectAccountError, mapStopReason, reclassifySuccess } from "./executors/shared.js";
5
5
  export type { CommandSpec } from "./executors/orchestrator.js";
6
6
  export declare function executeAgent(prompt: string, config: ExecutorConfig, opts?: {
7
7
  taskId?: string;
@@ -11,7 +11,7 @@ import { OAUTH_ONLY_PROVIDERS, oauthEnvVarForProvider, oauthProviderIdForModel,
11
11
  import { runSandboxedAgent, runSandboxedCommand, } from "./executors/orchestrator.js";
12
12
  // Re-exported for back-compat with existing importers (tests, dashboards,
13
13
  // workflow phase executor).
14
- export { RunResultAccumulator, stageSkillBundle, excludeFromGit, detectAccountError, mapStopReason, reclassifySuccess } from "./executors/shared.js";
14
+ export { RunResultAccumulator, stageSkillBundle, excludeFromGit, resetVerifyScript, VERIFY_SCRIPT_NAME, detectAccountError, mapStopReason, reclassifySuccess } from "./executors/shared.js";
15
15
  /**
16
16
  * Resolve the App credentials to mint with from **boot config**, falling back to
17
17
  * `process.env` only when no config has been loaded (unit tests, embedders).
@@ -1 +1 @@
1
- {"version":3,"file":"agent-executor.js","sourceRoot":"","sources":["../../src/engine/agent-executor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAC/B,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EACL,0BAA0B,GAI3B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,gBAAgB,EAAuB,MAAM,qBAAqB,CAAC;AAE5E,OAAO,EAAE,uBAAuB,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACpH,OAAO,EAAE,EAAE,EAAE,QAAQ,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACjF,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AACjF,OAAO,EACL,oBAAoB,EACpB,sBAAsB,EACtB,uBAAuB,EACvB,kBAAkB,GACnB,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,iBAAiB,EACjB,mBAAmB,GAGpB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YAAY,CAAC;IAElC,IAAI,SAAS;QAAE,OAAO,iBAAiB,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IAE3D,MAAM,SAAS,GAAG,kBAAkB,CAAC;QACnC,eAAe,EAAE,IAAI,CAAC,IAAI;QAC1B,iBAAiB,EAAE,OAAO;QAC1B,SAAS,EAAE,MAAM;QACjB,IAAI,EAAE,MAAM,EAAE,IAAI;QAClB,gBAAgB,EAAE,MAAM,EAAE,OAAO;QACjC,mBAAmB,EAAE,MAAM,CAAC,kBAAkB,KAAK,IAAI;QACvD,eAAe,EAAE,MAAM,CAAC,SAAS,EAAE,YAAY;QAC/C,YAAY,EAAE,MAAM,CAAC,SAAS,EAAE,SAAS;KAC1C,CAAC,CAAC;IAEH,MAAM,GAAG,GAAsB;QAC7B,MAAM;QACN,MAAM;QACN,QAAQ;QACR,OAAO;QACP,GAAG,EAAE,KAAK;QACV,WAAW;QACX,MAAM;QACN,WAAW,EAAE,IAAI,EAAE,WAAW;QAC9B,cAAc,EAAE,IAAI,EAAE,cAAc;KACrC,CAAC;IACF,OAAO,QAAQ,CAAC,2BAA2B,EAAE,SAAS,EAAE,GAAG,EAAE,CAC3D,mBAAmB,CAAC,IAAI,EAAE,GAAG,EAAE;QAC7B,cAAc,EAAE,IAAI,EAAE,cAAc;QACpC,UAAU,EAAE,IAAI,EAAE,UAAU;QAC5B,YAAY,EAAE,IAAI,EAAE,YAAY;KACjC,CAAC,CACH,CAAC;AACJ,CAAC"}
@@ -4,6 +4,9 @@ import type { StateDb } from "../state/db.js";
4
4
  import type { GitHubClient } from "./github/github.js";
5
5
  import type { ChatResult } from "./chat/chat.js";
6
6
  import { type Route, type RouterDeps } from "./router.js";
7
+ import { type PrState } from "./pr-state.js";
8
+ import { type Decision, type FixDisposition, type PrPolicyConfig, type ReviewTriggerOptions } from "./pr-decisions.js";
9
+ import { type EscalationDeps } from "./pr-escalation.js";
7
10
  /**
8
11
  * Hand a workflow to the runner. Matches `dispatchWorkflow` in index.ts — the
9
12
  * dispatcher names workflows and accumulates their outcome but owns none of the
@@ -29,9 +32,40 @@ export interface DispatchDeps {
29
32
  sessionManager: SessionManager;
30
33
  runChat: RunChatFn;
31
34
  route?: (envelope: EventEnvelope, deps: RouterDeps) => Promise<Route>;
32
- reviewPostsCheck: boolean;
33
35
  publicUrl?: string;
36
+ /**
37
+ * Resolve the target repo's `.lastlight/` POLICY layer for this dispatch.
38
+ *
39
+ * INJECTED rather than imported so the dispatcher keeps no edge to the runner
40
+ * (`resolveRepoRunConfig` lives in `workflows/simple.ts`, which drags the
41
+ * loader, the sandbox and the artifact store in with it). `main()` wires the
42
+ * very same call `dispatchWorkflow` makes one level down, so both gates read
43
+ * ONE config.
44
+ *
45
+ * Without it the dispatcher read the OPERATOR's values while `dispatchWorkflow`
46
+ * read the repo-clamped ones, and the webhook route always hands `_prState`
47
+ * down — so on EVERY webhook-originated PR dispatch a managed repo's clamped
48
+ * `fix.maxAttempts` / `fix.maxCostUsd` / `fix.retryableClasses` /
49
+ * `dependencies.requireSettledChecks` / `review.trigger` / `skipDraft` /
50
+ * `postsCheck` were silently not applied, while `renderContext` rendered them
51
+ * to the prompt and `lastlight repo config show` reported them. Only the cron
52
+ * sweep and `/api/run` honoured them.
53
+ *
54
+ * Cheap: `fetchRepoLayer` memoises per repo for 60 s, so this call and
55
+ * `dispatchWorkflow`'s are one conditional request per repo per minute
56
+ * between them, and this one usually warms the cache for that one.
57
+ *
58
+ * Omitted (chat-only wiring, tests) means "no repo layer" — the operator's
59
+ * config, which is what the layer clamps toward anyway.
60
+ */
61
+ resolveRepoPolicy?: ResolveRepoPolicyFn;
34
62
  }
63
+ /**
64
+ * The three policy blocks a repo's `.lastlight/` layer may clamp, or undefined
65
+ * when no layer applies. Structurally the `RunRepoConfig` `resolveRepoRunConfig`
66
+ * returns, narrowed to what the gate reads.
67
+ */
68
+ export type ResolveRepoPolicyFn = (workflowName: string, context: Record<string, unknown>) => Promise<Partial<PrPolicyConfig> | undefined>;
35
69
  /**
36
70
  * The typed result of dispatching one event. Handlers return an outcome rather
37
71
  * than only producing side effects, so each branch is assertable through the
@@ -70,6 +104,69 @@ export type DispatchOutcome = {
70
104
  * former `registry.onEvent` closure so every event branch is testable.
71
105
  */
72
106
  export declare function dispatch(envelope: EventEnvelope, deps: DispatchDeps): Promise<DispatchOutcome>;
107
+ /**
108
+ * The three policy blocks the dispatch gate reads — the operator's config with
109
+ * the target repo's `.lastlight/` layer folded in.
110
+ *
111
+ * ONE config, one decision, every route. This used to be operator-only in the
112
+ * dispatcher and repo-clamped in `dispatchWorkflow`, which failed silently and
113
+ * asymmetrically: the gate used one number while `renderContext` rendered
114
+ * another to the prompt and `lastlight repo config show` reported the same one
115
+ * the prompt got. The repo layer may only ever clamp TIGHTER (add-only, see
116
+ * `packages/shared/src/repo-config-schema.ts`), so the old seam always erred by
117
+ * letting a run through the repo would have refused — which is exactly the
118
+ * direction a budget cap must not err in.
119
+ *
120
+ * `layer` comes from {@link DispatchDeps.resolveRepoPolicy}, which is the same
121
+ * `resolveRepoRunConfig` call `dispatchWorkflow` makes; the `?? operator`
122
+ * fallbacks mirror its `repoConfig?.fix ?? config.fix` exactly.
123
+ */
124
+ export declare function prPolicyConfig(layer?: Partial<PrPolicyConfig>): PrPolicyConfig;
125
+ /** Everything {@link applyPrDispatchGate} needs to act on its own verdict. */
126
+ export interface PrGateDeps extends EscalationDeps {
127
+ /** `<botName>[bot]`. Defaults to the boot config's. */
128
+ botLogin?: string;
129
+ /** `@<botName>`, for the `on-request` placeholder's instructions. */
130
+ botMention?: string;
131
+ }
132
+ /** What {@link applyPrDispatchGate} was asked to decide. */
133
+ export interface PrGateArgs {
134
+ workflowName: string;
135
+ state: PrState;
136
+ /** Already repo-clamped — see {@link prPolicyConfig}. */
137
+ policy: PrPolicyConfig;
138
+ explicitRequest?: boolean;
139
+ route: NonNullable<ReviewTriggerOptions["route"]>;
140
+ /** `[event]` (webhook/comment) or `[dispatch]` (cron, `/api/run`). */
141
+ logPrefix: string;
142
+ }
143
+ /**
144
+ * THE dispatch gate — decide, log, and apply the decision's own consequences.
145
+ *
146
+ * Both routes call this one function: the dispatcher for webhook/comment
147
+ * events, and `dispatchWorkflow` for the cron fan-out, `/api/run` and resume.
148
+ * They used to carry two hand-kept-in-step copies of it, reading two different
149
+ * configs (see {@link prPolicyConfig}) and diverging on which side effects a
150
+ * skip earns.
151
+ *
152
+ * The two consequences that belong to the DECISION rather than to the route are
153
+ * applied here, so neither can be forgotten by one caller:
154
+ *
155
+ * - a **deferred review** leaves the placeholder check that says "not yet"
156
+ * (itself route-limited inside `postReviewCheckForSkip` — a statement about a
157
+ * head SHA belongs on PR attention, not on every sweep tick);
158
+ * - a skip that is **terminal for this problem** is labelled and explained, and
159
+ * RECORDS A RUN ROW without which `escalatedAtSha` never persists and the next
160
+ * dispatch reads our own label as a human's permanent hold (09 → D1).
161
+ *
162
+ * What is NOT applied here is the route's own courtesy: replying to the human
163
+ * whose request was dropped, and the fork-PR notice. Both are answers to a
164
+ * person who is watching, so they belong to the route that has one — a daily
165
+ * cron re-posting a fork notice for the life of the PR is spam, not
166
+ * transparency. The caller keys them on the TYPED fields the deciding branch
167
+ * set (`decision.runInFlight`, `state.isFork`), never on the reason prose.
168
+ */
169
+ export declare function applyPrDispatchGate(args: PrGateArgs, deps: PrGateDeps): Promise<Decision<FixDisposition>>;
73
170
  /**
74
171
  * Run one chat turn end-to-end: record the execution, run the model, persist a
75
172
  * freshly-minted agent session id for resume, and post the reply (apologizing