lastlight-core 0.29.0 → 0.30.0
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 +52 -0
- package/dist/config/config.js +12 -0
- package/dist/config/config.js.map +1 -1
- package/dist/engine/github/github.d.ts +25 -0
- package/dist/engine/github/github.js +50 -0
- package/dist/engine/github/github.js.map +1 -1
- package/dist/engine/pr-decisions.js +99 -0
- package/dist/engine/pr-decisions.js.map +1 -1
- package/dist/engine/pr-state.d.ts +18 -0
- package/dist/engine/pr-state.js +36 -7
- package/dist/engine/pr-state.js.map +1 -1
- package/dist/engine/review-triage.d.ts +98 -0
- package/dist/engine/review-triage.js +122 -0
- package/dist/engine/review-triage.js.map +1 -0
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -1
- package/dist/workflows/resume.js +3 -0
- package/dist/workflows/resume.js.map +1 -1
- package/dist/workflows/runner.d.ts +0 -6
- package/dist/workflows/runner.js +52 -0
- package/dist/workflows/runner.js.map +1 -1
- package/package.json +3 -3
- package/workflows/answer.yaml +4 -30
- package/workflows/build.yaml +0 -12
- package/workflows/cron-dependabot-ci-fix.yaml +3 -23
- package/workflows/cron-dependabot-merge.yaml +3 -18
- package/workflows/cron-digest.yaml +0 -7
- package/workflows/cron-review.yaml +10 -24
- package/workflows/demo.yaml +4 -31
- package/workflows/dependabot-ci-fix.yaml +57 -161
- package/workflows/dependabot-pr-merge.yaml +24 -72
- package/workflows/explore.yaml +4 -13
- package/workflows/issue-comment.yaml +2 -9
- package/workflows/issue-triage.yaml +1 -18
- package/workflows/pr-comment.yaml +2 -9
- package/workflows/pr-fix.yaml +0 -80
- package/workflows/pr-review.yaml +164 -478
- package/workflows/prompts/review-triage.md +86 -0
- package/workflows/prompts/review.md +47 -2
- package/workflows/qa-test.yaml +8 -41
- package/workflows/repo-health.yaml +1 -9
- package/workflows/security-feedback.yaml +7 -18
- package/workflows/security-review.yaml +4 -22
- package/workflows/verify.yaml +8 -38
|
@@ -1,39 +1,24 @@
|
|
|
1
1
|
kind: pr-fix
|
|
2
2
|
name: dependabot-ci-fix
|
|
3
|
-
# PR-scoped
|
|
4
|
-
#
|
|
5
|
-
#
|
|
6
|
-
# resolved `PrState` snapshot on `context.prState`. A fork of this workflow that
|
|
7
|
-
# drops the key silently loses all four; `validateAssets` warns when a
|
|
8
|
-
# `routes.github.pr_*` target is missing it.
|
|
3
|
+
# Crosses the PR-scoped dispatch gate: the run lock shared with every other
|
|
4
|
+
# PR-scoped workflow, per-head-SHA dedup, escalation, and the resolved
|
|
5
|
+
# `PrState` snapshot on `context.prState`.
|
|
9
6
|
pr_scoped: true
|
|
10
|
-
# Runtime policy (issue #368) — pushes a fix to the PR's head branch, through
|
|
11
|
-
# `handlePrFix`. Shares the fix family's one workspace per PR
|
|
12
|
-
# (`${repo}-${N}-fix`). Full prose for each key is in the workflow schema
|
|
13
|
-
# (packages/workflow-engine/src/core/schema.ts).
|
|
14
7
|
git_access: repo-write
|
|
15
8
|
workspace: per-target-reuse
|
|
9
|
+
# Shares the fix family's ONE workspace per PR (`${repo}-${N}-fix`), which the
|
|
10
|
+
# run lock admits one of at a time.
|
|
16
11
|
pr_fix_shaped: true
|
|
17
12
|
description: |
|
|
18
|
-
Fix a dependency-update PR (Dependabot / Renovate) that
|
|
19
|
-
own — CI is red, or it
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
`
|
|
13
|
+
Fix a dependency-update PR (Dependabot / Renovate) that cannot merge on its
|
|
14
|
+
own — CI is red, or it is `behind` its base / `dirty` / `blocked`. Brings the
|
|
15
|
+
branch up to date, makes CI green, and pushes.
|
|
16
|
+
|
|
17
|
+
It never classifies or merges: once the checks go green the
|
|
18
|
+
`pr.checks_passed` webhook hands off to `dependabot-pr-merge`, the single
|
|
19
|
+
owner of the classify → label → auto-merge decision. The one label it applies
|
|
20
|
+
is `requires-human`, when it cannot land the PR at all.
|
|
26
21
|
|
|
27
|
-
Triggered by:
|
|
28
|
-
- pr.checks_failed webhook (a check_suite completed with a failure
|
|
29
|
-
conclusion) → routed here by the classifier when it recognises a
|
|
30
|
-
dependency-update PR (src/engine/router.ts + this file's `classification`).
|
|
31
|
-
- cron-dependabot-ci-fix backstop (`discover: red-dependency-prs`) → fans
|
|
32
|
-
out one run per PR whose checks are settled-failing OR whose
|
|
33
|
-
`mergeable_state` is `behind` / `dirty` / `blocked`
|
|
34
|
-
(src/cron/dependabot-discovery.ts). The `{{reason}}` says which.
|
|
35
|
-
# One in-place task-list comment that updates as the diagnose/fix phases run,
|
|
36
|
-
# rather than a comment per phase.
|
|
37
22
|
status_checklist: true
|
|
38
23
|
classification:
|
|
39
24
|
intent: dependabot-ci-fix
|
|
@@ -52,48 +37,28 @@ classification:
|
|
|
52
37
|
- 'PR AUTHOR: dependabot[bot], PR CHECKS: failing, COMMENT: "@bot can you take a look at this?" → INTENT: DEPENDABOTCIFIX, REPO: NONE, ISSUE: NONE, REASON: NONE'
|
|
53
38
|
|
|
54
39
|
phases:
|
|
55
|
-
#
|
|
56
|
-
#
|
|
57
|
-
#
|
|
40
|
+
# Classify the failure against the pre-cloned workspace (cheap) BEFORE the
|
|
41
|
+
# install + test cycle (expensive), so a failure no amount of fixing can
|
|
42
|
+
# address costs one short call.
|
|
58
43
|
- name: diagnose
|
|
59
44
|
label: Diagnose the failing checks
|
|
60
45
|
prompt: prompts/diagnose-ci.md
|
|
61
46
|
skill: fixing
|
|
62
|
-
# Cheap by intent — it reads logs and reproduces a command, it doesn't write
|
|
63
|
-
# code. Unset in config/default.yaml, so this falls through to models.default
|
|
64
|
-
# until an operator pins a cheaper model for it.
|
|
65
47
|
model: "{{models.diagnose}}"
|
|
66
48
|
output_var: diagnosis
|
|
67
|
-
# Nothing to diagnose when the PR
|
|
68
|
-
# repair
|
|
69
|
-
#
|
|
70
|
-
#
|
|
71
|
-
#
|
|
72
|
-
#
|
|
73
|
-
# `skip_if` below. The fix phase was skipped and the conflict left in place,
|
|
74
|
-
# on a `succeeded` run.
|
|
75
|
-
#
|
|
76
|
-
# Safe as a bare OR-ed list (the grammar has no negation) because
|
|
77
|
-
# `reason` carries CI's verdict FIRST: `dependabot-discovery.ts` resolves it
|
|
78
|
-
# as `conclusion === "failing" ? "checks-failing" : mergeableState`, so these
|
|
79
|
-
# three values imply CI is not settled-failing. A PR that is both red and
|
|
80
|
-
# behind arrives as `checks-failing` and still gets diagnosed.
|
|
81
|
-
#
|
|
82
|
-
# The fix phase's own `skip_if` rows read `scratch.fixMarkers.diagnosis.class`,
|
|
83
|
-
# which is absent when this phase is skipped — and an absent variable fails
|
|
84
|
-
# OPEN, so the fix phase runs. Its step 1 does the base merge + conflict
|
|
85
|
-
# resolution before it consults the diagnosis, and the prompt already guards
|
|
86
|
-
# the diagnosis behind `{{#if phaseOutputs.diagnosis}}`.
|
|
49
|
+
# Nothing to diagnose when the PR is not red: it is merge-BLOCKED, and the
|
|
50
|
+
# repair is mechanical. Diagnosing anyway was harmful rather than wasteful —
|
|
51
|
+
# this phase's taxonomy is CI-failure-shaped, so an agent seeing green
|
|
52
|
+
# checks answers `infra-dependent`, which is one of the stopping classes the
|
|
53
|
+
# fix phase skips on. `reason` carries CI's verdict first, so a PR that is
|
|
54
|
+
# both red and behind still arrives as `checks-failing` and is diagnosed.
|
|
87
55
|
skip_if:
|
|
88
56
|
- "reason == 'dirty'"
|
|
89
57
|
- "reason == 'behind'"
|
|
90
58
|
- "reason == 'blocked'"
|
|
91
|
-
# The tag WITH its colon, which is what the parser looks for
|
|
92
|
-
#
|
|
93
|
-
#
|
|
94
|
-
# `DIAGNOSIS_COMPLETE` pass a gate it then parsed to nothing — a green phase,
|
|
95
|
-
# a null diagnosis, and an attempt counter that never advanced. Pinned to
|
|
96
|
-
# `DIAGNOSIS_MARKER_POSTCONDITION` in src/engine/fix-markers.ts by test.
|
|
59
|
+
# The tag WITH its colon, which is what the parser looks for. The engine
|
|
60
|
+
# enforces the postcondition as a plain substring, so a bare tag lets an
|
|
61
|
+
# output that merely MENTIONS it pass a gate that then parses to nothing.
|
|
97
62
|
on_output:
|
|
98
63
|
requires_marker: "DIAGNOSIS_COMPLETE:"
|
|
99
64
|
messages:
|
|
@@ -103,121 +68,52 @@ phases:
|
|
|
103
68
|
- name: fix
|
|
104
69
|
label: Fix failing checks
|
|
105
70
|
prompt: prompts/dependabot-ci-fix.md
|
|
106
|
-
# `fixing` is primary (minimal repair + push discipline + the markers);
|
|
107
|
-
# `building`: install deps with the repo's package manager, then run the
|
|
108
|
-
# test/lint/typecheck gate before committing.
|
|
109
71
|
skills: [fixing, building]
|
|
110
72
|
model: "{{models.pr-fix}}"
|
|
111
|
-
# The three stopping classes: there is nothing
|
|
112
|
-
#
|
|
113
|
-
#
|
|
114
|
-
#
|
|
115
|
-
# poisoned with `requires-human` for a failure that isn't its fault.
|
|
73
|
+
# The three stopping classes: there is nothing for a fix phase to do, so it
|
|
74
|
+
# must not provision a sandbox and run a 900-second gate. A non-failing
|
|
75
|
+
# skip — the run still records `succeeded`, so `on_failure` does not post
|
|
76
|
+
# and the PR is never labelled `requires-human` for someone else's problem.
|
|
116
77
|
#
|
|
117
|
-
# Read off the PARSED class the
|
|
118
|
-
#
|
|
119
|
-
#
|
|
120
|
-
#
|
|
121
|
-
# `{{priorAttempts}}` line from an earlier attempt matched too; and
|
|
122
|
-
# `phaseOutputs` is EMPTY across a resume boundary, so the guard failed open
|
|
123
|
-
# and ran the full sandbox + gate on a verdict that said not to. `scratch`
|
|
124
|
-
# is reloaded from the run row, so it survives resume.
|
|
78
|
+
# Read off the PARSED class in `scratch`, never the phase's raw output:
|
|
79
|
+
# prose like "this is not class=flaky" matches a substring, a replayed
|
|
80
|
+
# attempt-journal line matches too, and `phaseOutputs` is EMPTY across a
|
|
81
|
+
# resume boundary. `scratch` is reloaded from the run row.
|
|
125
82
|
#
|
|
126
|
-
# `
|
|
127
|
-
#
|
|
128
|
-
#
|
|
129
|
-
# (09-state-machine.md §S1 — three flaky reports running is an intermittent
|
|
130
|
-
# real failure, and an unbounded series of free full runs otherwise).
|
|
131
|
-
# `promoteFlakyDiagnosis` in src/workflows/simple.ts matches the expression
|
|
132
|
-
# below LITERALLY; the other two rows always apply.
|
|
83
|
+
# `flaky` is BOUNDED: after `fix.maxFlakyDeferrals` consecutive flaky
|
|
84
|
+
# verdicts on the same problem the harness drops that row for the run, so
|
|
85
|
+
# the next attempt treats it as reproducible. The match is literal.
|
|
133
86
|
skip_if:
|
|
134
87
|
- "scratch.fixMarkers.diagnosis.class == 'flaky'"
|
|
135
88
|
- "scratch.fixMarkers.diagnosis.class == 'infra-dependent'"
|
|
136
89
|
- "scratch.fixMarkers.diagnosis.class == 'upstream-broken'"
|
|
137
|
-
# Load-bearing
|
|
138
|
-
#
|
|
139
|
-
#
|
|
140
|
-
#
|
|
141
|
-
# the fallback for a context that carries no `fix:` at all (#256). The two
|
|
142
|
-
# no longer have to be kept in step by hand.
|
|
90
|
+
# Load-bearing: the gate command otherwise inherits a 30-second default,
|
|
91
|
+
# which kills any real test suite mid-run and reports a false red. Read
|
|
92
|
+
# from the run's repo-clamped `fix:` block, with the packaged value as the
|
|
93
|
+
# fallback for a context that carries none.
|
|
143
94
|
timeout_seconds: { from: fix.gateTimeoutSeconds, default: 900 }
|
|
144
|
-
# Closes the missing-postcondition gap: without a marker, a run that
|
|
145
|
-
# inspects the PR and stops without pushing or labelling reports green.
|
|
146
|
-
# The tag WITH its colon — see the `diagnose` phase above.
|
|
147
95
|
on_output:
|
|
148
96
|
requires_marker: "CI_FIX_COMPLETE:"
|
|
149
|
-
# The within-run local gate loop (04-retry.md §4.5). The gate command isn't
|
|
150
|
-
# statically knowable — package manager from the lockfile, commands from the
|
|
151
|
-
# repo's CI workflow — so the `fixing` skill has the agent write it to
|
|
152
|
-
# `.git/lastlight-verify.sh` inside the checkout (under `.git/`, so no
|
|
153
|
-
# `git add -A` can ever commit it, and deleted at the start of every attempt
|
|
154
|
-
# so a superseded diagnosis can't gate this one). No script yet ⇒ an EXPLICIT non-zero exit: `gate=skipped`
|
|
155
|
-
# is treated as red and never authorises a push (09-state-machine.md §S1).
|
|
156
|
-
# `max_iterations` reads `fix.localIterations`, same as `timeout_seconds`
|
|
157
|
-
# above; `2` is the packaged fallback, not the operative value.
|
|
158
|
-
#
|
|
159
|
-
# Run the gate with `bash`, NOT `sh`. `/bin/sh` in the sandbox image is
|
|
160
|
-
# dash, and the script the agent writes is the one the `fixing` skill asks
|
|
161
|
-
# for — a shell script that opens `set -euo pipefail`. dash rejects
|
|
162
|
-
# `-o pipefail` on line 2 and exits 2 before the first real command, so
|
|
163
|
-
# `sh <script>` made the gate a CONSTANT RED in milliseconds: every loop
|
|
164
|
-
# burned all its iterations, no iteration could ever satisfy the condition,
|
|
165
|
-
# and the harness's half of "no green gate ⇒ no push" never fired — leaving
|
|
166
|
-
# the agent's own self-reported `gate=green` (it runs the script directly,
|
|
167
|
-
# so its shebang IS honoured) as the only thing gating a push. `sh` also
|
|
168
|
-
# discards the script's `#!` line, which is precisely what let the harness
|
|
169
|
-
# and the agent disagree about the same file; `bash` is a superset of the
|
|
170
|
-
# shell any gate script here targets, so it agrees with a `#!/bin/sh`,
|
|
171
|
-
# `#!/usr/bin/env bash`, or shebang-less script alike.
|
|
172
|
-
#
|
|
173
|
-
# `until:` is checked FIRST and short-circuits `until_bash` entirely
|
|
174
|
-
# (phase-executor.ts: `if (!conditionMet && loop.until_bash)`), so it is
|
|
175
|
-
# where "there is nothing left for the gate to gate" belongs. The one case
|
|
176
|
-
# that qualifies is `outcome=pushed`: the commit is already ON the branch,
|
|
177
|
-
# GitHub's checks started against it the moment it landed, and they are the
|
|
178
|
-
# strictly better authority — the real CI environment rather than a sandbox
|
|
179
|
-
# approximation of it, warm rather than a cold container, and running
|
|
180
|
-
# against every matrix leg we cannot reproduce here. Run `49c101aa` is the
|
|
181
|
-
# bill for not saying so: the agent pushed at 11:03:31 having already run
|
|
182
|
-
# the whole suite itself, GitHub went fully green at 11:06:25, and the
|
|
183
|
-
# harness spent 11:04:00–11:10:48 in a fresh container re-running the same
|
|
184
|
-
# suite a third time before agreeing. The gate's exit code could not have
|
|
185
|
-
# changed anything by then — all it decides is whether to spend ANOTHER
|
|
186
|
-
# agent iteration, and a pushed fix has nothing left to iterate on.
|
|
187
|
-
#
|
|
188
|
-
# It short-circuits on `pushed` ONLY. `no-change` / `gave-up` still pay for
|
|
189
|
-
# the gate, deliberately: nothing was pushed, so there is no new commit, no
|
|
190
|
-
# new check run and no external authority — the local gate is the only
|
|
191
|
-
# evidence that exists, and its RED verdict is precisely what earns the
|
|
192
|
-
# agent the next iteration. Short-circuiting all three outcomes would exit
|
|
193
|
-
# every loop at iteration 1 and quietly turn `fix.localIterations` into
|
|
194
|
-
# dead config.
|
|
195
|
-
#
|
|
196
|
-
# The needle carries `tried=` on purpose. `outcome=pushed` on its own also
|
|
197
|
-
# appears in a rendered `{{priorAttempts}}` journal line from an EARLIER
|
|
198
|
-
# attempt (`renderAttemptLine`: `… | outcome=pushed gate=green`), which this
|
|
199
|
-
# prompt replays — the same replayed-line false match that forced the
|
|
200
|
-
# `skip_if` rows above off `phaseOutputs` and onto the parsed `scratch`
|
|
201
|
-
# value. Inside a loop iteration `scratch` is not an option (the scheduler
|
|
202
|
-
# refreshes it per PHASE node, not per iteration, so it is stale here), but
|
|
203
|
-
# `renderAttemptLine` deliberately omits `tried=`, so `outcome=pushed tried=`
|
|
204
|
-
# matches a LIVE `CI_FIX_COMPLETE:` line and nothing else. A marker that
|
|
205
|
-
# reorders its fields simply fails to match and the gate runs exactly as
|
|
206
|
-
# before — the fallback is the old behaviour, which is the right way round.
|
|
207
|
-
#
|
|
208
|
-
# What this gives up, stated plainly: after a push the harness no longer has
|
|
209
|
-
# an independent check on the agent's self-reported `gate=green`. That reads
|
|
210
|
-
# like the `sh`-vs-`bash` bug above and is not the same thing, because the
|
|
211
|
-
# gate in this flow runs AFTER the push and therefore never gated it — the
|
|
212
|
-
# agent's self-report was already the only thing between a bad fix and the
|
|
213
|
-
# branch, on every run this workflow has ever done. What actually catches a
|
|
214
|
-
# bad fix is untouched: GitHub's checks go red, `pr.checks_failed`
|
|
215
|
-
# re-dispatches this family, and `fix.maxAttempts` / `fix.maxCostUsd` bound
|
|
216
|
-
# the retries. The `bash`-not-`sh` fix still matters for the UNPUSHED path,
|
|
217
|
-
# which is where the loop's iterations actually live.
|
|
218
97
|
generic_loop:
|
|
219
98
|
max_iterations: { from: fix.localIterations, default: 2 }
|
|
99
|
+
# `until` is checked FIRST and short-circuits the gate below entirely.
|
|
100
|
+
# `pushed` is the one outcome that qualifies: the commit is on the branch
|
|
101
|
+
# and GitHub's own checks are the better authority, so re-running the
|
|
102
|
+
# suite locally can no longer change anything. `no-change` / `gave-up`
|
|
103
|
+
# still pay for the gate — its RED verdict is what earns the next
|
|
104
|
+
# iteration. The `tried=` needle matters: a bare `outcome=pushed` also
|
|
105
|
+
# appears in a replayed attempt-journal line from an EARLIER attempt.
|
|
220
106
|
until: "output.contains('outcome=pushed tried=')"
|
|
107
|
+
# The gate command is not statically knowable — package manager from the
|
|
108
|
+
# lockfile, commands from the repo's CI — so the agent writes it to
|
|
109
|
+
# `.git/lastlight-verify.sh`, which `git add -A` can never commit. No
|
|
110
|
+
# script means an explicit non-zero exit: a skipped gate is treated as
|
|
111
|
+
# red and never authorises a push.
|
|
112
|
+
#
|
|
113
|
+
# `bash`, NOT `sh`. `/bin/sh` in the sandbox is dash, the script opens
|
|
114
|
+
# `set -euo pipefail`, and dash exits 2 on line 2 — a constant red in
|
|
115
|
+
# milliseconds, which burns every iteration and leaves the agent's own
|
|
116
|
+
# self-report as the only thing gating the push.
|
|
221
117
|
until_bash: "if [ -f .git/lastlight-verify.sh ]; then bash .git/lastlight-verify.sh; else echo 'no .git/lastlight-verify.sh — gate=skipped, treated as RED'; exit 1; fi"
|
|
222
118
|
fresh_context: false
|
|
223
119
|
messages:
|
|
@@ -1,42 +1,24 @@
|
|
|
1
1
|
kind: pr-merge
|
|
2
2
|
name: dependabot-pr-merge
|
|
3
|
-
# PR-scoped
|
|
4
|
-
#
|
|
5
|
-
#
|
|
6
|
-
#
|
|
7
|
-
# drops the key silently loses all four; `validateAssets` warns when a
|
|
8
|
-
# `routes.github.pr_*` target is missing it.
|
|
3
|
+
# Crosses the PR-scoped dispatch gate: the run lock, per-head-SHA dedup,
|
|
4
|
+
# escalation, and the resolved `PrState` snapshot on `context.prState`. Always
|
|
5
|
+
# single-PR, so a repeated webhook and the daily cron backstop dedup onto one
|
|
6
|
+
# run.
|
|
9
7
|
pr_scoped: true
|
|
10
|
-
#
|
|
11
|
-
#
|
|
12
|
-
# single-PR, so it keys its (checkout-free) run by (repo, PR) and a repeated
|
|
13
|
-
# webhook + the daily cron backstop dedup onto one run. Full prose for each
|
|
14
|
-
# key is in the workflow schema (packages/workflow-engine/src/core/schema.ts).
|
|
8
|
+
# Never pushes code, but `github_enable_auto_merge` lives in the repo-write
|
|
9
|
+
# tool profile.
|
|
15
10
|
git_access: repo-write
|
|
16
11
|
workspace: per-target-reuse
|
|
17
12
|
description: |
|
|
18
|
-
Assess an already-GREEN dependency-update PR
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
rebases itself. That
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
auto-merge — only trivial bumps do. The companion to dependabot-ci-fix: that
|
|
27
|
-
one repairs a RED bump and pushes a fix; this one merges a GREEN one that
|
|
28
|
-
needs no fix at all.
|
|
13
|
+
Assess an already-GREEN dependency-update PR and, when the change is trivial,
|
|
14
|
+
enable GitHub auto-merge (squash). Always runs against a single PR.
|
|
15
|
+
|
|
16
|
+
When a bump is merely behind its base or has a lockfile conflict it asks the
|
|
17
|
+
bot that opened the PR to rebase or recreate its own branch; it never pushes
|
|
18
|
+
or rebases itself. That request is independent of the merge verdict — a major
|
|
19
|
+
version still gets its branch regenerated, but only a trivial bump is merged.
|
|
20
|
+
The companion to dependabot-ci-fix, which repairs a RED bump instead.
|
|
29
21
|
|
|
30
|
-
Always runs against a SINGLE PR (`{{prNumber}}`). Triggered by:
|
|
31
|
-
- pr.checks_passed webhook (a check_suite completed with a success
|
|
32
|
-
conclusion on a Dependabot/Renovate PR) → routed here by the router's
|
|
33
|
-
deterministic intent lookup (src/engine/router.ts + this file's
|
|
34
|
-
`classification`).
|
|
35
|
-
- the cron-dependabot-merge backstop: the cron runner finds the green
|
|
36
|
-
dependency PRs across managed repos IN CODE
|
|
37
|
-
(src/cron/dependabot-discovery.ts) and fans out one run per PR — same
|
|
38
|
-
single-PR shape as the webhook. (This replaced an agent `mode: scan`
|
|
39
|
-
sweep that assessed a whole repo at once and overflowed on busy repos.)
|
|
40
22
|
classification:
|
|
41
23
|
intent: dependabot-pr-merge
|
|
42
24
|
description: |
|
|
@@ -55,53 +37,23 @@ classification:
|
|
|
55
37
|
- 'PR AUTHOR: renovate[bot], PR CHECKS: passing, COMMENT: "@bot can you look at this?" → INTENT: DEPENDABOTPRMERGE, REPO: NONE, ISSUE: NONE, REASON: NONE'
|
|
56
38
|
|
|
57
39
|
phases:
|
|
58
|
-
#
|
|
59
|
-
#
|
|
60
|
-
#
|
|
61
|
-
# auto-merge ONLY for trivial, non-functional dependency bumps; anything with
|
|
62
|
-
# runtime-logic impact is left for a human. No repo checkout — the agent
|
|
63
|
-
# inspects the ONE PR via `github_list_pull_request_files` (file list + line
|
|
64
|
-
# counts) and skips lockfile diffs, only pulling `github_get_pull_request_diff`
|
|
65
|
-
# for a small non-lockfile source change. It never pushes or rebases itself: a
|
|
66
|
-
# PR that is `behind`/`dirty` is nudged to rebase via the bot's own command
|
|
67
|
-
# (@dependabot rebase|recreate) or Renovate's rebase label. That nudge is NOT
|
|
68
|
-
# gated on the verdict — regenerating a bot's own branch is safe and says
|
|
69
|
-
# nothing about merge-safety — but only a trivial PR also gets auto-merge
|
|
70
|
-
# enabled to land it once GitHub re-runs the checks green. Because
|
|
71
|
-
# each run assesses a single PR, its context is bounded — the overflow that
|
|
72
|
-
# killed the old whole-repo scan can't happen.
|
|
40
|
+
# One phase, and no repo checkout: the agent reads the PR's file list, skips
|
|
41
|
+
# lockfile diffs, and pulls the diff only for a small non-lockfile source
|
|
42
|
+
# change — so its context is bounded by construction.
|
|
73
43
|
#
|
|
74
|
-
# It is also the
|
|
75
|
-
#
|
|
76
|
-
#
|
|
77
|
-
#
|
|
78
|
-
#
|
|
79
|
-
# weakens verification" a TRIVIAL-disqualifying conjunct. This workflow is
|
|
80
|
-
# where such a PR necessarily lands — suppression turns the checks GREEN, so
|
|
81
|
-
# `pr.checks_failed` never fires and the fix family never sees it again.
|
|
82
|
-
# See prompts/dependabot-pr-merge.md.
|
|
44
|
+
# It is also the last gate before a merge, and therefore the backstop against
|
|
45
|
+
# a fix that made CI green by DISABLING the check: suppression turns the
|
|
46
|
+
# checks green, so `pr.checks_failed` never fires again and the fix family
|
|
47
|
+
# never sees the PR. "Nothing weakens verification" is a trivial-disqualifying
|
|
48
|
+
# conjunct in the prompt; nothing enforces it in code.
|
|
83
49
|
- name: assess
|
|
84
50
|
label: Assess & maybe auto-merge
|
|
85
51
|
prompt: prompts/dependabot-pr-merge.md
|
|
86
|
-
# `
|
|
87
|
-
#
|
|
88
|
-
# a skill rather than more prompt prose because it is needed ONLY when the
|
|
89
|
-
# PR is a major, and pi surfaces skills as an on-demand catalogue. It is
|
|
90
|
-
# also per-repo overridable (`.lastlight/skills/dependency-impact/SKILL.md`)
|
|
91
|
-
# without the operator having to widen `repoConfig.allowKeys`.
|
|
52
|
+
# `dependency-impact` is a skill rather than more prompt prose because it is
|
|
53
|
+
# needed only for a MAJOR bump, and skills are surfaced on demand.
|
|
92
54
|
skills: [code-review, dependency-impact]
|
|
93
55
|
model: "{{models.review}}"
|
|
94
|
-
# Postcondition: the assess run MUST sign off with this marker (see the
|
|
95
|
-
# prompt's OUTPUT contract). Its absence means the agent inspected files then
|
|
96
|
-
# stopped without reaching a verdict or acting — a silent no-op that used to
|
|
97
|
-
# report a false green (e.g. after a context-overflow retry). Fail loudly.
|
|
98
56
|
on_output:
|
|
99
57
|
requires_marker: "ASSESSMENT_COMPLETE"
|
|
100
|
-
# Deliberately NO on_start / on_success acks: they posted a comment on the PR
|
|
101
|
-
# on EVERY run (a green suite fires per check-reporting app, plus the daily
|
|
102
|
-
# cron), which flooded dependency PRs with "Assessing…/Assessed…" noise. The
|
|
103
|
-
# run now comments only when it has something to say — a real verdict
|
|
104
|
-
# (functional / requires-human) or a rebase nudge from the prompt, or the
|
|
105
|
-
# on_failure notice below.
|
|
106
58
|
messages:
|
|
107
59
|
on_failure: "Couldn't assess the dependency PR — leaving for a human."
|
package/workflows/explore.yaml
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
kind: explore
|
|
2
2
|
name: explore
|
|
3
|
-
# Runtime policy (issue #368) — reads, researches and publishes a spec as an
|
|
4
|
-
# issue/comment; never pushes code. Full prose for each key is in the workflow
|
|
5
|
-
# schema (packages/workflow-engine/src/core/schema.ts).
|
|
6
3
|
git_access: issues-write
|
|
7
4
|
classification:
|
|
8
5
|
intent: explore
|
|
@@ -20,15 +17,12 @@ chat:
|
|
|
20
17
|
- brainstorm <idea>
|
|
21
18
|
- spec this out
|
|
22
19
|
description: |
|
|
23
|
-
Socratic idea-shaping loop: read the
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
for Slack-initiated runs).
|
|
20
|
+
Socratic idea-shaping loop: read the issue or thread, ask clarifying
|
|
21
|
+
questions in a reply-gated loop until the shape is clear, then synthesize a
|
|
22
|
+
spec and publish it — as a comment for GitHub runs, or as a new issue in
|
|
23
|
+
EXPLORE_DEFAULT_REPO for Slack runs.
|
|
28
24
|
|
|
29
25
|
trigger: explore
|
|
30
|
-
# Single in-place task-list comment/message instead of a comment per phase.
|
|
31
|
-
# Reply-gate questions and the published spec still post as standalone notes.
|
|
32
26
|
status_checklist: true
|
|
33
27
|
|
|
34
28
|
phases:
|
|
@@ -59,9 +53,6 @@ phases:
|
|
|
59
53
|
interactive: true
|
|
60
54
|
gate_kind: reply
|
|
61
55
|
scratch_key: socratic
|
|
62
|
-
# A degenerate turn (agent exits with no question) retries once; if it's
|
|
63
|
-
# still empty, advance to synthesis with the Q&A gathered so far instead
|
|
64
|
-
# of hard-failing the whole explore run.
|
|
65
56
|
on_soft_failure:
|
|
66
57
|
retries: 1
|
|
67
58
|
then: complete
|
|
@@ -1,16 +1,9 @@
|
|
|
1
1
|
kind: comment
|
|
2
2
|
name: issue-comment
|
|
3
|
-
# Runtime policy (issue #368) — replies in-thread; never pushes code. Full
|
|
4
|
-
# prose for each key is in the workflow schema
|
|
5
|
-
# (packages/workflow-engine/src/core/schema.ts).
|
|
6
3
|
git_access: issues-write
|
|
7
4
|
description: |
|
|
8
|
-
Respond conversationally to a comment on an issue
|
|
9
|
-
|
|
10
|
-
replies in-thread without invoking the full Architect → Executor cycle.
|
|
11
|
-
|
|
12
|
-
Triggered by:
|
|
13
|
-
- issue_comment.created webhook (when classifier returns "lightweight")
|
|
5
|
+
Respond conversationally to a comment on an issue, without invoking the full
|
|
6
|
+
Architect → Executor cycle.
|
|
14
7
|
|
|
15
8
|
phases:
|
|
16
9
|
- name: respond
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
kind: triage
|
|
2
2
|
name: issue-triage
|
|
3
|
-
# Runtime policy (issue #368) — labels the issue and comments; never pushes
|
|
4
|
-
# code. Full prose for each key is in the workflow schema
|
|
5
|
-
# (packages/workflow-engine/src/core/schema.ts).
|
|
6
3
|
git_access: issues-write
|
|
7
4
|
classification:
|
|
8
5
|
intent: triage
|
|
@@ -13,11 +10,6 @@ classification:
|
|
|
13
10
|
examples:
|
|
14
11
|
- '"triage cliftonc/drizzle-cube#42" → INTENT: TRIAGE, REPO: cliftonc/drizzle-cube, ISSUE: 42, REASON: NONE'
|
|
15
12
|
- '"could you triage this?" with ISSUE TITLE "Crash on empty CSV" → INTENT: TRIAGE, REPO: NONE, ISSUE: NONE, REASON: NONE'
|
|
16
|
-
# Counter-examples: questions ABOUT issues. Each names a repo and the word
|
|
17
|
-
# "issues", and none of them wants a label changed — chat answers all three
|
|
18
|
-
# from its own GitHub reads. The first is the real misroute this guards
|
|
19
|
-
# against: it dispatched a single-issue workflow with no issue, which
|
|
20
|
-
# improvised a repo sweep, changed nothing, and reported success.
|
|
21
13
|
- '"Are there any issues in cliftonc/drizzle-cube that are overdue?" → INTENT: CHAT, REPO: cliftonc/drizzle-cube, ISSUE: NONE, REASON: NONE'
|
|
22
14
|
- '"how many open bugs does cliftonc/drizzle-cube have?" → INTENT: CHAT, REPO: cliftonc/drizzle-cube, ISSUE: NONE, REASON: NONE'
|
|
23
15
|
- '"whats the oldest untriaged issue in cliftonc/drizzle-cube?" → INTENT: CHAT, REPO: cliftonc/drizzle-cube, ISSUE: NONE, REASON: NONE'
|
|
@@ -30,21 +22,12 @@ chat:
|
|
|
30
22
|
- label this issue
|
|
31
23
|
description: |
|
|
32
24
|
Triage a GitHub issue: read it, classify it, label it, and act on stale or
|
|
33
|
-
incomplete reports.
|
|
34
|
-
|
|
35
|
-
Triggered by:
|
|
36
|
-
- issue.opened webhook
|
|
37
|
-
- cron scan over managed repos
|
|
38
|
-
- manual CLI: tsx src/cli.ts cliftonc/owner/repo#N
|
|
25
|
+
incomplete reports. One agent invocation, no PR.
|
|
39
26
|
|
|
40
27
|
phases:
|
|
41
28
|
- name: triage
|
|
42
29
|
label: Triage
|
|
43
30
|
skill: issue-triage
|
|
44
31
|
model: "{{models.triage}}"
|
|
45
|
-
# Postcondition: the triage skill must end with the TRIAGE_COMPLETE marker,
|
|
46
|
-
# emitted only after the work is actually done (see skills/issue-triage).
|
|
47
|
-
# An agent that bails — no github_* tools, repo inaccessible, "re-invoke me" —
|
|
48
|
-
# never prints it, so the phase fails instead of greening a silent no-op.
|
|
49
32
|
on_output:
|
|
50
33
|
requires_marker: "TRIAGE_COMPLETE"
|
|
@@ -1,17 +1,10 @@
|
|
|
1
1
|
kind: comment
|
|
2
2
|
name: pr-comment
|
|
3
|
-
# Runtime policy (issue #368) — answers on the PR; never pushes code. Full
|
|
4
|
-
# prose for each key is in the workflow schema
|
|
5
|
-
# (packages/workflow-engine/src/core/schema.ts).
|
|
6
3
|
git_access: issues-write
|
|
7
4
|
description: |
|
|
8
5
|
Answer a maintainer's question about an open PR with concrete, code-cited
|
|
9
|
-
evidence. The PR-side counterpart to `issue-comment
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
Triggered by:
|
|
13
|
-
- issue_comment.created webhook on a PR (when classifier returns a
|
|
14
|
-
non-build intent and prNumber is set)
|
|
6
|
+
evidence. The PR-side counterpart to `issue-comment`, separate because PR
|
|
7
|
+
questions need the diff and a higher file-read cap.
|
|
15
8
|
|
|
16
9
|
phases:
|
|
17
10
|
- name: respond
|
package/workflows/pr-fix.yaml
CHANGED
|
@@ -1,43 +1,20 @@
|
|
|
1
1
|
kind: pr-fix
|
|
2
2
|
name: pr-fix
|
|
3
|
-
# PR-scoped (09-state-machine.md §S1/§S4): this workflow runs against a pull
|
|
4
|
-
# request, so it crosses the PR-scoped dispatch gate — the run lock shared with
|
|
5
|
-
# every other PR-scoped workflow, the per-head-SHA dedup, escalation, and the
|
|
6
|
-
# resolved `PrState` snapshot on `context.prState`. A fork of this workflow that
|
|
7
|
-
# drops the key silently loses all four; `validateAssets` warns when a
|
|
8
|
-
# `routes.github.pr_*` target is missing it.
|
|
9
3
|
pr_scoped: true
|
|
10
|
-
# Runtime policy (issue #368) — pushes a fix to the PR's head branch, through
|
|
11
|
-
# `handlePrFix`. Shares the fix family's one workspace per PR
|
|
12
|
-
# (`${repo}-${N}-fix`). Full prose for each key is in the workflow schema
|
|
13
|
-
# (packages/workflow-engine/src/core/schema.ts).
|
|
14
4
|
git_access: repo-write
|
|
15
5
|
workspace: per-target-reuse
|
|
16
6
|
pr_fix_shaped: true
|
|
17
7
|
description: "Lightweight PR fix — no architect/reviewer, just fix and push"
|
|
18
8
|
trigger: pr-fix
|
|
19
|
-
# Single in-place task-list comment/message instead of a comment per phase.
|
|
20
9
|
status_checklist: true
|
|
21
10
|
|
|
22
11
|
phases:
|
|
23
|
-
# Diagnose before repairing: classify the failure against the pre-cloned
|
|
24
|
-
# workspace (cheap) BEFORE the install + test cycle (expensive), so a failure
|
|
25
|
-
# no amount of fixing can address costs one short call. See the `fixing` skill.
|
|
26
12
|
- name: diagnose
|
|
27
13
|
label: Diagnose the failure
|
|
28
14
|
prompt: prompts/diagnose-ci.md
|
|
29
15
|
skill: fixing
|
|
30
|
-
# Cheap by intent — it reads logs and reproduces a command, it doesn't write
|
|
31
|
-
# code. Unset in config/default.yaml, so this falls through to models.default
|
|
32
|
-
# until an operator pins a cheaper model for it.
|
|
33
16
|
model: "{{models.diagnose}}"
|
|
34
17
|
output_var: diagnosis
|
|
35
|
-
# The tag WITH its colon, which is what the parser looks for
|
|
36
|
-
# (`lastMarkerLine`). The engine enforces the postcondition as a plain
|
|
37
|
-
# substring, so the bare tag let an output that merely MENTIONS
|
|
38
|
-
# `DIAGNOSIS_COMPLETE` pass a gate it then parsed to nothing — a green phase,
|
|
39
|
-
# a null diagnosis, and an attempt counter that never advanced. Pinned to
|
|
40
|
-
# `DIAGNOSIS_MARKER_POSTCONDITION` in src/engine/fix-markers.ts by test.
|
|
41
18
|
on_output:
|
|
42
19
|
requires_marker: "DIAGNOSIS_COMPLETE:"
|
|
43
20
|
messages:
|
|
@@ -47,72 +24,15 @@ phases:
|
|
|
47
24
|
- name: fix
|
|
48
25
|
label: Fix
|
|
49
26
|
prompt: prompts/pr-fix.md
|
|
50
|
-
# `fixing` is primary (minimal repair + push discipline + the markers);
|
|
51
|
-
# `building` stays available for the install / gate mechanics.
|
|
52
27
|
skills: [fixing, building]
|
|
53
28
|
model: "{{models.pr-fix}}"
|
|
54
|
-
# The three stopping classes: there is nothing here for a fix phase to do,
|
|
55
|
-
# so it must not provision a sandbox and run a 900-second gate for one. A
|
|
56
|
-
# non-failing skip — the RUN still records `succeeded`, because correctly
|
|
57
|
-
# determining the PR can't be fixed here IS the job. One expression per
|
|
58
|
-
# class, so the list reads as the class list it is.
|
|
59
|
-
#
|
|
60
|
-
# Read off the PARSED class the marker harvest persisted
|
|
61
|
-
# (`scratch.fixMarkers.diagnosis.class`), not off the diagnose phase's whole
|
|
62
|
-
# output. Substring-matching the output was wrong three ways: prose like
|
|
63
|
-
# "this is not class=flaky, it's reproducible" skipped the fix; a replayed
|
|
64
|
-
# `{{priorAttempts}}` line from an earlier attempt matched too; and
|
|
65
|
-
# `phaseOutputs` is EMPTY across a resume boundary, so the guard failed open
|
|
66
|
-
# and ran the full sandbox + gate on a verdict that said not to. `scratch`
|
|
67
|
-
# is reloaded from the run row, so it survives resume.
|
|
68
|
-
#
|
|
69
|
-
# `class=flaky` is the one BOUNDED row: after `fix.maxFlakyDeferrals` (2)
|
|
70
|
-
# consecutive `flaky` verdicts on the same problem the harness drops this
|
|
71
|
-
# expression for that run, so the third one is attempted as `reproducible`
|
|
72
|
-
# (09-state-machine.md §S1 — three flaky reports running is an intermittent
|
|
73
|
-
# real failure, and an unbounded series of free full runs otherwise).
|
|
74
|
-
# `promoteFlakyDiagnosis` in src/workflows/simple.ts matches the expression
|
|
75
|
-
# below LITERALLY; the other two rows always apply.
|
|
76
29
|
skip_if:
|
|
77
30
|
- "scratch.fixMarkers.diagnosis.class == 'flaky'"
|
|
78
31
|
- "scratch.fixMarkers.diagnosis.class == 'infra-dependent'"
|
|
79
32
|
- "scratch.fixMarkers.diagnosis.class == 'upstream-broken'"
|
|
80
|
-
# Load-bearing, not cosmetic: `runUntilBash` defaults to
|
|
81
|
-
# `timeout_seconds ?? 30`, and thirty seconds kills any real test suite
|
|
82
|
-
# mid-run and reports a false red. READ from `fix.gateTimeoutSeconds` — the
|
|
83
|
-
# run's effective, repo-clamped config block — with the packaged value as
|
|
84
|
-
# the fallback for a context that carries no `fix:` at all (#256). The two
|
|
85
|
-
# no longer have to be kept in step by hand.
|
|
86
33
|
timeout_seconds: { from: fix.gateTimeoutSeconds, default: 900 }
|
|
87
|
-
# The tag WITH its colon — see the `diagnose` phase above.
|
|
88
34
|
on_output:
|
|
89
35
|
requires_marker: "CI_FIX_COMPLETE:"
|
|
90
|
-
# The within-run local gate loop (04-retry.md §4.5). The gate command isn't
|
|
91
|
-
# statically knowable — package manager from the lockfile, commands from the
|
|
92
|
-
# repo's CI workflow — so the `fixing` skill has the agent write it to
|
|
93
|
-
# `.git/lastlight-verify.sh` inside the checkout (under `.git/`, so no
|
|
94
|
-
# `git add -A` can ever commit it, and deleted at the start of every attempt
|
|
95
|
-
# so a superseded diagnosis can't gate this one). No script yet ⇒ an EXPLICIT non-zero exit: `gate=skipped`
|
|
96
|
-
# is treated as red and never authorises a push (09-state-machine.md §S1).
|
|
97
|
-
# `max_iterations` reads `fix.localIterations`, same as `timeout_seconds`
|
|
98
|
-
# above; `2` is the packaged fallback, not the operative value.
|
|
99
|
-
#
|
|
100
|
-
# Run the gate with `bash`, NOT `sh` — see the same loop in
|
|
101
|
-
# `dependabot-ci-fix.yaml` for the full story. Short version: `/bin/sh` is
|
|
102
|
-
# dash, the agent writes `set -euo pipefail`, dash rejects `-o pipefail` and
|
|
103
|
-
# exits 2 on line 2, and the gate was a constant red in milliseconds.
|
|
104
|
-
#
|
|
105
|
-
# `until:` short-circuits `until_bash` — again see `dependabot-ci-fix.yaml`
|
|
106
|
-
# for the full argument, since the two loops are one family and must not
|
|
107
|
-
# diverge. Short version: `outcome=pushed` means the commit is on the branch
|
|
108
|
-
# and GitHub's checks are now the better authority, so re-running a slower
|
|
109
|
-
# copy of them in a fresh container buys nothing and costs minutes. It fires
|
|
110
|
-
# on `pushed` only — `no-change` / `gave-up` pushed nothing, so no external
|
|
111
|
-
# check exists, the local gate is the only evidence there is, and its red
|
|
112
|
-
# verdict is what earns the agent the next iteration (short-circuiting those
|
|
113
|
-
# too would make `fix.localIterations` dead config). `tried=` is in the
|
|
114
|
-
# needle so a replayed `{{priorAttempts}}` line — which `renderAttemptLine`
|
|
115
|
-
# writes WITHOUT `tried=` — cannot match.
|
|
116
36
|
generic_loop:
|
|
117
37
|
max_iterations: { from: fix.localIterations, default: 2 }
|
|
118
38
|
until: "output.contains('outcome=pushed tried=')"
|