lastlight-core 0.26.0 → 0.28.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 +302 -5
- package/dist/admin/docker.js.map +1 -1
- package/dist/admin/sessions.js.map +1 -1
- package/dist/admin/tail.js.map +1 -1
- package/dist/config/config.d.ts +18 -4
- package/dist/config/config.js +122 -9
- package/dist/config/config.js.map +1 -1
- package/dist/config/repo-config.js.map +1 -1
- package/dist/connectors/messaging/session-manager.js.map +1 -1
- package/dist/connectors/slack/connector.js.map +1 -1
- package/dist/cron/dependabot-discovery.js.map +1 -1
- package/dist/cron/review-discovery.js.map +1 -1
- package/dist/engine/agent-executor.d.ts +25 -1
- package/dist/engine/agent-executor.js +41 -1
- package/dist/engine/agent-executor.js.map +1 -1
- package/dist/engine/chat/chat-prompt.js.map +1 -1
- package/dist/engine/chat/chat-runner.js.map +1 -1
- package/dist/engine/dispatcher.js +17 -0
- package/dist/engine/dispatcher.js.map +1 -1
- package/dist/engine/event-shim.d.ts +18 -0
- package/dist/engine/event-shim.js +2 -0
- package/dist/engine/event-shim.js.map +1 -1
- package/dist/engine/executors/orchestrator.d.ts +92 -1
- package/dist/engine/executors/orchestrator.js +144 -46
- package/dist/engine/executors/orchestrator.js.map +1 -1
- package/dist/engine/executors/shared.js.map +1 -1
- package/dist/engine/fix-harvest.js.map +1 -1
- package/dist/engine/github/github.d.ts +59 -0
- package/dist/engine/github/github.js +72 -0
- package/dist/engine/github/github.js.map +1 -1
- package/dist/engine/github/installations.js.map +1 -1
- package/dist/engine/github/review-poster.d.ts +403 -9
- package/dist/engine/github/review-poster.js +619 -52
- package/dist/engine/github/review-poster.js.map +1 -1
- package/dist/engine/github/team-visibility.js.map +1 -1
- package/dist/engine/llm.js.map +1 -1
- package/dist/engine/pr-decisions.d.ts +85 -5
- package/dist/engine/pr-decisions.js +331 -5
- package/dist/engine/pr-decisions.js.map +1 -1
- package/dist/engine/pr-state.d.ts +82 -0
- package/dist/engine/pr-state.js +71 -1
- package/dist/engine/pr-state.js.map +1 -1
- package/dist/engine/review-spec.d.ts +264 -0
- package/dist/engine/review-spec.js +723 -0
- package/dist/engine/review-spec.js.map +1 -0
- package/dist/engine/router.js.map +1 -1
- package/dist/engine/screen/classifier.js.map +1 -1
- package/dist/engine/screen/screen.js.map +1 -1
- package/dist/evals-api.d.ts +3 -0
- package/dist/evals-api.js +20 -0
- package/dist/evals-api.js.map +1 -1
- package/dist/index.js +76 -11
- package/dist/index.js.map +1 -1
- package/dist/notify/digest-blocks.js.map +1 -1
- package/dist/notify/model.js.map +1 -1
- package/dist/notify/transports/github.js.map +1 -1
- package/dist/notify/transports/slack.js.map +1 -1
- package/dist/sandbox/artifact-backend.js.map +1 -1
- package/dist/sandbox/artifact-store.js.map +1 -1
- package/dist/sandbox/docker.d.ts +23 -4
- package/dist/sandbox/docker.js +1 -1
- package/dist/sandbox/docker.js.map +1 -1
- package/dist/sandbox/egress-allowlist.js.map +1 -1
- package/dist/sandbox/k8s/agent-context-registry.js.map +1 -1
- package/dist/sandbox/k8s/client.js.map +1 -1
- package/dist/sandbox/k8s/kubernetes-sandbox.js.map +1 -1
- package/dist/sandbox/k8s/resource-name.js.map +1 -1
- package/dist/sandbox/k8s/run-id.js.map +1 -1
- package/dist/sandbox/k8s/run-secrets.js.map +1 -1
- package/dist/sandbox/k8s/skill-bundle.js.map +1 -1
- package/dist/sandbox/k8s/workspace-provisioner.js +10 -2
- package/dist/sandbox/k8s/workspace-provisioner.js.map +1 -1
- package/dist/sandbox/sandbox.d.ts +20 -0
- package/dist/sandbox/sandbox.js +27 -6
- package/dist/sandbox/sandbox.js.map +1 -1
- package/dist/session-log.js.map +1 -1
- package/dist/state/approval-store.js.map +1 -1
- package/dist/state/build-assets.js.map +1 -1
- package/dist/state/cron-run-store.js.map +1 -1
- package/dist/state/data-migrate.d.ts +135 -0
- package/dist/state/data-migrate.js +309 -0
- package/dist/state/data-migrate.js.map +1 -0
- package/dist/state/db.d.ts +24 -3
- package/dist/state/db.js +41 -11
- package/dist/state/db.js.map +1 -1
- package/dist/state/execution-store.js.map +1 -1
- package/dist/state/feedback-store.js.map +1 -1
- package/dist/state/pg-client.d.ts +44 -0
- package/dist/state/pg-client.js +81 -0
- package/dist/state/pg-client.js.map +1 -0
- package/dist/state/schema/pg.d.ts +15 -15
- package/dist/state/schema/sqlite.d.ts +15 -15
- package/dist/state/state-cli.d.ts +8 -0
- package/dist/state/state-cli.js +247 -0
- package/dist/state/state-cli.js.map +1 -0
- package/dist/state/team-store.js.map +1 -1
- package/dist/state/user-store.js.map +1 -1
- package/dist/state/workflow-run-store.js.map +1 -1
- package/dist/telemetry/index.js.map +1 -1
- package/dist/workflows/handlers/fanout.d.ts +157 -0
- package/dist/workflows/handlers/fanout.js +663 -0
- package/dist/workflows/handlers/fanout.js.map +1 -0
- package/dist/workflows/handlers/post-review.d.ts +111 -10
- package/dist/workflows/handlers/post-review.js +531 -39
- package/dist/workflows/handlers/post-review.js.map +1 -1
- package/dist/workflows/runner.js +33 -0
- package/dist/workflows/runner.js.map +1 -1
- package/dist/workflows/simple.js.map +1 -1
- package/docker-compose.yml +50 -0
- package/package.json +22 -12
- package/sandbox.Dockerfile +54 -0
- package/skills/adjudicate-pass/SKILL.md +117 -0
- package/skills/code-review/SKILL.md +114 -15
- package/skills/pr-review/SKILL.md +113 -24
- package/skills/pr-review/references/findings-schema.md +38 -7
- package/skills/survey-pass/SKILL.md +148 -0
- package/workflows/pr-review.yaml +626 -0
- package/workflows/prompts/dependabot-pr-merge.md +22 -2
- package/workflows/prompts/review-adjudicate.md +340 -0
- package/workflows/prompts/review-falsify.md +167 -0
- package/workflows/prompts/review.md +80 -0
- package/workflows/prompts/survey-contract.md +121 -0
- package/workflows/prompts/survey-enforcement.md +137 -0
- package/workflows/prompts/survey-security.md +165 -0
- package/workflows/prompts/survey-spec.md +116 -0
- package/workflows/prompts/survey-state.md +151 -0
- package/workflows/prompts/survey-tests.md +99 -0
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: adjudicate-pass
|
|
3
|
+
description: The shared rules for the ADJUDICATE pass of a multi-pass PR review — the workspace layout, the severity vocabulary it ranks on, and the prior-review ledger plus the two APPROVE constraints it inherits as the only pass that owns the posted verdict. Use when turning a pile of hypotheses into one ranked, tiered review. Not for producing a review from a diff.
|
|
4
|
+
version: 1.0.0
|
|
5
|
+
tags: [review, adjudicate, multi-pass]
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Adjudicate pass
|
|
9
|
+
|
|
10
|
+
You are the **last pass of a multi-pass review**, and the only one that owns the
|
|
11
|
+
verdict a human will read. Your prompt carries the procedure — what to read, the
|
|
12
|
+
deletion rule, how to rank and tier, the output schema and the conservation gate.
|
|
13
|
+
This skill carries the three things that procedure assumes and does not state.
|
|
14
|
+
|
|
15
|
+
## What you are not
|
|
16
|
+
|
|
17
|
+
You are not reviewing a diff. Three procedures belong to a pass that *does*, and
|
|
18
|
+
none of them is yours:
|
|
19
|
+
|
|
20
|
+
- **Confirming the target.** The PR, the head SHA and the question of whether an
|
|
21
|
+
already-reviewed head deserved another look were all settled before you were
|
|
22
|
+
dispatched. Re-deciding any of them can only overturn a decision made with more
|
|
23
|
+
information than you have.
|
|
24
|
+
- **`skip`.** A pass reviewing a diff may write `{"skip": true}` and stop. You may
|
|
25
|
+
not. By the time you run, five survey families and an oracle have already been
|
|
26
|
+
paid for; skipping discards all of it and posts nothing.
|
|
27
|
+
- **Discovering defects.** You merge, rank, tier and demote claims *other passes
|
|
28
|
+
made*. You read code to check a claim's evidence — never to find a sixth thing.
|
|
29
|
+
A finding you author yourself carries no hypothesis id and answers to no
|
|
30
|
+
obligation, so nothing downstream can tell it from one that was verified.
|
|
31
|
+
|
|
32
|
+
## Workspace
|
|
33
|
+
|
|
34
|
+
The harness pre-cloned the PR's head ref and dropped you **inside the checkout** —
|
|
35
|
+
your cwd **is** the repo (`ls -la` shows `.git/` directly). Use `git` / `read` /
|
|
36
|
+
`grep` from here.
|
|
37
|
+
|
|
38
|
+
**Every `.lastlight/…` path in your prompt is relative to that cwd — use it
|
|
39
|
+
relative, never absolute.** The skill files you were handed are absolute paths
|
|
40
|
+
under `…/.lastlight-skills/`, and that directory is a **sibling of the checkout,
|
|
41
|
+
one level above you**. Joining a `.lastlight/…` path onto the directory your
|
|
42
|
+
skills came from lands outside the repo and reads nothing. Measured, not
|
|
43
|
+
hypothetical: it cost 23 of 120 survey branches their seeded obligations across
|
|
44
|
+
three runs.
|
|
45
|
+
|
|
46
|
+
**Read code from this local checkout, never the API.** Do not call
|
|
47
|
+
`github_get_pull_request_diff`, `github_list_pull_request_files` or
|
|
48
|
+
`github_get_file_contents` — the API patch is a large redundant payload that
|
|
49
|
+
re-bloats context every turn, and the diff is already staged on disk under
|
|
50
|
+
`.lastlight/pr-review/diff/`.
|
|
51
|
+
|
|
52
|
+
**The `github_*` tools are for API metadata only** — and unlike a survey pass you
|
|
53
|
+
genuinely need them, for the prior discussion below. Reviews and comments exist
|
|
54
|
+
nowhere on disk. You never submit the review yourself: you rewrite
|
|
55
|
+
`findings.json` and a deterministic step posts it.
|
|
56
|
+
|
|
57
|
+
## Severity vocabulary
|
|
58
|
+
|
|
59
|
+
Your prompt ranks on `severity` and spends the inline budget in that order, but
|
|
60
|
+
the tiers are defined here. Every finding you keep is one of exactly two:
|
|
61
|
+
|
|
62
|
+
- **Critical** — data loss, a breaking change, silent data-dropping, or a
|
|
63
|
+
security issue that crosses a trust boundary. Blocks merge.
|
|
64
|
+
- **Important** — missing tests, performance problems, type errors, avoidable
|
|
65
|
+
duplication, excessive complexity, compiler-silencing assertions. Should fix.
|
|
66
|
+
|
|
67
|
+
There is no third value. `Suggestion` and `Nit` are tiers a *reviewer* drops
|
|
68
|
+
before posting; a claim that thin reaches you as something to file at `internal`
|
|
69
|
+
tier, not as a severity.
|
|
70
|
+
|
|
71
|
+
**`Critical` needs a trust boundary, not a category** — your prompt carries that
|
|
72
|
+
predicate, the demotion rule and the measurement behind it. Apply it there. What
|
|
73
|
+
this section settles is only the vocabulary: an unrecognised severity (`High`,
|
|
74
|
+
`Major`, `Blocker`) ranks as `Important` by fallback and produces a review that
|
|
75
|
+
looks ordinary while ordering wrongly.
|
|
76
|
+
|
|
77
|
+
## The prior review is yours to reconcile
|
|
78
|
+
|
|
79
|
+
You own the `event` and the `summary`, so two constraints that belong to whoever
|
|
80
|
+
posts now belong to you. Establish the prior state first —
|
|
81
|
+
`github_list_pull_request_reviews`, `github_list_issue_comments`,
|
|
82
|
+
`github_list_pull_request_review_comments`:
|
|
83
|
+
|
|
84
|
+
- **Never `APPROVE` over an open human `CHANGES_REQUESTED`** — their latest review
|
|
85
|
+
on this PR, not dismissed and not replaced by a later approval from the same
|
|
86
|
+
person. Downgrade to `COMMENT`, and say which of their points the current diff
|
|
87
|
+
addresses and which it does not. A bot APPROVE stacked on an open human block
|
|
88
|
+
reads as an override of somebody who knows the codebase better than you.
|
|
89
|
+
- **A human APPROVE lowers the bar for blocking** — prefer `COMMENT` over
|
|
90
|
+
`REQUEST_CHANGES` on anything non-critical.
|
|
91
|
+
|
|
92
|
+
### If we have reviewed this PR before
|
|
93
|
+
|
|
94
|
+
You have whenever the reads above turn up a `last-light[bot]` review at an earlier
|
|
95
|
+
SHA. A re-review is **not** "what changed since last time"; it is a fresh verdict
|
|
96
|
+
on the whole current diff, with the prior findings as its starting point rather
|
|
97
|
+
than as settled history.
|
|
98
|
+
|
|
99
|
+
Every finding in that earlier review lands in exactly one of four buckets, and the
|
|
100
|
+
`summary` opens with that ledger, one line each:
|
|
101
|
+
|
|
102
|
+
- **Fixed** — you re-read the code at `path:line` *as it is now* and the problem is
|
|
103
|
+
genuinely gone. Not "the author replied that they fixed it", not "the thread is
|
|
104
|
+
resolved", not "a commit message says so". Re-read it.
|
|
105
|
+
- **Still open** — it reaches the review again. A finding that survives a round
|
|
106
|
+
trip is higher signal than anything new, not lower.
|
|
107
|
+
- **Pinned by a test** — the change added or edited a test asserting the *current,
|
|
108
|
+
wrong* behaviour. That is not a fix; it is the bug made permanent. The original
|
|
109
|
+
finding stands and the test is its own `Critical`/`Important` finding, quoting
|
|
110
|
+
the assertion.
|
|
111
|
+
- **Withdrawn** — it was wrong. Name what refuted it.
|
|
112
|
+
|
|
113
|
+
**Never `APPROVE` while one of our own prior findings is still open**, including
|
|
114
|
+
one the change only "fixed" by pinning it with a test.
|
|
115
|
+
|
|
116
|
+
A re-review whose summary is interchangeable with the first one had nothing to
|
|
117
|
+
say, and that ledger is what makes the second review worth its cost.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: code-review
|
|
3
|
-
description: The shared rubric for reviewing a code change — precision-first, high-signal findings only (Critical/Important),
|
|
4
|
-
version: 2.
|
|
3
|
+
description: The shared rubric for reviewing a code change — precision-first, high-signal findings only (Critical/Important), what to check (correctness, contracts between producer and consumer, security, edge cases, regression risk, test coverage), and what is NOT a finding (pre-existing issues, linter territory, aspirational conventions the repo does not follow). Use when reviewing a PR or a branch diff.
|
|
4
|
+
version: 2.4.0
|
|
5
5
|
tags: [review, code-quality]
|
|
6
6
|
---
|
|
7
7
|
|
|
@@ -21,25 +21,58 @@ not just the happy path.
|
|
|
21
21
|
|
|
22
22
|
A review is only useful if people trust it. A noisy reviewer gets muted; every
|
|
23
23
|
low-value comment you post spends the credibility of the ones that matter. So
|
|
24
|
-
the bar is **high-signal only
|
|
24
|
+
the bar is **high-signal only** — on what you **post**. Read "Where the gate
|
|
25
|
+
applies" below first: if your output is consumed by a later stage rather than by
|
|
26
|
+
a human, none of the filtering in this section is yours to do.
|
|
25
27
|
|
|
26
28
|
- **Post only Critical and Important findings.** Suggestions and Nits (below)
|
|
27
29
|
are *not* worth a formal review comment on their own — drop them, or fold at
|
|
28
|
-
most one genuinely valuable line into the summary. When in doubt
|
|
30
|
+
most one genuinely valuable line into the summary. When in doubt about a
|
|
31
|
+
finding's **tier**, leave it out of the review.
|
|
29
32
|
- **If you cannot name the concrete impact — what breaks, and for which input or
|
|
30
33
|
caller — do not post it.** "This could be cleaner" is not a finding; "this
|
|
31
34
|
crashes when `items` is empty because line 42 indexes `[0]`" is.
|
|
32
|
-
- **
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
35
|
+
- **One defect per comment, and distinct claims stay distinct.** Never fold a
|
|
36
|
+
second, independent defect into an "Additionally, …" sentence of the first —
|
|
37
|
+
two defects sharing a comment get read, answered and tracked as one, and one
|
|
38
|
+
of them is lost. Two comments may share a line. Keep each claim's precision
|
|
39
|
+
too: "out of date" is not "wrong", and collapsing distinct claims into the
|
|
40
|
+
harsher one overstates the review's case.
|
|
41
|
+
- **Confidence gate — refute, don't doubt, and only at the end.** Before you
|
|
42
|
+
finalise, re-read each finding against the actual code and try to *refute your
|
|
43
|
+
own claim*. Dropping it requires naming the specific thing that makes it
|
|
44
|
+
wrong: the guard you missed, the caller that already validates, the type that
|
|
45
|
+
makes the case unreachable. **Unease is not a refutation.** "I'm not certain"
|
|
46
|
+
is an instruction to go and read the other side of the contract, not to delete
|
|
47
|
+
the finding.
|
|
48
|
+
|
|
49
|
+
### Where the gate applies
|
|
50
|
+
|
|
51
|
+
The confidence gate filters what you **post**. It is not a filter on what you
|
|
52
|
+
are allowed to notice, to write down, or to hand to a later stage — and which of
|
|
53
|
+
those you are doing decides whether it fires at all.
|
|
54
|
+
|
|
55
|
+
- **You are producing the review** — writing `findings.json`, submitting a
|
|
56
|
+
formal review, or recording a verdict on a branch diff. **The gate fires.**
|
|
57
|
+
Everything in this section applies: yours is the last hand on the work before
|
|
58
|
+
a human reads it, so an ungrounded finding costs real credibility.
|
|
59
|
+
- **You are one pass of a multi-pass review** — discharging obligations and
|
|
60
|
+
appending hypotheses to a per-family file for a later phase to probe and
|
|
61
|
+
adjudicate. **The gate does not fire.** Record the mechanism you cannot yet
|
|
62
|
+
refute. Every downstream stage can only *remove*, so nothing there can recover
|
|
63
|
+
a hypothesis you declined to write down, and a pass that self-censors is
|
|
64
|
+
deleting evidence on behalf of a stage that has not run yet.
|
|
65
|
+
|
|
66
|
+
The split is measured, not stylistic. Google's AutoCommenter found a single
|
|
67
|
+
**global** confidence threshold (`t = 0.98`) catastrophic: roughly **80% of the
|
|
68
|
+
predictions it discarded as below-threshold were correct anyway**. Replacing it
|
|
69
|
+
with per-check thresholds raised recall without costing precision. So the gate
|
|
70
|
+
is worth having at the one point where a wrong finding is actually paid for, and
|
|
71
|
+
is expensive everywhere upstream of it.
|
|
39
72
|
|
|
40
73
|
### The gate cuts both ways
|
|
41
74
|
|
|
42
|
-
The gate
|
|
75
|
+
The confidence gate exists to stop *speculative* findings. It is not a reason to
|
|
43
76
|
approve a change you have not actually checked. Two failure modes, equally bad:
|
|
44
77
|
|
|
45
78
|
| Failure | What it looks like | Cost |
|
|
@@ -65,8 +98,22 @@ Severity decides how hard you must work to refute, not how sure you must feel:
|
|
|
65
98
|
Categorise every finding into exactly one tier. **Only Critical and Important
|
|
66
99
|
are posted** (see Precision first):
|
|
67
100
|
|
|
68
|
-
- **Critical** —
|
|
69
|
-
|
|
101
|
+
- **Critical** — data loss, breaking changes, silent data-dropping (see
|
|
102
|
+
Correctness below), or a security issue **that crosses a trust boundary**.
|
|
103
|
+
Blocks merge.
|
|
104
|
+
|
|
105
|
+
Membership in the security *category* is not sufficient, and this is the one
|
|
106
|
+
place the rubric says so. Name the boundary the input crosses **and** a
|
|
107
|
+
capability its supplier does not already have. A local CLI parsing a config
|
|
108
|
+
file the user themselves wrote is robustness, not a security boundary — the
|
|
109
|
+
supplier of the input already holds every capability the finding would grant,
|
|
110
|
+
so "a malicious file could do X" describes someone attacking themselves. If
|
|
111
|
+
you cannot name the boundary and the capability, it is **Important**.
|
|
112
|
+
|
|
113
|
+
This is not a bar on *raising* the finding; it is a bar on the tier. Severity
|
|
114
|
+
decides ordering, so it decides which findings occupy the few inline slots a
|
|
115
|
+
maintainer reads first — an inflated Critical spends that slot on a hazard
|
|
116
|
+
nobody can reach, and the real one drops below the fold.
|
|
70
117
|
- **Important** — missing tests, performance problems, type errors, **avoidable
|
|
71
118
|
duplication**, **excessive complexity**, **compiler-silencing assertions**.
|
|
72
119
|
Should fix.
|
|
@@ -104,7 +151,11 @@ what makes a comment actionable rather than a vague worry.
|
|
|
104
151
|
parse/validate/emit responsibilities; ask for helper extraction. This is an
|
|
105
152
|
**Important** finding, not a nit.
|
|
106
153
|
- **Duplication** — flag avoidable duplicated logic (two or more clone groups of
|
|
107
|
-
the same code/branching). DRY is **should-fix** here, not merely "nice to
|
|
154
|
+
the same code/branching). DRY is **should-fix** here, not merely "nice to
|
|
155
|
+
have." This is about *logic*: a repeated **literal** — a constant, a URL, a
|
|
156
|
+
storage key appearing in source and its test, or on both sides of a stack —
|
|
157
|
+
is a finding only when this change makes the copies diverge in behaviour
|
|
158
|
+
(see "Not findings").
|
|
108
159
|
- **Type safety** — flag `as any`, unchecked `as`-casts, or `@ts-ignore` used to
|
|
109
160
|
silence the compiler or to bypass a validator the same code path defines.
|
|
110
161
|
- **Regression risk** — existing callers of changed functions; behaviour changes
|
|
@@ -117,6 +168,54 @@ what makes a comment actionable rather than a vague worry.
|
|
|
117
168
|
Say so explicitly, quoting the assertion.
|
|
118
169
|
- **Fit** — does it match the codebase's existing patterns and conventions?
|
|
119
170
|
|
|
171
|
+
## Not findings
|
|
172
|
+
|
|
173
|
+
The list above is what *counts*. This is what does **not**, however real it may
|
|
174
|
+
be. It is a **category** rule, not a confidence bar: "I am not certain this is
|
|
175
|
+
enforced" is not on it. Read it with "Where the gate applies" — a survey pass is
|
|
176
|
+
still told to over-produce, and the only thing this removes from that output is
|
|
177
|
+
noise it was never supposed to produce, never a mechanism it could not refute.
|
|
178
|
+
|
|
179
|
+
- **Pre-existing issues.** The change is adjacent to them; it did not cause them.
|
|
180
|
+
- **Anything a linter, typechecker or compiler would catch.** They already run,
|
|
181
|
+
and they are right more often than you are. The exception is an assertion that
|
|
182
|
+
*silences* one — `as any`, `@ts-ignore` — which is by definition something the
|
|
183
|
+
compiler does not catch (see Type safety).
|
|
184
|
+
- **Real issues on lines this PR did not touch — unless this PR is what makes
|
|
185
|
+
them wrong.** A consumer the diff never opened, now reading a shape the diff
|
|
186
|
+
moved, IS a finding and is the highest-value one there is (see Contracts).
|
|
187
|
+
What is excluded is a defect that was already there and still is.
|
|
188
|
+
- **Changes that are clearly intentional and part of the broader change.** If
|
|
189
|
+
the diff is doing X on purpose, "this does X" is a restatement, not a finding.
|
|
190
|
+
- **Points already deliberately silenced in the code** — an explicit
|
|
191
|
+
suppression, an ignore directive, a comment saying why. Someone already
|
|
192
|
+
decided; re-raising it costs the review's credibility and settles nothing.
|
|
193
|
+
- **Conventions the reviewed repository does not actually follow.** **The
|
|
194
|
+
repository's conventions govern — not yours, and not the ones it aspires
|
|
195
|
+
to.** If the merged code does not follow a convention, that convention is
|
|
196
|
+
aspirational and departing from it is not a finding. Do not flag missing
|
|
197
|
+
optional or "encouraged" fields. Read the surrounding code and the neighbours
|
|
198
|
+
of the file you are reviewing; they are the standard, not the style guide.
|
|
199
|
+
- **A repeated literal the merged code already repeats.** "This value is
|
|
200
|
+
hardcoded in two places" — a source file and its test, a frontend and its
|
|
201
|
+
backend — is the aspirational-convention rule in its most common costume.
|
|
202
|
+
If the copies agree and this change does not make them observably diverge,
|
|
203
|
+
sharing the constant is a Suggestion, not a finding. The moment this change
|
|
204
|
+
DOES let the copies disagree in behaviour it becomes a real finding — but
|
|
205
|
+
then say what diverges and for whom, not that a future edit needs two
|
|
206
|
+
keystrokes.
|
|
207
|
+
- **"X is never validated" with no consumer that misbehaves.** A missing check
|
|
208
|
+
is a finding when some input or caller reaches code that then does the wrong
|
|
209
|
+
thing — name that path. Validation nobody's misbehaviour depends on is a
|
|
210
|
+
design note.
|
|
211
|
+
- **Description staleness — though a doc's claims are checkable.** A PR
|
|
212
|
+
description that under- or over-describes the change's scope is a note for
|
|
213
|
+
the summary, not a finding. But a doc line, comment or example that asserts
|
|
214
|
+
something checkable about the code's behaviour which is **false at head** IS
|
|
215
|
+
a finding — the next reader will act on it — and so is an example that
|
|
216
|
+
contradicts the same file's guidance. The test: does the sentence make a
|
|
217
|
+
claim the code can falsify? Then check it like code; otherwise it is prose.
|
|
218
|
+
|
|
120
219
|
## Calibration
|
|
121
220
|
|
|
122
221
|
- Don't nitpick generated files (lockfiles, compiled assets).
|
|
@@ -1,19 +1,40 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: pr-review
|
|
3
|
-
description: Review a GitHub pull request and post one formal review — advance the existing discussion and give precision-first, high-signal feedback.
|
|
4
|
-
version: 7.
|
|
3
|
+
description: Review a GitHub pull request and post one formal review — advance the existing discussion and give precision-first, high-signal feedback. Judgement on the diff, not a build gate — CI validates that it builds, and a targeted probe is allowed as evidence. Use when asked to review a PR or on a cron PR scan.
|
|
4
|
+
version: 7.4.0
|
|
5
5
|
tags: [github, review, code-quality]
|
|
6
6
|
chat: true
|
|
7
7
|
---
|
|
8
8
|
|
|
9
9
|
# PR Review
|
|
10
10
|
|
|
11
|
-
Review an open PR — high-signal findings only.
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
11
|
+
Review an open PR — high-signal findings only. Read the change and reason about
|
|
12
|
+
it; where reasoning cannot settle a question, **run something**. Installing the
|
|
13
|
+
repo's dependencies, opening the installed library source, and writing the
|
|
14
|
+
smallest file that exercises the behaviour and executing it are all **allowed
|
|
15
|
+
and expected** — that is a *probe*, and it is how a question about how code
|
|
16
|
+
actually behaves gets settled instead of guessed.
|
|
17
|
+
|
|
18
|
+
Two limits on a probe, and they are what keep it from becoming a second CI:
|
|
19
|
+
|
|
20
|
+
- **It must produce evidence you can quote.** Keep the command and its output,
|
|
21
|
+
and cite them in the finding that rests on them. "I ran it and it fails" with
|
|
22
|
+
nothing to quote is worth exactly what a guess is worth.
|
|
23
|
+
- **It is targeted at one question, never a re-derivation of CI.** Whether the
|
|
24
|
+
change builds and whether the suite is green are already answered — see §4.
|
|
25
|
+
Never spend a probe on those.
|
|
26
|
+
|
|
27
|
+
> **Why this is spelled out rather than left implicit.** An earlier version of
|
|
28
|
+
> this skill forbade installing dependencies, and the measured failure was not
|
|
29
|
+
> disobedience — it was the opposite. The reviewer referred to `WebClient` 32
|
|
30
|
+
> times and never once opened `node_modules/@slack`, because the workspace it
|
|
31
|
+
> was given had no `node_modules` at all. "Open the library source" was not
|
|
32
|
+
> ignored; it was structurally impossible. **An affordance you do not have reads
|
|
33
|
+
> to you as an instruction you cannot follow**, so what you *can* run is part of
|
|
34
|
+
> the contract, not an implementation detail.
|
|
35
|
+
|
|
36
|
+
Your job is judgement on the diff, not a build gate. A noisy review gets muted,
|
|
37
|
+
so precision matters more than volume.
|
|
17
38
|
|
|
18
39
|
You do **not** post the review yourself. You write your findings to a JSON file
|
|
19
40
|
(`.lastlight/pr-review/findings.json`) and a deterministic follow-up step posts
|
|
@@ -28,8 +49,17 @@ the precision bar and what-to-check rubric.
|
|
|
28
49
|
The harness pre-clones the PR's head ref and drops you **inside the checkout** —
|
|
29
50
|
your cwd **is** the repo (`ls -la` shows `.git/` directly; `AGENTS.md` is the
|
|
30
51
|
sibling one level up at `../`). Use `git`/`read`/`grep` from here. To refresh:
|
|
31
|
-
`git fetch origin <branch>
|
|
32
|
-
checkout is somehow missing,
|
|
52
|
+
`git fetch origin <branch> && git reset --hard FETCH_HEAD` — **no `--depth`**,
|
|
53
|
+
for the reason in §3. If the checkout is somehow missing,
|
|
54
|
+
`git clone https://github.com/{{owner}}/{{repo}}.git .`.
|
|
55
|
+
|
|
56
|
+
**Every `.lastlight/…` path in this skill and in any prompt is relative to that
|
|
57
|
+
cwd — use it relative, never absolute.** The skill files you were handed are
|
|
58
|
+
absolute paths under `…/.lastlight-skills/`, and that directory is a sibling of
|
|
59
|
+
the checkout, one level ABOVE you. Joining a `.lastlight/…` path onto the
|
|
60
|
+
directory your skills came from lands outside the repo and reads nothing. This
|
|
61
|
+
is measured, not hypothetical: it cost 23 of 120 survey branches their seeded
|
|
62
|
+
obligations across three runs on 2026-08-22.
|
|
33
63
|
|
|
34
64
|
**Read code from this local checkout, never the API.** Use `git`/`read`/`grep`
|
|
35
65
|
on disk for the diff and file contents. Do **not** call
|
|
@@ -51,8 +81,13 @@ listing dumps a large payload for nothing.
|
|
|
51
81
|
**Stop conditions** (check before reviewing):
|
|
52
82
|
- PR authored by `last-light[bot]` → skip. Never self-review.
|
|
53
83
|
- `merged === true` → stop. This skill reviews open PRs only.
|
|
54
|
-
|
|
55
|
-
|
|
84
|
+
A prior `last-light[bot]` review at the current head SHA is **not** a stop
|
|
85
|
+
condition. Whether an already-reviewed head deserves another look was decided
|
|
86
|
+
before you were dispatched, weighing the prior review against the trigger mode,
|
|
87
|
+
the changed paths, and whether a human asked directly — an explicit request
|
|
88
|
+
overrides de-duplication. If you are running, that question has already been
|
|
89
|
+
answered yes; re-deciding it here can only overturn it. Posting is idempotent
|
|
90
|
+
per head SHA regardless, so a genuine duplicate costs nothing.
|
|
56
91
|
|
|
57
92
|
### 2. Read the prior discussion
|
|
58
93
|
|
|
@@ -103,13 +138,49 @@ contains a problem you raised, the correct `event` is still
|
|
|
103
138
|
|
|
104
139
|
### 3. Get the diff
|
|
105
140
|
|
|
141
|
+
**First, check whether it is already staged.** When the review evidence pipeline
|
|
142
|
+
is on, the deterministic `facts` phase resolves this range once and writes it
|
|
143
|
+
down: `.lastlight/pr-review/diff/index.md` lists every changed file with its
|
|
144
|
+
status, its changed line ranges and a per-file patch beside it under
|
|
145
|
+
`.lastlight/pr-review/diff/`. If that index is there, read it and the patches
|
|
146
|
+
instead of running the commands below — the range is already settled, and every
|
|
147
|
+
re-derivation is another chance to spell it two-dot. Those paths are relative to
|
|
148
|
+
this checkout; open them exactly as written. (If the index says NOT AVAILABLE, or
|
|
149
|
+
there is no `.lastlight/pr-review/diff/` at all, carry on here.)
|
|
150
|
+
|
|
106
151
|
From inside `<repo>/`:
|
|
107
152
|
```
|
|
108
|
-
|
|
153
|
+
# The harness already materialized origin/<baseRef>, deepening base AND head
|
|
154
|
+
# until they share a merge base. Verify that — do NOT re-fetch with --depth.
|
|
155
|
+
# Repair only if it's actually missing: deepen BOTH sides, because unshallowing
|
|
156
|
+
# the base alone leaves HEAD with no reachable ancestor and merge-base still fails.
|
|
157
|
+
git merge-base origin/<baseRef> HEAD >/dev/null 2>&1 || {
|
|
158
|
+
git fetch origin --unshallow || true
|
|
159
|
+
git fetch origin "+refs/heads/<baseRef>:refs/remotes/origin/<baseRef>" --unshallow || true
|
|
160
|
+
}
|
|
161
|
+
|
|
109
162
|
git diff --stat origin/<baseRef>...HEAD # churn
|
|
110
163
|
git diff origin/<baseRef>...HEAD # the patch
|
|
111
164
|
```
|
|
112
165
|
|
|
166
|
+
**Never `git fetch --depth N` in this checkout.** A depth-limited fetch writes
|
|
167
|
+
`.git/shallow` even into an already-complete clone, re-cutting history N commits
|
|
168
|
+
back from the base tip — which severs the merge base on any PR that forked
|
|
169
|
+
further back than that, and undoes the deepening the harness already paid for.
|
|
170
|
+
|
|
171
|
+
**Three dots, always.** `origin/<baseRef>...HEAD` is the merge-base diff and
|
|
172
|
+
matches GitHub's own PR diff. Two-dot (`git diff origin/<baseRef> HEAD`)
|
|
173
|
+
additionally contains every commit the base branch picked up since the PR
|
|
174
|
+
forked, and the author wrote none of it — measured across 50 real PRs, 9
|
|
175
|
+
diverge, one of them 6125 files against 3.
|
|
176
|
+
|
|
177
|
+
**If `merge-base` still fails after the repair**, the diff range could not be
|
|
178
|
+
established and you have nothing to review. Do not quietly fall back to two-dot
|
|
179
|
+
and review that instead. Write `event: "COMMENT"` — never `APPROVE` — with
|
|
180
|
+
`findings: []` and a `summary` saying the base and head share no reachable
|
|
181
|
+
history, then stop. Reviewing the wrong range and reporting success is the exact
|
|
182
|
+
failure this instruction exists to prevent.
|
|
183
|
+
|
|
113
184
|
### 4. Read what CI said
|
|
114
185
|
|
|
115
186
|
Your Context block carries `checksState` — `passing` / `failing` / `pending` /
|
|
@@ -125,16 +196,21 @@ speculate about whether this builds.**
|
|
|
125
196
|
line 42, which is the same issue as finding 2"* — and let it steer you toward
|
|
126
197
|
the part of the diff that is actually wrong.
|
|
127
198
|
- `checksState: pending` / `none` — no CI evidence either way. Review the code
|
|
128
|
-
as written
|
|
199
|
+
as written, and do **not** stand in for CI by building it or running the
|
|
200
|
+
suite — a matrix you cannot reproduce on one machine is not yours to guess at.
|
|
201
|
+
A targeted probe for one specific question is still fair game.
|
|
129
202
|
|
|
130
203
|
### 5. Assess and write your findings
|
|
131
204
|
|
|
132
205
|
Apply the **code-review** skill's rubric — read each changed file in context;
|
|
133
206
|
check correctness / **contracts** / edge-cases / security / regression-risk /
|
|
134
207
|
test-coverage.
|
|
135
|
-
Reason about the code statically
|
|
136
|
-
gate and it has already spoken (§4)
|
|
137
|
-
|
|
208
|
+
Reason about the code statically first, and spend nothing re-deriving whether it
|
|
209
|
+
builds — CI is the build gate and it has already spoken (§4). When a finding
|
|
210
|
+
turns on how the code *behaves* rather than on how it reads — library or
|
|
211
|
+
framework semantics, a lifecycle, an option interaction, an input the code does
|
|
212
|
+
not expect — settle it with a probe (see the top of this skill) and quote the
|
|
213
|
+
transcript in the finding's body.
|
|
138
214
|
Follow that skill's **precision-first** rule: keep **only Critical and Important**
|
|
139
215
|
findings, each anchored to a `path:line` with a one-line concrete impact (what
|
|
140
216
|
breaks, for which input or caller). Drop Suggestions and Nits.
|
|
@@ -173,8 +249,8 @@ the shape is:
|
|
|
173
249
|
"findings": [
|
|
174
250
|
{
|
|
175
251
|
"path": "src/foo.ts",
|
|
252
|
+
"existingCode": "the verbatim line(s) this finding is about",
|
|
176
253
|
"line": 42,
|
|
177
|
-
"side": "RIGHT",
|
|
178
254
|
"severity": "Critical",
|
|
179
255
|
"title": "Short label for the finding",
|
|
180
256
|
"body": "Concrete impact — what breaks, for which input or caller.",
|
|
@@ -190,12 +266,25 @@ SHA and diff from the harness's own context and the checkout, so you do **not**
|
|
|
190
266
|
record any of that metadata (that reliance was a footgun — omit it).
|
|
191
267
|
|
|
192
268
|
Rules:
|
|
193
|
-
- **
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
269
|
+
- **Quote the code; do not count the lines.** `existingCode` is the anchor of
|
|
270
|
+
record: copy the line(s) the finding is about character-for-character and the
|
|
271
|
+
harness finds them for you — in the file's own hunks, then the whole file, then
|
|
272
|
+
(on a *unique* match) elsewhere in the diff, which is how a finding filed
|
|
273
|
+
against the wrong half of a declaration/implementation pair still lands. `line`
|
|
274
|
+
and `side` are **advisory hints** that get overwritten; `start_line` is derived,
|
|
275
|
+
so do not set it. `path` should still match the diff path. An excerpt that
|
|
276
|
+
cannot be found is demoted to the summary body — nothing is lost, but an inline
|
|
277
|
+
comment at the defect site is worth much more, so copy carefully rather than
|
|
278
|
+
paraphrasing.
|
|
279
|
+
- `severity` is `Critical` or `Important` only. **`Critical` needs a trust
|
|
280
|
+
boundary, not a category**: data loss, a breaking change, silent
|
|
281
|
+
data-dropping, or a security issue where you can name the boundary the input
|
|
282
|
+
crosses AND a capability its supplier does not already have. A local tool
|
|
283
|
+
parsing a file the invoking user wrote is robustness, not a boundary — the
|
|
284
|
+
supplier already holds every capability the finding would grant. Everything
|
|
285
|
+
else that is worth posting is `Important`. (Stated here rather than
|
|
286
|
+
cross-referenced: this skill is `chat: true` and is read in threads where
|
|
287
|
+
`code-review` is not staged. Same rule, same words — change both together.)
|
|
199
288
|
- `suggestion` is optional — include it only when a concrete one-to-few-line fix
|
|
200
289
|
is obvious. It must be the exact replacement text for the anchored line(s),
|
|
201
290
|
nothing else; GitHub renders it as an applyable suggestion.
|
|
@@ -4,7 +4,8 @@ The `pr-review` skill writes its findings to `.lastlight/pr-review/findings.json
|
|
|
4
4
|
(relative to the repo checkout — your cwd). The first-class `post-review` action
|
|
5
5
|
reads this file and posts **one** formal GitHub review:
|
|
6
6
|
|
|
7
|
-
- Each finding
|
|
7
|
+
- Each finding is anchored by matching its **`existingCode`** excerpt against the
|
|
8
|
+
diff. If the excerpt resolves to a line that appears in the PR diff, the finding
|
|
8
9
|
becomes an **inline comment** on that exact line.
|
|
9
10
|
- Any finding whose anchor isn't in the diff is **demoted** into the review body
|
|
10
11
|
under an "Additional findings" heading (GitHub rejects comments off the diff).
|
|
@@ -17,6 +18,12 @@ own run context and the checkout, so you do **not** record any of that metadata.
|
|
|
17
18
|
You never call `github_create_pull_request_review` yourself; writing this file is
|
|
18
19
|
how you submit.
|
|
19
20
|
|
|
21
|
+
> **Analysis mode writes a superset.** When the review evidence pipeline is on,
|
|
22
|
+
> the adjudicate phase owns this file and adds `tier` / `family` / `hypotheses` /
|
|
23
|
+
> `confidence` per finding and a `dropped[]` list. That contract lives in the
|
|
24
|
+
> adjudicate prompt (`workflows/prompts/review-adjudicate.md`); everything below
|
|
25
|
+
> is the shape both modes share.
|
|
26
|
+
|
|
20
27
|
## Top-level object
|
|
21
28
|
|
|
22
29
|
| Field | Type | Required | Meaning |
|
|
@@ -31,14 +38,38 @@ how you submit.
|
|
|
31
38
|
| Field | Type | Required | Meaning |
|
|
32
39
|
|---|---|---|---|
|
|
33
40
|
| `path` | string | yes | Repo-relative file path, matching the diff path exactly. |
|
|
34
|
-
| `
|
|
35
|
-
| `
|
|
36
|
-
| `
|
|
37
|
-
| `
|
|
41
|
+
| `existingCode` | string | **yes** | The **verbatim excerpt** the finding is about, copied character-for-character out of the code. This is the anchor of record — see below. |
|
|
42
|
+
| `line` | number | no | **Advisory.** A hint at where the excerpt is; the harness derives the real line and overwrites this. Wrong is survivable, absent is fine. |
|
|
43
|
+
| `side` | string | no | `RIGHT` (added/context line — default) or `LEFT` (removed/context line). Also derived. |
|
|
44
|
+
| `start_line` | number | no | Derived for you from a multi-line `existingCode`. Do not set it. |
|
|
45
|
+
| `severity` | string | yes | `Critical` or `Important` only. `Critical` needs a **trust boundary**, not a category: data loss, a breaking change, silent data-dropping, or a security issue where you can name the boundary the input crosses AND a capability its supplier does not already have. A tool parsing a file the invoking user wrote is robustness, not a boundary. Everything else worth posting is `Important`. Severity is what the poster ranks the inline budget on, so an inflated one spends a scarce slot. |
|
|
38
46
|
| `title` | string | yes | Short label for the finding. |
|
|
39
47
|
| `body` | string | yes | Concrete impact — what breaks, for which input or caller. |
|
|
40
48
|
| `suggestion` | string | no | Exact replacement text for the anchored line(s). Rendered as an applyable ```suggestion block. Include only when a concrete one-to-few-line fix is obvious. |
|
|
41
49
|
|
|
50
|
+
## Quote the code; do not count the lines
|
|
51
|
+
|
|
52
|
+
**`existingCode` is how a finding gets anchored, and it is the field to get
|
|
53
|
+
right.** Models quote code accurately and count lines badly, so the harness stops
|
|
54
|
+
asking you to count: it takes your excerpt and finds it, in this order — the
|
|
55
|
+
file's own diff hunks, then the whole head-side file, then (on a *unique* match)
|
|
56
|
+
any other file in the diff, which is how a finding you filed against the wrong
|
|
57
|
+
file of a declaration/implementation pair still lands correctly.
|
|
58
|
+
|
|
59
|
+
Two rules follow:
|
|
60
|
+
|
|
61
|
+
- **Copy, never paraphrase.** Leading and trailing whitespace is ignored, nothing
|
|
62
|
+
else is. A reconstructed-from-memory excerpt does not match and the finding is
|
|
63
|
+
demoted to the review body.
|
|
64
|
+
- **Quote enough to be unique, and no more.** One distinctive line is usually
|
|
65
|
+
right. An excerpt that appears in two files is ambiguous and the harness
|
|
66
|
+
declines to guess rather than anchoring you to the wrong one.
|
|
67
|
+
|
|
68
|
+
A finding whose excerpt cannot be found is still **posted**, in the review body.
|
|
69
|
+
Nothing is lost by an excerpt that fails to resolve — but an inline comment at
|
|
70
|
+
the defect site is worth substantially more than a body entry, so it is worth
|
|
71
|
+
copying carefully.
|
|
72
|
+
|
|
42
73
|
## Example — findings with an inline suggestion
|
|
43
74
|
|
|
44
75
|
```json
|
|
@@ -49,8 +80,8 @@ how you submit.
|
|
|
49
80
|
"findings": [
|
|
50
81
|
{
|
|
51
82
|
"path": "src/cli.ts",
|
|
83
|
+
"existingCode": "const host = cfg.host;",
|
|
52
84
|
"line": 42,
|
|
53
|
-
"side": "RIGHT",
|
|
54
85
|
"severity": "Critical",
|
|
55
86
|
"title": "Null deref when --config is omitted",
|
|
56
87
|
"body": "`cfg.host` is undefined when no config file is passed, so every default-path invocation throws before connecting.",
|
|
@@ -58,8 +89,8 @@ how you submit.
|
|
|
58
89
|
},
|
|
59
90
|
{
|
|
60
91
|
"path": "src/connect.ts",
|
|
92
|
+
"existingCode": " disconnect();",
|
|
61
93
|
"line": 88,
|
|
62
|
-
"side": "RIGHT",
|
|
63
94
|
"severity": "Important",
|
|
64
95
|
"title": "Missing await on disconnect()",
|
|
65
96
|
"body": "`disconnect()` returns a promise that's never awaited, so the socket can leak if the caller exits immediately after."
|