lastlight-core 0.40.1 → 0.40.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/admin/routes.d.ts +1 -1
- package/dist/admin/routes.js +9 -0
- package/dist/admin/routes.js.map +1 -1
- package/dist/engine/dispatcher.d.ts +1 -1
- package/dist/engine/dispatcher.js +14 -0
- package/dist/engine/dispatcher.js.map +1 -1
- package/dist/engine/github/github.d.ts +18 -9
- package/dist/engine/github/github.js +46 -12
- package/dist/engine/github/github.js.map +1 -1
- package/dist/engine/review-ledger.d.ts +7 -0
- package/dist/engine/review-ledger.js +3 -0
- package/dist/engine/review-ledger.js.map +1 -1
- package/dist/engine/supersede.d.ts +1 -1
- package/dist/engine/supersede.js +14 -0
- package/dist/engine/supersede.js.map +1 -1
- package/dist/state/db.d.ts +1 -0
- package/dist/state/db.js +1 -0
- package/dist/state/db.js.map +1 -1
- package/dist/state/schema/pg.d.ts +17 -0
- package/dist/state/schema/pg.js +1 -0
- package/dist/state/schema/pg.js.map +1 -1
- package/dist/state/schema/sqlite.d.ts +19 -0
- package/dist/state/schema/sqlite.js +5 -0
- package/dist/state/schema/sqlite.js.map +1 -1
- package/dist/state/workflow-run-store.d.ts +52 -2
- package/dist/state/workflow-run-store.js +93 -17
- package/dist/state/workflow-run-store.js.map +1 -1
- package/dist/workflows/handlers/post-review.js +10 -2
- package/dist/workflows/handlers/post-review.js.map +1 -1
- package/dist/workflows/resume.d.ts +1 -1
- package/dist/workflows/resume.js +24 -1
- package/dist/workflows/resume.js.map +1 -1
- package/dist/workflows/simple.d.ts +1 -1
- package/dist/workflows/simple.js +20 -0
- package/dist/workflows/simple.js.map +1 -1
- package/drizzle/pg/0003_needy_obadiah_stane.sql +1 -0
- package/drizzle/pg/meta/0003_snapshot.json +1900 -0
- package/drizzle/pg/meta/_journal.json +7 -0
- package/drizzle/sqlite/0004_adorable_puck.sql +1 -0
- package/drizzle/sqlite/meta/0004_snapshot.json +1732 -0
- package/drizzle/sqlite/meta/_journal.json +7 -0
- package/package.json +4 -4
- package/workflows/dependabot-ci-fix.yaml +4 -1
- package/workflows/prompts/dependabot-ci-fix.md +146 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lastlight-core",
|
|
3
|
-
"version": "0.40.
|
|
3
|
+
"version": "0.40.3",
|
|
4
4
|
"description": "GitHub repository maintenance agent — Agent SDK harness",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -75,9 +75,9 @@
|
|
|
75
75
|
"pino-pretty": "13.1.3",
|
|
76
76
|
"yaml": "^2.9.1",
|
|
77
77
|
"zod": "^4.6.5",
|
|
78
|
-
"agentic-pi": "0.8.
|
|
79
|
-
"lastlight-
|
|
80
|
-
"lastlight-
|
|
78
|
+
"agentic-pi": "0.8.2",
|
|
79
|
+
"lastlight-shared": "0.13.1",
|
|
80
|
+
"lastlight-workflow-engine": "0.11.0"
|
|
81
81
|
},
|
|
82
82
|
"devDependencies": {
|
|
83
83
|
"@electric-sql/pglite": "^0.5.8",
|
|
@@ -118,6 +118,9 @@ phases:
|
|
|
118
118
|
fresh_context: false
|
|
119
119
|
messages:
|
|
120
120
|
on_start: "On it — investigating the failing checks on PR #{{prNumber}}..."
|
|
121
|
-
|
|
121
|
+
# A bot-owned branch is never pushed to — the phase asks the bot to
|
|
122
|
+
# rebase/recreate (or hands off to a human) and closes on its no-op gate
|
|
123
|
+
# — so "Fix pushed" would be false there.
|
|
124
|
+
on_success: "{{#if botOwnedBranch}}**No fix pushed** — `{{branch}}` is owned by its dependency-update bot, so I asked the bot to update it (or flagged it for a human) instead.{{/if}}{{#if !botOwnedBranch}}**Fix pushed** to `{{branch}}`.{{/if}}"
|
|
122
125
|
on_failure: "**Couldn't auto-fix** the failing checks on PR #{{prNumber}} — leaving it for a human."
|
|
123
126
|
on_skipped_done: "**No fix attempted** — the diagnosis says this isn't fixable from here. See the verdict above."
|
|
@@ -59,6 +59,152 @@ publish a speculative fix.
|
|
|
59
59
|
{{/if}}
|
|
60
60
|
|
|
61
61
|
INSTRUCTIONS:
|
|
62
|
+
IF `{{branch}}` STARTS WITH `dependabot/` OR `renovate/` — STOP, READ THIS,
|
|
63
|
+
THEN SKIP STEPS 1-5 AND `github_publish` ENTIRELY.
|
|
64
|
+
|
|
65
|
+
The bot OWNS that head. The moment any non-bot commit lands on a
|
|
66
|
+
`dependabot/*` or `renovate/*` branch, the bot abandons the PR on its next
|
|
67
|
+
sync with a comment about the branch having been "edited by someone other
|
|
68
|
+
than the bot", force-pushes the head back to its own tip, and any reviewer
|
|
69
|
+
who saw your commit watches it disappear. `github_publish` itself hard-refuses
|
|
70
|
+
these branches for the same reason (its refusal error names the prefix AND
|
|
71
|
+
the right remediation for that bot family), so even by accident you cannot
|
|
72
|
+
push there — but the prompt is the real explanation, because the failure
|
|
73
|
+
modes the refusal protects against are exactly the ones that follow a
|
|
74
|
+
successful push on these branches.
|
|
75
|
+
|
|
76
|
+
→ Do NOT work around the `github_publish` refusal with `git push`: a
|
|
77
|
+
non-bot commit (unsigned too) would still block or be force-pushed
|
|
78
|
+
away regardless. Drive the bot by its own update primitive — that is
|
|
79
|
+
the entire fix for a bot-owned branch.
|
|
80
|
+
|
|
81
|
+
FIRST: write the no-op gate. `{{verifyScript}}` (the path step 3 would
|
|
82
|
+
have used) gets a single line: `exit 0`. Nothing on a bot-owned branch
|
|
83
|
+
needs verification from us — the fix is the comment below, not a code
|
|
84
|
+
change — but the harness's gate loop reads `until_bash` against this
|
|
85
|
+
script and a missing script is `gate=skipped` (RED), which would re-render
|
|
86
|
+
this same prompt and post the comment a second time. A green gate is the
|
|
87
|
+
structural way this loop closes after exactly ONE iteration.
|
|
88
|
+
|
|
89
|
+
The remediation DEPENDS on the bot family that owns the branch — read the
|
|
90
|
+
prefix and don't conflate them:
|
|
91
|
+
|
|
92
|
+
**`dependabot/` (Dependabot owns the branch).** Dependabot parses a
|
|
93
|
+
`@dependabot …` slash command in a PR comment. Post exactly ONE comment via
|
|
94
|
+
`github_add_issue_comment`, body is a bare command with NO prose around it
|
|
95
|
+
(prose makes Dependabot ignore the slash):
|
|
96
|
+
|
|
97
|
+
- `behind` (base moved past the PR's base) → `@dependabot rebase`. The
|
|
98
|
+
common case. Bot regenerates the lockfile against current `main` and
|
|
99
|
+
rewrites the PR head onto a fresh base SHA.
|
|
100
|
+
- `dirty` (merge conflict, almost always the lockfile) → `@dependabot
|
|
101
|
+
recreate`. A rebase cannot resolve a conflict that already exists on
|
|
102
|
+
the branch; recreate regenerates from scratch and the new head is
|
|
103
|
+
clean.
|
|
104
|
+
- `checks-failing` (genuine red on the head, no conflict) → `@dependabot
|
|
105
|
+
recreate`. A bump whose own lockfile doesn't match what the test
|
|
106
|
+
suite expects after `main` moved is exactly what recreate's fresh
|
|
107
|
+
re-lock fixes. If recreate still goes red on the new head, a
|
|
108
|
+
maintainer has to look and the `STOP / requires-human` path below
|
|
109
|
+
handles it.
|
|
110
|
+
- `blocked` → DO NOT post a rebase command (auto-merge has no
|
|
111
|
+
`behind`/`dirty` to clear). Use the `STOP / requires-human` path;
|
|
112
|
+
a bot-managed branch that needs a human review is not anything this
|
|
113
|
+
loop can settle.
|
|
114
|
+
|
|
115
|
+
**`renovate/` (Renovate owns the branch).** Renovate does NOT parse
|
|
116
|
+
`@dependabot` slash commands — and ignores them silently, so an
|
|
117
|
+
agent that posts one into a Renovate PR wastes the comment and leaves
|
|
118
|
+
the branch owned-but-unregenerated. Renovate's documented update
|
|
119
|
+
mechanism is the **`rebase` label** (default name, configurable via
|
|
120
|
+
Renovate's `rebaseLabel` option). Per Renovate's docs at
|
|
121
|
+
`https://docs.renovatebot.com/updating-rebasing/#manual-rebasing`
|
|
122
|
+
under "Manual rebasing", applying the label regenerates Renovate's
|
|
123
|
+
commit for the branch on its next sync, **even if the branch has been
|
|
124
|
+
modified**, and the label is the right call exactly for these three
|
|
125
|
+
situations — a branch behind base, a branch the user wants Renovate
|
|
126
|
+
to recreate from scratch, and a branch that was created with an
|
|
127
|
+
error (e.g. lockfile generation) the user wants Renovate to try again.
|
|
128
|
+
|
|
129
|
+
Drive Renovate with the same primitive the existing
|
|
130
|
+
`dependabot-pr-merge.md` uses on green-then-blocked Renovate PRs:
|
|
131
|
+
add the rebase label via `github_add_labels` and post a brief
|
|
132
|
+
comment via `github_add_issue_comment` naming the request. The
|
|
133
|
+
label itself is silent on Renovate's UI, so the comment IS the
|
|
134
|
+
visible signal — a maintainer sees the request, knows it's
|
|
135
|
+
expected, and notices if nothing happens on the bot's next sync.
|
|
136
|
+
|
|
137
|
+
`rebase` is Renovate's *default* rebase-trigger label
|
|
138
|
+
(`rebaseLabel`); a repo that sets a different value ignores the
|
|
139
|
+
literal `rebase` post — the agent must read the configured value
|
|
140
|
+
before posting it. Resolve it once, before the tool call:
|
|
141
|
+
|
|
142
|
+
```
|
|
143
|
+
REBASE_LABEL="$(
|
|
144
|
+
for f in renovate.json .github/renovate.json \
|
|
145
|
+
.renovaterc .renovaterc.json .github/.renovaterc.json; do
|
|
146
|
+
if [ -f "$f" ]; then
|
|
147
|
+
v=$(jq -r '.rebaseLabel // empty' "$f" 2>/dev/null || true)
|
|
148
|
+
if [ -n "$v" ]; then printf '%s' "$v"; exit 0; fi
|
|
149
|
+
fi
|
|
150
|
+
done
|
|
151
|
+
if [ -f package.json ]; then
|
|
152
|
+
v=$(jq -r '.renovate.rebaseLabel // empty' package.json 2>/dev/null || true)
|
|
153
|
+
if [ -n "$v" ]; then printf '%s' "$v"; exit 0; fi
|
|
154
|
+
fi
|
|
155
|
+
printf 'rebase'
|
|
156
|
+
)"
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
`github_add_labels` 422s on a label the repository doesn't have, so create
|
|
160
|
+
it first: `github_ensure_labels` with `{ owner: "{{owner}}", repo:
|
|
161
|
+
"{{repo}}", labels: [{ name: "$REBASE_LABEL", color: "0e8a16",
|
|
162
|
+
description: "Ask Renovate to rebase / regenerate this PR." }] }` (a
|
|
163
|
+
no-op when it already exists). Then call `github_add_labels` with
|
|
164
|
+
`{ owner: "{{owner}}", repo: "{{repo}}", issue_number: {{prNumber}},
|
|
165
|
+
labels: ["$REBASE_LABEL"] }`. JSON5 configs (`renovate.json5`,
|
|
166
|
+
`.renovaterc.json5`) are not parseable by `jq`; if the repo uses
|
|
167
|
+
one, default to `rebase` and call it out in the comment so a
|
|
168
|
+
maintainer notices the wiring isn't being read instead of guessing
|
|
169
|
+
at an override that may not exist. The label's documented reach
|
|
170
|
+
covers all three remediation cases for us:
|
|
171
|
+
- `behind` (base moved past the PR's base) → rebase label +
|
|
172
|
+
comment. Documented case 1: a branch behind base. Renovate
|
|
173
|
+
regenerates against current `main` on its next sync.
|
|
174
|
+
- `dirty` (lockfile conflict, almost always) → rebase label +
|
|
175
|
+
comment. Documented: Renovate auto-rebases conflicted PRs, and
|
|
176
|
+
the label forces that rebase immediately rather than waiting for
|
|
177
|
+
Renovate's natural schedule.
|
|
178
|
+
- `checks-failing` (genuine red on the head, no conflict) → rebase
|
|
179
|
+
label + comment. Documented case 3: a branch "created with an
|
|
180
|
+
error (e.g. lockfile generation)" that you want Renovate to try
|
|
181
|
+
again — a bump whose lockfile doesn't match the test suite
|
|
182
|
+
expectations for current `main` is exactly what a fresh
|
|
183
|
+
re-lock-and-regenerate fixes. If the recreated head still goes
|
|
184
|
+
red, that is a real code-side problem this loop cannot settle,
|
|
185
|
+
and the comment (plus the `requires-human` label below) tells
|
|
186
|
+
the maintainer so.
|
|
187
|
+
- `blocked` (a required human review is the only outstanding
|
|
188
|
+
obstacle) → STOP / requires-human. A required-review gate is
|
|
189
|
+
not something Renovate can clear from the PR side, and the
|
|
190
|
+
`rebase` label does nothing for it.
|
|
191
|
+
|
|
192
|
+
Then (for both families) EMIT `CI_FIX_COMPLETE: … outcome=gave-up` on its
|
|
193
|
+
own final line. The marker is the postcondition gate; the structural gate
|
|
194
|
+
that closes this iteration is the green `exit 0` you wrote at the top.
|
|
195
|
+
The next dispatch will see the bot's NEW head SHA (it is on a fresh SHA
|
|
196
|
+
after every successful rebase), with the appropriate check state.
|
|
197
|
+
|
|
198
|
+
A note on author vs branch: the gate above is the branch prefix, not the
|
|
199
|
+
author. A maintainer's hand-written patch on top of a `dependabot/*`
|
|
200
|
+
branch still has Dependabot as the lifecycle owner — bot force-pushes
|
|
201
|
+
away non-bot commits regardless of who made them — so the same rule
|
|
202
|
+
applies. The branch prefix is what makes the bot the head owner.
|
|
203
|
+
|
|
204
|
+
Below this block, **the rest of the instructions apply only to branches
|
|
205
|
+
that are NOT `dependabot/*` or `renovate/*`** (e.g. a manually-opened PR
|
|
206
|
+
with a dependency bump that ended up failing CI).
|
|
207
|
+
|
|
62
208
|
Work efficiently and stay focused — you are on a time budget, so spend it on the
|
|
63
209
|
change that lands this PR. Make the smallest fix that works, don't refactor or
|
|
64
210
|
chase failures unrelated to the dependency bump, and don't sink your budget into
|