lastlight-core 0.23.5 → 0.23.6
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lastlight-core",
|
|
3
|
-
"version": "0.23.
|
|
3
|
+
"version": "0.23.6",
|
|
4
4
|
"description": "GitHub repository maintenance agent — Agent SDK harness",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -66,9 +66,9 @@
|
|
|
66
66
|
"octokit": "^5.0.5",
|
|
67
67
|
"yaml": "^2.8.3",
|
|
68
68
|
"zod": "^4.3.6",
|
|
69
|
-
"lastlight-shared": "0.3.
|
|
70
|
-
"
|
|
71
|
-
"
|
|
69
|
+
"lastlight-shared": "0.3.1",
|
|
70
|
+
"lastlight-workflow-engine": "0.3.1",
|
|
71
|
+
"agentic-pi": "0.4.1"
|
|
72
72
|
},
|
|
73
73
|
"devDependencies": {
|
|
74
74
|
"@types/better-sqlite3": "^7.6.0",
|
package/skills/fixing/SKILL.md
CHANGED
|
@@ -169,20 +169,92 @@ mechanical call-site/type update over a behavioural change. Don't refactor,
|
|
|
169
169
|
don't chase failures unrelated to the diagnosed cause, and don't sink your
|
|
170
170
|
budget into one slow or unreproducible check.
|
|
171
171
|
|
|
172
|
-
**Push only on a green local gate.** The gate is the
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
172
|
+
**Push only on a green local gate.** The gate is the targeted reproduction
|
|
173
|
+
below, written by you at runtime. If it is still red when you run out of
|
|
174
|
+
iterations, emit `outcome=gave-up` and **do not push a speculative fix** — an
|
|
175
|
+
unverified push costs a full CI cycle to prove nothing.
|
|
176
|
+
|
|
177
|
+
## The gate
|
|
178
|
+
|
|
179
|
+
**Write it to `.git/lastlight-verify.sh`** — a path relative to your cwd, which
|
|
180
|
+
is the checkout. The harness runs it after every fix iteration; exit 0 means
|
|
181
|
+
green and ends the loop.
|
|
182
|
+
|
|
183
|
+
It answers exactly one question: **is the thing I diagnosed actually fixed?**
|
|
184
|
+
That makes it a *targeted reproduction*, never a stand-in for CI. CI runs on the
|
|
185
|
+
commit you push — real OS, real services, the whole matrix — and it is the
|
|
186
|
+
authority on whether this PR is green. Duplicating it here buys no information
|
|
187
|
+
and costs the one thing you are short of: a ten-minute gate delays the push by
|
|
188
|
+
ten minutes, and CI has usually gone green before it finishes.
|
|
189
|
+
|
|
190
|
+
So write **the narrowest command that would have failed before your fix and
|
|
191
|
+
passes after it** — one test file, one lint rule, one build target, one install.
|
|
192
|
+
Dependencies are already installed by the time the gate runs (you installed
|
|
193
|
+
them, per the **building** skill), so it need not install again unless the
|
|
194
|
+
install *is* the check. **Aim for under two minutes.**
|
|
195
|
+
|
|
196
|
+
```bash
|
|
197
|
+
#!/usr/bin/env bash
|
|
198
|
+
set -euo pipefail
|
|
199
|
+
|
|
200
|
+
# diagnosed: test/foo-service.test.ts fails on the zod major bump
|
|
201
|
+
npx vitest run test/foo-service.test.ts
|
|
202
|
+
```
|
|
181
203
|
|
|
182
|
-
Four
|
|
204
|
+
Four things it must never contain:
|
|
205
|
+
|
|
206
|
+
- **The whole suite.** Full lint + full typecheck + every build target + every
|
|
207
|
+
test project is what CI is for, and CI will run it. A gate written that way
|
|
208
|
+
took **eleven minutes** to verify a regenerated lockfile — and CI went green
|
|
209
|
+
before it finished.
|
|
210
|
+
- **A check you already ran this session and watched pass.** You have the
|
|
211
|
+
result. The gate is not where you prove it twice.
|
|
212
|
+
- **Anything that starts a service** — `docker`, `docker compose`, a database, a
|
|
213
|
+
daemon. There is none in this sandbox, so those branches can never execute:
|
|
214
|
+
a `command -v docker` guard around them is dead code that emits "Skipping…"
|
|
215
|
+
noise and nothing else. A check that genuinely needs a service is
|
|
216
|
+
`infra-dependent` — name it in `unreproducible=` and let CI run it.
|
|
217
|
+
- **`cd` out of the checkout, or anything that mutates git state.** The harness
|
|
218
|
+
re-runs the script after you finish, so it has to be idempotent.
|
|
219
|
+
|
|
220
|
+
### When there is nothing to reproduce
|
|
221
|
+
|
|
222
|
+
A merge conflict is the case that matters: you resolved it by regenerating the
|
|
223
|
+
lockfile, no check was ever failing, and there is nothing to re-run. **Write a
|
|
224
|
+
gate anyway** — just not a CI clone. In order of preference:
|
|
225
|
+
|
|
226
|
+
1. **The coherence check the repair implies.** For a merge/lockfile resolution
|
|
227
|
+
that is: no conflict marker survived, and the lockfile installs — which is
|
|
228
|
+
precisely what a botched regeneration fails.
|
|
229
|
+
|
|
230
|
+
```bash
|
|
231
|
+
#!/usr/bin/env bash
|
|
232
|
+
set -euo pipefail
|
|
233
|
+
|
|
234
|
+
# merge conflict resolved by regenerating package-lock.json; nothing was
|
|
235
|
+
# failing, so the gate checks the repair is coherent — not that CI is green.
|
|
236
|
+
! git grep -lI '^<<<<<<< ' -- .
|
|
237
|
+
npm ci
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
2. **An honest empty gate** — a script that states in one line why there was
|
|
241
|
+
nothing to verify, and exits 0.
|
|
242
|
+
|
|
243
|
+
**What you must not do is leave it unwritten.** With no script the loop's gate
|
|
244
|
+
can never go green, so it spends its remaining iterations re-running the whole
|
|
245
|
+
fix phase against a repair that was already finished, ends on the phase's
|
|
246
|
+
failure message, and leaves you reporting `gate=skipped` — which counts as RED
|
|
247
|
+
and never authorises the push the repair needed. A correct conflict resolution would be
|
|
248
|
+
thrown away for want of two lines of bash. The script's contents are recorded on
|
|
249
|
+
the run and read by humans afterwards, so an empty gate is an inspectable claim
|
|
250
|
+
you are making in writing; a missing one is indistinguishable from a broken one.
|
|
251
|
+
That is also why an empty gate is never a way out of a check you could have run.
|
|
252
|
+
|
|
253
|
+
Four rules about the file:
|
|
183
254
|
|
|
184
255
|
- **Write it first, before you start repairing.** The harness runs it after each
|
|
185
|
-
fix iteration
|
|
256
|
+
fix iteration, and a repair with nothing to verify against is a guess. Writing
|
|
257
|
+
it first is also what forces you to say what "fixed" means before you start.
|
|
186
258
|
- **Make it a bash script.** The harness runs it with `bash`, so `set -euo
|
|
187
259
|
pipefail` and the rest of bash is available to you — but a script written for
|
|
188
260
|
another interpreter will not be run the way you intended, however correct its
|
|
@@ -162,8 +162,55 @@ phases:
|
|
|
162
162
|
# and the agent disagree about the same file; `bash` is a superset of the
|
|
163
163
|
# shell any gate script here targets, so it agrees with a `#!/bin/sh`,
|
|
164
164
|
# `#!/usr/bin/env bash`, or shebang-less script alike.
|
|
165
|
+
#
|
|
166
|
+
# `until:` is checked FIRST and short-circuits `until_bash` entirely
|
|
167
|
+
# (phase-executor.ts: `if (!conditionMet && loop.until_bash)`), so it is
|
|
168
|
+
# where "there is nothing left for the gate to gate" belongs. The one case
|
|
169
|
+
# that qualifies is `outcome=pushed`: the commit is already ON the branch,
|
|
170
|
+
# GitHub's checks started against it the moment it landed, and they are the
|
|
171
|
+
# strictly better authority — the real CI environment rather than a sandbox
|
|
172
|
+
# approximation of it, warm rather than a cold container, and running
|
|
173
|
+
# against every matrix leg we cannot reproduce here. Run `49c101aa` is the
|
|
174
|
+
# bill for not saying so: the agent pushed at 11:03:31 having already run
|
|
175
|
+
# the whole suite itself, GitHub went fully green at 11:06:25, and the
|
|
176
|
+
# harness spent 11:04:00–11:10:48 in a fresh container re-running the same
|
|
177
|
+
# suite a third time before agreeing. The gate's exit code could not have
|
|
178
|
+
# changed anything by then — all it decides is whether to spend ANOTHER
|
|
179
|
+
# agent iteration, and a pushed fix has nothing left to iterate on.
|
|
180
|
+
#
|
|
181
|
+
# It short-circuits on `pushed` ONLY. `no-change` / `gave-up` still pay for
|
|
182
|
+
# the gate, deliberately: nothing was pushed, so there is no new commit, no
|
|
183
|
+
# new check run and no external authority — the local gate is the only
|
|
184
|
+
# evidence that exists, and its RED verdict is precisely what earns the
|
|
185
|
+
# agent the next iteration. Short-circuiting all three outcomes would exit
|
|
186
|
+
# every loop at iteration 1 and quietly turn `fix.localIterations` into
|
|
187
|
+
# dead config.
|
|
188
|
+
#
|
|
189
|
+
# The needle carries `tried=` on purpose. `outcome=pushed` on its own also
|
|
190
|
+
# appears in a rendered `{{priorAttempts}}` journal line from an EARLIER
|
|
191
|
+
# attempt (`renderAttemptLine`: `… | outcome=pushed gate=green`), which this
|
|
192
|
+
# prompt replays — the same replayed-line false match that forced the
|
|
193
|
+
# `skip_if` rows above off `phaseOutputs` and onto the parsed `scratch`
|
|
194
|
+
# value. Inside a loop iteration `scratch` is not an option (the scheduler
|
|
195
|
+
# refreshes it per PHASE node, not per iteration, so it is stale here), but
|
|
196
|
+
# `renderAttemptLine` deliberately omits `tried=`, so `outcome=pushed tried=`
|
|
197
|
+
# matches a LIVE `CI_FIX_COMPLETE:` line and nothing else. A marker that
|
|
198
|
+
# reorders its fields simply fails to match and the gate runs exactly as
|
|
199
|
+
# before — the fallback is the old behaviour, which is the right way round.
|
|
200
|
+
#
|
|
201
|
+
# What this gives up, stated plainly: after a push the harness no longer has
|
|
202
|
+
# an independent check on the agent's self-reported `gate=green`. That reads
|
|
203
|
+
# like the `sh`-vs-`bash` bug above and is not the same thing, because the
|
|
204
|
+
# gate in this flow runs AFTER the push and therefore never gated it — the
|
|
205
|
+
# agent's self-report was already the only thing between a bad fix and the
|
|
206
|
+
# branch, on every run this workflow has ever done. What actually catches a
|
|
207
|
+
# bad fix is untouched: GitHub's checks go red, `pr.checks_failed`
|
|
208
|
+
# re-dispatches this family, and `fix.maxAttempts` / `fix.maxCostUsd` bound
|
|
209
|
+
# the retries. The `bash`-not-`sh` fix still matters for the UNPUSHED path,
|
|
210
|
+
# which is where the loop's iterations actually live.
|
|
165
211
|
generic_loop:
|
|
166
212
|
max_iterations: { from: fix.localIterations, default: 2 }
|
|
213
|
+
until: "output.contains('outcome=pushed tried=')"
|
|
167
214
|
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"
|
|
168
215
|
fresh_context: false
|
|
169
216
|
messages:
|
package/workflows/pr-fix.yaml
CHANGED
|
@@ -94,8 +94,21 @@ phases:
|
|
|
94
94
|
# `dependabot-ci-fix.yaml` for the full story. Short version: `/bin/sh` is
|
|
95
95
|
# dash, the agent writes `set -euo pipefail`, dash rejects `-o pipefail` and
|
|
96
96
|
# exits 2 on line 2, and the gate was a constant red in milliseconds.
|
|
97
|
+
#
|
|
98
|
+
# `until:` short-circuits `until_bash` — again see `dependabot-ci-fix.yaml`
|
|
99
|
+
# for the full argument, since the two loops are one family and must not
|
|
100
|
+
# diverge. Short version: `outcome=pushed` means the commit is on the branch
|
|
101
|
+
# and GitHub's checks are now the better authority, so re-running a slower
|
|
102
|
+
# copy of them in a fresh container buys nothing and costs minutes. It fires
|
|
103
|
+
# on `pushed` only — `no-change` / `gave-up` pushed nothing, so no external
|
|
104
|
+
# check exists, the local gate is the only evidence there is, and its red
|
|
105
|
+
# verdict is what earns the agent the next iteration (short-circuiting those
|
|
106
|
+
# too would make `fix.localIterations` dead config). `tried=` is in the
|
|
107
|
+
# needle so a replayed `{{priorAttempts}}` line — which `renderAttemptLine`
|
|
108
|
+
# writes WITHOUT `tried=` — cannot match.
|
|
97
109
|
generic_loop:
|
|
98
110
|
max_iterations: { from: fix.localIterations, default: 2 }
|
|
111
|
+
until: "output.contains('outcome=pushed tried=')"
|
|
99
112
|
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"
|
|
100
113
|
fresh_context: false
|
|
101
114
|
messages:
|
|
@@ -84,11 +84,13 @@ one slow or unreproducible check. Run tests cheaply per the **building** skill
|
|
|
84
84
|
above is `dirty` (conflict), `behind` or `blocked`. CI is not red; the PR
|
|
85
85
|
simply cannot merge. So completing the merge and pushing it is the whole
|
|
86
86
|
repair, and there was no failure to diagnose. Do not hunt for a broken test
|
|
87
|
-
to justify the run
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
87
|
+
to justify the run, and do not stand up a CI-sized gate for a lockfile.
|
|
88
|
+
Land the merge, let a small gate confirm the repair is coherent (no conflict
|
|
89
|
+
markers left, the lockfile installs), push, and report `outcome=pushed`. CI
|
|
90
|
+
is what tells you the branch is green, and it runs on the commit you push
|
|
91
|
+
without being asked. A `dirty` PR whose conflict you resolved is a SUCCESS
|
|
92
|
+
even if the only file you changed was the lockfile. If the gate then comes
|
|
93
|
+
back red, you have a real failure and step 2 onwards applies.
|
|
92
94
|
{{/if}}
|
|
93
95
|
2. {{#if phaseOutputs.diagnosis}}Work from the diagnosis above. It already names
|
|
94
96
|
the cause and which checks can't be reproduced here — don't re-derive either.
|
|
@@ -102,17 +104,26 @@ one slow or unreproducible check. Run tests cheaply per the **building** skill
|
|
|
102
104
|
- a breaking change in the new version needs call sites / types updated,
|
|
103
105
|
- a peer-dependency or engines constraint needs a matching bump.
|
|
104
106
|
3. Write the gate script: `{{verifyScript}}` — a path relative to your cwd,
|
|
105
|
-
which is the checkout — holding the
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
107
|
+
which is the checkout — holding the **narrowest** command that would have
|
|
108
|
+
failed before your fix and passes after it: one test file, one lint rule, one
|
|
109
|
+
build target, or, for a lockfile you regenerated, the install itself. Exit 0
|
|
110
|
+
means green. NOT the repo's CI pipeline: CI runs on the commit you push and
|
|
111
|
+
is the authority, so a gate that mirrors it delays the push and tells you
|
|
112
|
+
nothing new — aim for under two minutes, skip anything you already watched
|
|
113
|
+
pass this session, and never try to start docker or a database (there is
|
|
114
|
+
none here). If step 1's merge was the whole repair and nothing was ever
|
|
115
|
+
failing, gate on the repair being coherent — no conflict markers left, and
|
|
116
|
+
the lockfile installs — rather than leaving the script unwritten: a missing
|
|
117
|
+
script is `gate=skipped`, which counts as RED and would throw a correct
|
|
118
|
+
resolution away. The script is not there yet — the harness clears it at the
|
|
119
|
+
start of every attempt. Write it before you start repairing. See the
|
|
120
|
+
**fixing** skill's "The gate" for the full shape.
|
|
110
121
|
4. Make the **smallest** change that makes CI pass, per the **fixing** skill.
|
|
111
122
|
Prefer a lockfile regeneration or a mechanical call-site/type update over a
|
|
112
123
|
behavioural change. Do NOT widen the scope beyond making this update green.
|
|
113
|
-
5. Follow the **building** skill
|
|
114
|
-
|
|
115
|
-
|
|
124
|
+
5. Follow the **building** skill for the install: the repo's package manager,
|
|
125
|
+
taken from the lockfile. Then run your gate script and require it to pass
|
|
126
|
+
before you commit. Breadth is CI's job — don't also run the full suite here.
|
|
116
127
|
|
|
117
128
|
AFTER FIXING:
|
|
118
129
|
1. git add -A && git commit -m "fix(deps): make #{{prNumber}} mergeable"
|
|
@@ -48,14 +48,23 @@ INSTRUCTIONS:
|
|
|
48
48
|
the cause is. If reproducing contradicts the diagnosis, trust what you
|
|
49
49
|
observe — and say so in your summary.
|
|
50
50
|
2. Write the gate script FIRST: `{{verifyScript}}` — a path relative to your
|
|
51
|
-
cwd, which is the checkout — holding the
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
the
|
|
51
|
+
cwd, which is the checkout — holding the **narrowest** command that would
|
|
52
|
+
have failed before your fix and passes after it: one test file, one lint
|
|
53
|
+
rule, one build target, one install. Exit 0 means green. NOT the repo's CI
|
|
54
|
+
pipeline: CI runs on the commit you push and is the authority, so a gate that
|
|
55
|
+
mirrors it delays the push and tells you nothing new — aim for under two
|
|
56
|
+
minutes, skip anything you already watched pass this session, and never try
|
|
57
|
+
to start docker or a database (there is none here). If the diagnosed problem
|
|
58
|
+
has no reproducible check at all, gate on the repair being coherent rather
|
|
59
|
+
than leaving the script unwritten: a missing script is `gate=skipped`, which
|
|
60
|
+
counts as RED and never authorises a push. It is not there yet — the harness
|
|
61
|
+
clears it at the start of every attempt. See the **fixing** skill's "The
|
|
62
|
+
gate" for the full shape.
|
|
55
63
|
3. Read the relevant code and make the fix — per the **fixing** skill, the
|
|
56
64
|
smallest change that addresses the diagnosed cause. Don't widen the scope.
|
|
57
|
-
4. Follow the **building** skill
|
|
58
|
-
|
|
65
|
+
4. Follow the **building** skill for the install, then run your gate script and
|
|
66
|
+
require it to pass — do NOT commit until it does. Breadth is CI's job; don't
|
|
67
|
+
also run the full suite here
|
|
59
68
|
|
|
60
69
|
AFTER FIXING:
|
|
61
70
|
1. git add -A && git commit -m "fix: address feedback on PR #{{prNumber}}
|