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.
Files changed (44) hide show
  1. package/config/default.yaml +52 -0
  2. package/dist/config/config.js +12 -0
  3. package/dist/config/config.js.map +1 -1
  4. package/dist/engine/github/github.d.ts +25 -0
  5. package/dist/engine/github/github.js +50 -0
  6. package/dist/engine/github/github.js.map +1 -1
  7. package/dist/engine/pr-decisions.js +99 -0
  8. package/dist/engine/pr-decisions.js.map +1 -1
  9. package/dist/engine/pr-state.d.ts +18 -0
  10. package/dist/engine/pr-state.js +36 -7
  11. package/dist/engine/pr-state.js.map +1 -1
  12. package/dist/engine/review-triage.d.ts +98 -0
  13. package/dist/engine/review-triage.js +122 -0
  14. package/dist/engine/review-triage.js.map +1 -0
  15. package/dist/index.js +6 -0
  16. package/dist/index.js.map +1 -1
  17. package/dist/workflows/resume.js +3 -0
  18. package/dist/workflows/resume.js.map +1 -1
  19. package/dist/workflows/runner.d.ts +0 -6
  20. package/dist/workflows/runner.js +52 -0
  21. package/dist/workflows/runner.js.map +1 -1
  22. package/package.json +3 -3
  23. package/workflows/answer.yaml +4 -30
  24. package/workflows/build.yaml +0 -12
  25. package/workflows/cron-dependabot-ci-fix.yaml +3 -23
  26. package/workflows/cron-dependabot-merge.yaml +3 -18
  27. package/workflows/cron-digest.yaml +0 -7
  28. package/workflows/cron-review.yaml +10 -24
  29. package/workflows/demo.yaml +4 -31
  30. package/workflows/dependabot-ci-fix.yaml +57 -161
  31. package/workflows/dependabot-pr-merge.yaml +24 -72
  32. package/workflows/explore.yaml +4 -13
  33. package/workflows/issue-comment.yaml +2 -9
  34. package/workflows/issue-triage.yaml +1 -18
  35. package/workflows/pr-comment.yaml +2 -9
  36. package/workflows/pr-fix.yaml +0 -80
  37. package/workflows/pr-review.yaml +164 -478
  38. package/workflows/prompts/review-triage.md +86 -0
  39. package/workflows/prompts/review.md +47 -2
  40. package/workflows/qa-test.yaml +8 -41
  41. package/workflows/repo-health.yaml +1 -9
  42. package/workflows/security-feedback.yaml +7 -18
  43. package/workflows/security-review.yaml +4 -22
  44. package/workflows/verify.yaml +8 -38
@@ -1,18 +1,10 @@
1
1
  kind: review
2
2
  name: pr-review
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.
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`. A fork that drops the key loses all
6
+ # four.
9
7
  pr_scoped: true
10
- # Runtime policy (issue #368) — SUBMITS a formal review, which is its own
11
- # profile above issues-write. Reuses one warm workspace per PR across
12
- # re-reviews (issue #107), pinned to the PR's real head ref — the synthesized
13
- # branch name never matches it, so without the pin the review would silently
14
- # read the BASE branch. Full prose for each key is in the workflow schema
15
- # (packages/workflow-engine/src/core/schema.ts).
16
8
  git_access: review-write
17
9
  workspace: per-target-reuse
18
10
  prepopulate_pr_head_ref: true
@@ -31,71 +23,76 @@ chat:
31
23
  - review PRs on <repo>
32
24
  - check open PRs
33
25
  description: |
34
- Review a single GitHub pull request: read the diff, check for issues, and
35
- post structured feedback. Does not run a full build cycle and does not
36
- modify code.
37
-
38
- Triggered by:
39
- - pr.opened webhook
40
- - cron scan over managed repos
41
- - manual CLI: tsx src/cli.ts review owner/repo#N
26
+ Review a single pull request: read the diff, check for issues, and post one
27
+ formal review. Never modifies code.
42
28
 
43
29
  phases:
44
- # ── The evidence pipeline (WP3). INERT unless `review.analysis.enabled`. ────
30
+ # HOW MUCH REVIEW IS THIS PUSH OWED? (issue #378) — the new root, and the only
31
+ # phase that runs before the workspace is put to work.
45
32
  #
46
- # Every phase below carries `skip_if: "analysisEnabled != true"`, and that key
47
- # reaches the context ONLY from `specContext` in pr-decisions.ts, which returns
48
- # `{}` when the pipeline is off. `evalSkipIf` coerces an absent variable to
49
- # false, so `!= true` matches and the phase skips — the failure direction of a
50
- # typo anywhere in this block is "the analysis does not run", never "an
51
- # unmeasured pipeline runs on a deployment that did not ask for it".
33
+ # A RE-REVIEW only. On a first review there is nothing to compare against, so
34
+ # `reviewIsRereview != true` skips the phase and the full brief runs. Both
35
+ # guards use the BARE-BOOLEAN `!= true` form deliberately: that form runs an
36
+ # absent value through `coerceBool`, so a missing or misspelled context key
37
+ # matches the guard and the phase skips — leaving a full review. The
38
+ # quoted-string form has the opposite behaviour and must not be used here.
52
39
  #
53
- # Phases 1–3 spend NO MODEL. They are deterministic bash, and they are first
54
- # so the six surveys below all read one artifact.
40
+ # The phase ends with one `REVIEW_DEPTH: full|light` line, which
41
+ # `engine/review-triage.ts` harvests onto `scratch.reviewTriage` from the same
42
+ # `onPhaseEnd` hook the fix markers ride. On `light`, the seven phases below
43
+ # skip and `prompts/review.md` renders its single-pass arm. On `full`, on no
44
+ # marker, or on a failed phase, the dispatch-time seed stands and the run is
45
+ # exactly what it is today.
46
+ - name: triage
47
+ label: Triage · how much review is owed
48
+ prompt: prompts/review-triage.md
49
+ model: "{{models.review-triage}}"
50
+ skip_if:
51
+ - "triageEnabled != true"
52
+ - "reviewIsRereview != true"
53
+ timeout_seconds: { from: triageTimeoutSeconds, default: 300 }
54
+ # NO `on_output.requires_marker`, deliberately — see AC2 in
55
+ # `tests/workflows/pr-review-probes.test.ts`: nothing in this workflow may
56
+ # declare an `on_output` action, because a red run posts
57
+ # `messages.on_failure`, offers a Retry that cannot succeed, pollutes the
58
+ # cost stats and defeats the SHA dedup. A missing marker already means
59
+ # "full review" — the harvest leaves the dispatch-time seed standing — so
60
+ # failing the run over one would trade a free correct answer for a broken
61
+ # review.
62
+
63
+ # Everything from here up to `reconcile` is the evidence pipeline, and all of
64
+ # it is INERT unless `review.analysis.enabled` — each phase carries
65
+ # `skip_if: analysisEnabled != true`, and an absent variable reads as false,
66
+ # so a typo skips the analysis rather than running an unasked-for one.
67
+ # `prepare` and `falsify` need `review.analysis.probes` on top.
55
68
  #
56
- # `prepare` (WP4) carries its OWN gate — `probesEnabled`, projected only when
57
- # the operator set `review.analysis.probes` as well as `enabled`. A deployment
58
- # that turned on the pipeline but not probes runs WP3 exactly as before: this
59
- # phase skips and `facts` sees the bare pre-clone it has always seen.
69
+ # Each also carries the TIER guard, `scratch.reviewTriage.depth == 'light'`.
70
+ # Quoted `==` there, the mirror image of the bare-boolean form above: an
71
+ # absent value never matches, so the phase RUNS — again failing toward a full
72
+ # review. `review` and `post-review` carry no tier guard and always run.
60
73
  - name: prepare
61
74
  label: Prepare · probe environment
62
75
  type: bash
63
- # BOTH gates, and the second is not redundant. `specContext` only projects
64
- # `probesEnabled` when the pipeline is enabled too, so the pair can never
65
- # disagree in production — but this phase is the one that installs a pull
66
- # request author's dependency tree, and "it cannot happen because of how the
67
- # projection is written" is a weaker guarantee than "the phase refuses". An
68
- # install with no surveys to feed is pure cost either way.
76
+ # `all_done`, not `all_success`: `triage` skips on a first review and on
77
+ # every deployment that turned it off, and a skipped node is not
78
+ # `succeeded`. A triage phase that FAILED must not take the review with it
79
+ # — the run then owes a full review, which is what the un-replaced seed
80
+ # already says.
81
+ depends_on: [triage]
82
+ trigger_rule: all_done
69
83
  skip_if:
70
84
  - "analysisEnabled != true"
71
85
  - "probesEnabled != true"
72
- # The PHASE's ceiling, summed across the three steps in `specContext` —
73
- # NOT the install budget. A phase killed part-way through a coverage run
74
- # writes no env.json at all, which is the outcome this whole design exists
75
- # to prevent.
86
+ - "scratch.reviewTriage.depth == 'light'"
76
87
  timeout_seconds: { from: probePhaseTimeoutSeconds, default: 300 }
77
- # FIRST, and that ordering is measured rather than tidy. On a bare checkout
78
- # a tsconfig that `extends` a bare package specifier
79
- # (`@calcom/tsconfig/react-library.json`) does not resolve; tsgo reports a
80
- # config parsing error and EXCLUDES the project, the case drops to tier 2,
81
- # and `contracts` emits nothing. Across the 50-PR corpus that is tier-1
82
- # cases 21 -> 5 and contract deltas 73 -> 19, one cause, all 16 demoted
83
- # cases. So this phase is not an affordance for probes — it is a
84
- # precondition for two of the six obligation families, and it has to run
85
- # before `facts` for either of them to see anything.
86
- #
87
- # The same shell-level catch as `facts` below, for the same §D12 reason: a
88
- # phase that dies without writing its artifact is re-dispatched by
89
- # cron-review.yaml every thirty minutes, forever.
90
88
  command: |
91
89
  set -u
92
90
  FACTS="${LASTLIGHT_FACTS_BIN:-$(command -v lastlight-facts || echo /opt/lastlight/bin/lastlight-facts)}"
93
91
  OUT=.lastlight/pr-review/probes/env.json
94
92
  mkdir -p .lastlight/pr-review/probes
95
93
 
96
- # `installed` is read off the FILESYSTEM even in the fallback, because it
97
- # is the only question a later phase asks and a dead process still leaves
98
- # whatever it managed to unpack.
94
+ # `installed` is read off the filesystem even here: a dead process still
95
+ # leaves whatever it unpacked, and that is the only question asked later.
99
96
  fallback() {
100
97
  if [ -d node_modules ]; then INSTALLED=true; else INSTALLED=false; fi
101
98
  printf '{"version":1,"generatedAt":"%s","repo":"{{owner}}/{{repo}}","packageManager":null,"install":"failed","installed":%s,"lifecycleScripts":false,"typecheck":"failed","typecheckDiagnostics":[],"coverage":"failed","coverageReport":null,"durationMs":{"install":0,"typecheck":0,"coverage":0,"total":0},"degraded":[{"extractor":"prepare","reason":"%s"}]}\n' \
@@ -103,9 +100,7 @@ phases:
103
100
  }
104
101
 
105
102
  ARGS="--repo . --out $OUT"
106
- # Each sub-switch is projected as the literal string "true"/"false" and
107
- # absent means OFF, so the failure direction of every one of them is "do
108
- # the cheap thing" rather than "install a stranger's postinstall".
103
+ # Each switch arrives as the literal "true"/"false"; absent means off.
109
104
  [ "{{probeLifecycleScripts}}" = "true" ] && ARGS="$ARGS --lifecycle-scripts"
110
105
  [ "{{probeTypecheck}}" = "true" ] && ARGS="$ARGS --typecheck"
111
106
  [ "{{probeCoverage}}" = "true" ] && ARGS="$ARGS --coverage"
@@ -118,74 +113,47 @@ phases:
118
113
  - name: facts
119
114
  label: Facts · deterministic
120
115
  type: bash
121
- skip_if: "analysisEnabled != true"
122
- # `all_done`, not the default `all_success`: `prepare` SKIPS on every
123
- # deployment that has not enabled probes, and a skipped node is not
124
- # `succeeded`. With `all_success` here the entire pipeline below would
125
- # vanish the moment WP4 shipped off.
116
+ skip_if:
117
+ - "analysisEnabled != true"
118
+ - "scratch.reviewTriage.depth == 'light'"
119
+ # `all_done`, not `all_success`: `prepare` SKIPS wherever probes are off,
120
+ # and a skipped node is not `succeeded`.
126
121
  depends_on: [prepare]
127
122
  trigger_rule: all_done
128
123
  timeout_seconds: 300
129
- # §D12, and the reason it is a shell-level `||` rather than trust in
130
- # `--never-fail`: that flag is an in-process try/catch and cannot cover a
131
- # process that DIES. An OOM, a segfault in the ast-grep native binary, or a
132
- # tsgo executable that cannot exec all exit without writing an envelope —
133
- # and a phase that fails hard is re-dispatched by cron-review.yaml every
134
- # thirty minutes, forever. So the catch writes a `coverage: "none"` envelope
135
- # itself and exits 0. The survey phases then say "nothing was analysed"
136
- # instead of reading silence as "nothing was found".
137
- #
138
- # FACTS resolution is §D1's order — LASTLIGHT_FACTS_BIN, then PATH, then the
139
- # image path. Expressed here in shell rather than reimplemented in core,
140
- # which has no edge to code-facts and must not grow one for this.
141
124
  command: |
142
125
  set -u
143
126
  FACTS="${LASTLIGHT_FACTS_BIN:-$(command -v lastlight-facts || echo /opt/lastlight/bin/lastlight-facts)}"
144
127
  OUT=.lastlight/pr-review/facts.json
145
128
  mkdir -p .lastlight/pr-review
146
129
 
147
- # The fallback envelope must VALIDATE, or the loudness is lost twice over:
148
- # `seed` parses this file against AllDocumentSchema and exits UNAVAILABLE
149
- # on a malformed one, which would leave no obligations AND no block saying
150
- # why. A complete `coverage: "none"` document is what makes the survey
151
- # phases print "nothing was analysed" instead of reading silence as clean.
130
+ # The fallback envelope must VALIDATE — `seed` rejects a malformed one —
131
+ # so that a failure reads downstream as "nothing was analysed" rather
132
+ # than as "nothing was found".
152
133
  fallback() {
153
134
  printf '{"version":2,"generatedAt":"%s","extractor":"all","repo":"{{owner}}/{{repo}}","baseSha":"%s","headSha":"%s","tier":3,"engine":"none","languages":[],"coverage":"none","degraded":[{"extractor":"facts","reason":"%s"}],"toolchain":{"manifest":2,"bundled":{},"binaries":{}},"extractors":{}}\n' \
154
135
  "$(date -u +%Y-%m-%dT%H:%M:%S.000Z)" "${BASE:-unknown}" "$(git rev-parse HEAD 2>/dev/null || echo unknown)" "$1" > "$OUT"
155
136
  }
156
137
 
157
- # Resolve the MERGE BASE, never the base branch tip. Two-dot additionally
158
- # contains every commit that landed on the base branch since the PR forked,
159
- # and the author wrote none of it — measured across 50 real PRs, 9 diverge,
160
- # one of them 6125 files against 3. A base we cannot resolve is a loud
161
- # failure, NOT a silent fallback to HEAD~1: analysing the wrong range and
162
- # reporting success is the exact shape this pipeline exists to stop.
138
+ # The MERGE BASE, never the base branch tip — a two-dot range attributes
139
+ # every commit that landed on the base since the fork to this author. An
140
+ # unresolvable base writes the fallback envelope; it never guesses.
163
141
  if ! BASE="$(git merge-base origin/{{baseBranch}} HEAD 2>/dev/null)" || [ -z "$BASE" ]; then
164
142
  fallback "no merge base between origin/{{baseBranch}} and HEAD (unrelated histories, or a clone too shallow to share one) — the diff range could not be established, so NOTHING here may be read as 'no findings'"
165
143
  echo "facts: no merge base — wrote a coverage:none envelope"
166
144
  exit 0
167
145
  fi
168
146
 
169
- # §D12, and the reason this is a shell-level catch rather than trust in
170
- # `--never-fail`: that flag is an in-process try/catch and cannot cover a
171
- # process that DIES.
172
- #
173
- # `--stage-diff` is the f1 lever, and it is HERE rather than in a phase of
174
- # its own because this is where the range already exists: the merge base
175
- # above is resolved once and `all` writes the patch down beside the facts
176
- # it derived from the same commit pair. Measured: the five survey branches
177
- # make ~93 bash calls per case and ~30 of them re-derive this one fixed
178
- # range — surveys are ~75% of a case's spend — and every re-derivation is
179
- # another chance to spell it two-dot, which attributes 6125 files to an
180
- # author who wrote 3. Staging cannot fail the run: a failure is a
181
- # `degraded[]` entry plus an index.md that says so in words.
147
+ # The shell-level catch covers what `--never-fail` cannot: a process that
148
+ # DIES (OOM, a segfault in the native parser). `--stage-diff` writes the
149
+ # per-file patches here, where the merge base is already resolved, so no
150
+ # survey branch has to derive the range again.
182
151
  if ! "$FACTS" all --repo . --base "$BASE" --head HEAD --out "$OUT" --stage-diff --never-fail; then
183
152
  fallback "the analysis process died without writing an envelope (OOM, a segfault in the native parser, or a compiler binary that cannot exec) — NOTHING here may be read as 'no findings'"
184
153
  fi
185
154
  echo "facts: $(wc -c < "$OUT" 2>/dev/null || echo 0) bytes, base $BASE"
186
- # The staged diff gets its own line for the same reason the seed phase
187
- # prints a per-family block manifest: "the layer staged nothing" and "the
188
- # branches never found it" must be two lines in the log, not one silence.
155
+ # Logged separately so "nothing was staged" and "the branches never found
156
+ # it" are two lines rather than one silence.
189
157
  if [ -s .lastlight/pr-review/diff/index.md ]; then
190
158
  echo "facts: staged $(ls .lastlight/pr-review/diff/*.patch 2>/dev/null | wc -l) per-file patch(es) under .lastlight/pr-review/diff/"
191
159
  else
@@ -195,34 +163,20 @@ phases:
195
163
  - name: seed
196
164
  label: Seed · obligations
197
165
  type: bash
198
- skip_if: "analysisEnabled != true"
166
+ skip_if:
167
+ - "analysisEnabled != true"
168
+ - "scratch.reviewTriage.depth == 'light'"
199
169
  depends_on: [facts]
200
170
  trigger_rule: all_done
201
171
  timeout_seconds: 120
202
- # One obligations.json plus one rendered BLOCK per family. The blocks carry
203
- # their own discharge contract — emitted from code, never from a template —
204
- # for the reason renderSpecObligations does: v3 measured a 17-row ledger
205
- # honestly discharged into ZERO findings, and obligations without the
206
- # contract reproduce exactly that.
207
- #
208
- # `--contract` is the CONTROL for 2026-08-23 (review.analysis.obligationContract,
209
- # `full` | `minimal`; see config/default.yaml for the measurement). It is
210
- # read into a variable and defaulted in the shell rather than interpolated
211
- # straight into the argument list, because renderTemplate substitutes an
212
- # ABSENT context key with the empty string — and `--contract --out` would
213
- # then swallow the next flag. The key is projected unconditionally beside
214
- # `analysisEnabled`, which this phase is already gated on, so the default is
215
- # a belt to that brace. The sixth family (`spec`) gets the same setting
216
- # in-process from `specContext`, so all six axes move together.
217
172
  command: |
218
173
  set -u
219
174
  FACTS="${LASTLIGHT_FACTS_BIN:-$(command -v lastlight-facts || echo /opt/lastlight/bin/lastlight-facts)}"
220
175
  CONTRACT="{{obligationContract}}"
221
176
  MAX_OBLIGATIONS="{{maxObligations}}"
222
- # The D2 minting arms (review.analysis.mint) — same shell-variable rule
223
- # as CONTRACT above: never interpolate {{key}} straight into the arg
224
- # list. Appended as `--mint "$MINT"` ONLY when non-empty, because the
225
- # CLI refuses an empty --mint value; absent flag = the baseline arm.
177
+ # Read into a variable, never interpolated straight into the arg list: an
178
+ # absent {{key}} renders EMPTY and would swallow the following flag.
179
+ # Passed only when non-empty — the CLI refuses an empty --mint.
226
180
  MINT="{{mint}}"
227
181
  mkdir -p .lastlight/pr-review/hypotheses
228
182
  set -- seed --facts .lastlight/pr-review/facts.json \
@@ -235,14 +189,10 @@ phases:
235
189
  echo "seed: contract ${CONTRACT:-minimal} backstop ${MAX_OBLIGATIONS:-48} mint ${MINT:-none}"
236
190
  echo "seed: $(ls .lastlight/pr-review/obligations 2>/dev/null | wc -l) family block(s)"
237
191
 
238
- # The MANIFEST, and it exists so that "the seeder wrote nothing for this
239
- # family" and "the block never reached the pass that consumes it" are two
240
- # different lines in the log rather than one silence. `renderFamilyBlock`
241
- # always emits a block for all five seedable families — including a NOT
242
- # MEASURED one — so a MISSING line here is a seeder failure, full stop, and
243
- # a survey branch reporting a family clean on the back of one is reporting
244
- # on a measurement that was never taken. The `spec` family is absent by
245
- # design: it is built harness-side and has no block on disk.
192
+ # A block is always emitted for all five seedable families, even a NOT
193
+ # MEASURED one, so a MISSING line here is a seeder failure — and a survey
194
+ # that then reports the family clean is reporting on no measurement at
195
+ # all. `spec` is absent by design: it is built harness-side.
246
196
  for FAMILY in contract enforcement security state tests; do
247
197
  BLOCK=".lastlight/pr-review/obligations/$FAMILY.md"
248
198
  if [ -s "$BLOCK" ]; then
@@ -253,160 +203,41 @@ phases:
253
203
  done
254
204
  exit 0
255
205
 
256
- # ── The six surveys. ONE phase, six branches, run CONCURRENTLY. ────────────
206
+ # The six survey families, run CONCURRENTLY as one node: six agent sessions
207
+ # in one provisioned workspace, one `executions` row each, so per-family
208
+ # cost, resume and the dashboard column all survive. The families are
209
+ # pairwise disjoint — each appends to its own `hypotheses/<family>.jsonl` —
210
+ # so there is no ordering between them.
257
211
  #
258
- # NOT a `generic_loop` over a `families` list, and the reason is measured:
259
- # `until_bash` rejects template markers and the only env a phase receives is
260
- # `LL_OUT_<PHASE>`, so `$LL_FAMILY` was never set, the gate tested
261
- # `hypotheses/.jsonl`, always failed, and the loop ran to `max_iterations`
262
- # against a gate that meant nothing — the dependency-cruiser failure shape.
263
- # Worse, `surveyPasses` defaulted to 3 against six families and nothing
264
- # recorded which three ran.
265
- #
266
- # WP11c — this WAS six chained phases, and chained is what made the review
267
- # unshippable. Measured on `prreview__skillspro-1587-r1`: the six surveys are
268
- # 851s of a 29-minute case, 49% of the wall clock, and they were sequential
269
- # only because the scheduler runs one DAG node at a time
270
- # (`packages/workflow-engine/src/core/scheduler.ts` — `const node = ready[0]`).
271
- # The families are pairwise disjoint by construction (six append-only
272
- # `hypotheses/<family>.jsonl`, no pass opening another's), so there was never
273
- # an ordering constraint to respect — only an engine that could not express
274
- # the absence of one.
275
- #
276
- # `type: fanout` is ONE node running the six sessions in one provisioned
277
- # workspace, which is the carve-out the retired WP5 doc names in its own words
278
- # (deterministic-pr-levers.md §"Parked: parallel phases (WP5)"; full text in
279
- # git history): *"every hard blocker exists BECAUSE each phase provisions its own
280
- # sandbox against a shared workspace. A fan-out inside one agent has none of
281
- # them."* Six branches, one clone, one AGENTS.md, one artifact harvest, one
282
- # dispose — and still one `executions` row per branch, so per-family cost,
283
- # resume and the dashboard column survive the change.
284
- #
285
- # WHAT DID NOT CHANGE, deliberately: the six prompts, the six literal gates,
286
- # the model, the skills, and the soft-failure policy. This is a latency change
287
- # and it has to be readable as one — if a fan-out arm moves recall, that is a
288
- # bug in this phase, not a result.
289
- #
290
- # `max_concurrent` is a CEILING the run clamps further per backend: gondolin
291
- # boots a QEMU micro-VM per session and pins to 1 (so production is unchanged
292
- # until that is measured), while `none` — the eval harness — takes all six.
293
- #
294
- # PROMPT ORDER IS FIXED HERE AND IS EXPENSIVE TO RETROFIT: the shared prefix
295
- # (skills, AGENTS.md, diff summary) goes FIRST and the family's obligations
296
- # LAST, because provider-side prompt caching is keyed on the request prefix.
297
- # Six passes then share one cached prefix — which is worth MORE under a
298
- # fan-out, not less, since the six now hit the provider inside one window.
212
+ # Prompt order is fixed and expensive to change: the shared prefix (skills,
213
+ # AGENTS.md, diff summary) goes first and the family's obligations last, so
214
+ # the six share one provider-side cached prefix.
299
215
  - name: survey
300
216
  label: Survey · five families
301
217
  type: fanout
302
- # ONE skill, and the same one on every branch (LD9 — specialists are
303
- # separated by QUESTION, not by tool access; the question is the family
304
- # prompt's, and the shared rules are here).
305
- #
306
- # This used to be `[pr-review, code-review]` — 528 lines of which the family
307
- # prompt's own header then countermanded the main contracts: "it overrides
308
- # any instruction in either skill about posting, about writing
309
- # findings.json, or about how confident you must be." `pr-review` is a
310
- # procedure for PRODUCING a review (confirm the target, read prior
311
- # discussion, re-derive on re-review, read CI, write findings.json, submit)
312
- # and a survey pass does none of it; `code-review` is a ten-axis checklist
313
- # handed whole to five specialists who own one or two axes each.
314
- # `survey-pass` carries what a pass actually shares — the workspace layout,
315
- # the tiers, "Not findings", and the multi-pass carve-out that tells it to
316
- # over-produce — assembled from that measured text rather than rewritten.
317
- #
318
- # `code-review` is UNCHANGED and still staged on `review` below, and on
319
- # build's branch-diff reviewer + dependabot-pr-merge. Those are producing a
320
- # review from a diff, which is where its precision gate is meant to fire; the
321
- # subtraction is at the passes that are not, never in the rubric. `falsify`
322
- # and `adjudicate` have since joined the fan-out on the other side of that
323
- # line — see each phase for why.
324
218
  skills: [survey-pass]
325
219
  model: "{{models.review-survey}}"
326
- skip_if: "analysisEnabled != true"
220
+ skip_if:
221
+ - "analysisEnabled != true"
222
+ - "scratch.reviewTriage.depth == 'light'"
327
223
  depends_on: [seed]
328
224
  trigger_rule: all_done
225
+ # A CEILING the run clamps further per backend: gondolin boots a micro-VM
226
+ # per session and pins to 1; `none` takes all six.
329
227
  max_concurrent: { from: surveyConcurrency, default: 6 }
330
- # The fan-out's own key, NOT `on_soft_failure` — that name belongs to
331
- # `generic_loop`, and at phase level zod strips it silently. All six surveys
332
- # carried it in the wrong place until 2026-08-22 and therefore ran with
333
- # `{retries: 0, then: fail}`: one degenerate turn HARD-FAILED the whole
334
- # review, which records no `assessedHeadShaByWorkflow` and hands
335
- # cron-review.yaml something to re-dispatch every thirty minutes, forever.
336
- # A distinct key cannot be confused with it; `fanout-policy.test.ts` pins
337
- # the EFFECTIVE value read off this file rather than the key's presence.
228
+ # The fan-out's OWN key. `on_soft_failure` is the `generic_loop` name and
229
+ # at phase level the schema strips it silently, reverting to
230
+ # `{retries: 0, then: fail}` — one degenerate turn then fails the review.
338
231
  on_branch_soft_failure: { retries: 1, then: complete }
232
+ # `context_file` is read by the HARNESS, host-side, from the cwd the
233
+ # deterministic phases wrote in, and appended to the branch's prompt — the
234
+ # model resolves no path of its own. An unreadable file appends a loud NOT
235
+ # AVAILABLE notice, so a lost seed cannot pass for a clean family.
339
236
  #
340
- # `context_file` — WHY THE OBLIGATIONS ARE NOT A PATH IN THE PROMPT ANY MORE.
341
- #
342
- # They were, and it cost a quarter of the branches their seed. Measured over
343
- # the three stored runs of 2026-08-22: across 120 non-spec survey branches,
344
- # 27 first-turn reads of `obligations/<family>.md` resolved against the
345
- # SANDBOX ROOT rather than the checkout and hit ENOENT; 23 branches never
346
- # recovered. The split is total — every one of the 27 failures used the
347
- # workspace-root ABSOLUTE form, and all 98 relative reads succeeded — because
348
- # the only absolute path a branch has been handed by its first turn is its
349
- # skill bundle, `<workspaceRoot>/.lastlight-skills/<phase>/<skill>/SKILL.md`,
350
- # which lives one level ABOVE the checkout the deterministic phases write in.
351
- # Those branches then took the prompt's "if the file does not exist, work the
352
- # diff directly" escape hatch and free-styled, so a SEEDED pass became an
353
- # unseeded one with nothing anywhere recording that it had. That is the best
354
- # mechanical account there is of identical obligations producing 18
355
- # hypotheses on one run and 43 on the next: which branches lose their seed
356
- # varies per run, so which questions get asked varies per run.
357
- #
358
- # The harness now reads the file at `hostAgentCwd` — the host end of the very
359
- # `cwd` the `seed` phase's shell ran in — and appends it to the branch's
360
- # prompt. The producer and the consumer resolve against ONE base by
361
- # construction, and the model resolves nothing at all. When the read fails,
362
- # what is appended is a loud NOT AVAILABLE notice instead: a lost seed can
363
- # no longer be mistaken for a family with genuinely nothing to check.
364
- #
365
- # `until_bash` — WHY THE GATE IS NO LONGER `test -s`.
366
- #
367
- # It was, and `test -s` is passed by ONE LINE OF ANY CONTENT. So the gate a
368
- # survey had to clear was "write a byte", while the contract in its
369
- # obligations block demanded a QUOTE/ABSENT/PARTIAL/PROBE discharge for every
370
- # obligation. Measured over both preserved runs of 2026-08-22 — all 8 cases,
371
- # every family — NOT ONE obligation ever carried a discharge code: 0 of 31,
372
- # 0 of 34, 0 of 40. That was not the models ignoring the rule; the prescribed
373
- # row shape in the same block had no field to record one in, so compliance
374
- # was impossible. The shape now carries `discharge`, and this gate reads it.
375
- #
376
- # It is also what closes the hole the `context_file` note above leaves open:
377
- # a branch that lost its seed and free-styled still writes a file, and
378
- # `test -s` cannot tell that from a discharged pass. A `NOT_SEEDED` row
379
- # discharges nothing, so this gate fails it.
380
- #
381
- # `discharge` exits 0 (satisfied, or the family has no obligations, or it is
382
- # NOT MEASURED), 3 (something outstanding — iterate), or 2 (nothing to
383
- # grade). Any non-zero re-runs the branch. With no readable obligations
384
- # document it deliberately DEGRADES to the `test -s` floor it replaces
385
- # rather than failing forever: `seed` runs with `|| true` and writes nothing
386
- # on a `coverage: "none"` envelope, and a gate an agent cannot satisfy burns
387
- # every iteration it has — which is the WP3 `$LL_FAMILY` bug, exactly.
388
- #
389
- # `spec` keeps `test -s`: its obligations are built harness-side and never
390
- # reach `obligations.json`, so the gate would be vacuous there. That leaves
391
- # it constraining five branches, and meaningfully four until WP4's `prepare`
392
- # gives the `tests` family a coverage artifact to be measured against.
393
- #
394
- # UNDER `review.analysis.obligationContract: minimal` ALL SIX ARE `test -s`,
395
- # and the gate commands below do NOT change to say so. `seed --contract
396
- # minimal` stamps the mode into obligations.json and `discharge` reads it,
397
- # degrading to the same `test -s` floor it degrades to when the document is
398
- # unreadable — one mechanism, two triggers. That is deliberate: an
399
- # until_bash rewritten per arm could disagree with the block the survey was
400
- # actually handed, which is the separability this pipeline keeps paying for.
401
- # The reason it must degrade at all is measured: under the `minimal` block
402
- # NOT ONE obligation ever carried a code (0/31, 0/34, 0/40), because that
403
- # block's prescribed row has no field to put one in. What it would cost
404
- # today is a false signal rather than money — a fan-out branch gate is
405
- # OBSERVATIONAL (handlers/fanout.ts `runBranchGate`: it runs once, records
406
- # condition_met/not_met and never re-runs the branch, exactly as the six
407
- # chained `generic_loop: {max_iterations: 1}` phases did) — but that handler
408
- # frames single-shot as reproducing the old loops, so the loop can come back
409
- # and the burned budget with it.
237
+ # `until_bash` checks every obligation carries a discharge code, not merely
238
+ # that the file is non-empty. It DEGRADES to `test -s` when the obligations
239
+ # are unreadable or the contract is `minimal`, because a gate an agent
240
+ # cannot satisfy burns every iteration it has.
410
241
  branches:
411
242
  - name: contract
412
243
  prompt: prompts/survey-contract.md
@@ -422,17 +253,6 @@ phases:
422
253
  "$FACTS" discharge --dir .lastlight/pr-review --family enforcement
423
254
  - name: security
424
255
  prompt: prompts/survey-security.md
425
- # NO skills override — it inherits the phase's `survey-pass` like every
426
- # other branch, which is what keeps the shared prompt head byte-identical
427
- # across all five and the cached prefix shared (see the phase comment).
428
- #
429
- # It used to stage `security-review` as a third skill. That skill is a
430
- # CRON procedure: it clones the repo itself, derives its range from the
431
- # newest `security-scan` issue's timestamp marker, ensures labels, files
432
- # one dated summary issue per run and keeps state across runs in
433
- # SECURITY.md — none of which a survey branch does, and all of which its
434
- # own prompt forbids. Only the SDLC checklist applied, and that is now in
435
- # `prompts/survey-security.md` where the family's other questions live.
436
256
  context_file: .lastlight/pr-review/obligations/security.md
437
257
  until_bash: |
438
258
  FACTS="${LASTLIGHT_FACTS_BIN:-$(command -v lastlight-facts || echo /opt/lastlight/bin/lastlight-facts)}"
@@ -443,51 +263,18 @@ phases:
443
263
  until_bash: |
444
264
  FACTS="${LASTLIGHT_FACTS_BIN:-$(command -v lastlight-facts || echo /opt/lastlight/bin/lastlight-facts)}"
445
265
  "$FACTS" discharge --dir .lastlight/pr-review --family state
446
- # There is deliberately NO `tests` branch. The family is dead at both
447
- # ends — no seeder function exists for it in `code-facts`, and the
448
- # `coverage` extractor it would read from needs a report that only
449
- # `prepare` (probes-gated, skipped on every measured run) can produce.
450
- # Measured: 0 artifacts across 50 corpus cases AND all 8 gate cases, in
451
- # every run ever taken. Running the branch paid a sixth of the survey
452
- # fan-out to write NOT MEASURED. The seeder still emits the family's
453
- # block and `obligations.json` row (`measured: false`), so the eval
454
- # instrument keeps reporting it as `notMeasured` — never as "did not
455
- # convert" — and reinstating the branch is this entry plus a seeder.
456
- # `spec` is WP0's and is built HARNESS-side from the PR body and linked
457
- # issues (review-spec.ts), so it reads `{{specObligations}}` from the
458
- # context rather than a block on disk. It is the only untried axis and it
459
- # is orthogonal to everything the investigation has tried.
266
+ # No `tests` branch: the family has no seeder, so it is reported
267
+ # `notMeasured` rather than run to write NOT MEASURED. `spec` is built
268
+ # harness-side from the PR body and linked issues, so it reads
269
+ # `{{specObligations}}` from the context instead of a block on disk and
270
+ # keeps the `test -s` gate.
460
271
  - name: spec
461
272
  prompt: prompts/survey-spec.md
462
273
  until_bash: test -s .lastlight/pr-review/hypotheses/spec.jsonl
463
274
 
464
- # ── WP4's oracle. The only phase that RUNS anything. ───────────────────────
465
- #
466
- # Gated on `probesEnabled` like `prepare`, and for one shared reason: a probe
467
- # needs a tree it can execute in. With probes off this skips and the run is
468
- # WP3 exactly — six surveys and the shipped reviewer.
469
- #
470
- # It reads the hypothesis RECORDS and the code, never an earlier pass's
471
- # transcript. That is AnyPoC's checker-with-no-access-to-the-generator's-context,
472
- # implemented with the mechanism this engine has (a separate phase), and it is
473
- # why the phase exists rather than a seventh survey: baseline agents fail to
474
- # reject 96% of false reports when they can see the reasoning that produced
475
- # them.
476
- #
477
- # NOTE what it cannot do yet. Nothing reads `probes/verdicts.jsonl` — WP6's
478
- # `adjudicate` is its consumer and does not exist, so this phase moves the
479
- # MECHANISM metrics (probes attempted / succeeded / reproduced / refuted) and
480
- # cannot move recall. That is a known non-goal, not an oversight.
481
- # NO SKILL, deliberately. This used to stage `[pr-review, code-review]` for the
482
- # workspace layout and nothing else — its own prompt opened by countermanding
483
- # the rest ("it overrides any instruction in that skill about posting, about
484
- # writing findings.json, or about how confident you must be"), which is the
485
- # same sentence that took both skills off the survey fan-out. An oracle
486
- # produces no review: it neither posts, nor writes findings.json, nor tiers
487
- # anything, so `code-review`'s rubric and `pr-review`'s procedure are 528 lines
488
- # of instruction for a job it is not doing. The workspace layout — the only
489
- # part it did use — is now inline in the prompt, which is where a block that
490
- # fits in twelve lines and is read by exactly one phase belongs.
275
+ # The only phase that RUNS anything. It reads the hypothesis RECORDS and the
276
+ # code, never an earlier pass's transcript — a checker that can see the
277
+ # reasoning which produced a claim almost never rejects it.
491
278
  - name: falsify
492
279
  label: Falsify · run the probe
493
280
  prompt: prompts/review-falsify.md
@@ -495,179 +282,87 @@ phases:
495
282
  skip_if:
496
283
  - "analysisEnabled != true"
497
284
  - "probesEnabled != true"
285
+ - "scratch.reviewTriage.depth == 'light'"
498
286
  depends_on: [survey]
499
287
  trigger_rule: all_done
500
288
  generic_loop:
501
- # `on_soft_failure` lives INSIDE the loop — see the fan-out above for
502
- # what it costs when it does not.
503
289
  on_soft_failure: { retries: 1, then: complete }
504
- # Two rounds. v3's lesson 3 is the sizing argument and it was measured: a
505
- # five-line existence gate earned the investigation's only gold match,
506
- # while v2's full quote validator was overkill and cost 2.4x.
507
290
  max_iterations: { from: probeRounds, default: 2 }
508
- # The gate is an EXISTENCE check and it is deliberately satisfiable in one
509
- # pass without lying: a hypothesis that genuinely cannot be executed
510
- # against is recorded `unprobed`, which closes the gate for it and carries
511
- # the claim forward to adjudication with lowered confidence. An
512
- # unsatisfiable gate is the shape WP3 already hit once — `$LL_FAMILY` was
513
- # never set, so the gate tested `hypotheses/.jsonl`, always failed, and the
514
- # loop ran to `max_iterations` against a condition that meant nothing.
515
- #
516
- # Literal shell, no template markers: `validateShellCommand` rejects any
517
- # command containing `{{` outright.
291
+ # An EXISTENCE check, satisfiable in one honest pass: a hypothesis that
292
+ # cannot be executed against is recorded `unprobed` and carried forward
293
+ # with lowered confidence. Literal shell — `validateShellCommand`
294
+ # rejects any command containing `{{`.
518
295
  until_bash: |
519
296
  FACTS="${LASTLIGHT_FACTS_BIN:-$(command -v lastlight-facts || echo /opt/lastlight/bin/lastlight-facts)}"
520
297
  "$FACTS" probes --dir .lastlight/pr-review
521
298
 
299
+ # Writes findings to `.lastlight/pr-review/findings.json` — content only —
300
+ # and never submits; `post-review` below does that. With the pipeline on the
301
+ # brief collapses to one fast independent pass, since the surveys have
302
+ # already done the deep work.
522
303
  - name: review
523
304
  label: Review
524
- # EXPLICIT, and `all_done` rather than the default `all_success`, because
525
- # declaring `depends_on` anywhere in a workflow disables the synthesized
526
- # linear chain for ALL of it (`buildDag`'s `anyDeclared`). Without these two
527
- # lines `review` and `post-review` become root nodes and run in PARALLEL
528
- # with the surveys — and with `all_success` they would instead be SKIPPED
529
- # whenever the analysis phases skip, which is every deployment that has not
530
- # enabled the pipeline. `all_done` is the rule the schema names for exactly
531
- # this: a skipped node is not `succeeded`.
305
+ # EXPLICIT: declaring `depends_on` anywhere disables the synthesized linear
306
+ # chain for the WHOLE workflow, so without these two lines `review` and
307
+ # `post-review` become roots and run in parallel with the surveys. And
308
+ # `all_done`, because with `all_success` they would be skipped on every
309
+ # deployment that has not enabled the pipeline.
532
310
  depends_on: [falsify]
533
311
  trigger_rule: all_done
534
- # pr-review: the PR procedure (primary). code-review: the finding-tier +
535
- # what-to-check rubric. No `building` — pr-review is a pure code review; CI
536
- # validates that the change builds/runs.
537
- #
538
- # The agent does NOT submit the review itself — it writes structured
539
- # findings (content only: skip? / summary / event / findings[]) to
540
- # .lastlight/pr-review/findings.json. The first-class `post-review` action
541
- # below reads that file and posts one formal review.
542
- #
543
- # §3b lever f4: a TWO-MODE brief. With the pipeline off, the prompt is the
544
- # old skill nudge plus a curated Context section (this phase used to have no
545
- # `prompt:` at all and rode `buildPhasePrompt`'s skills fallback, which
546
- # serialises the ENTIRE render context — the byte-for-byte guarantee on that
547
- # dump is deliberately retired; golden-pr-review.test.ts pins the new
548
- # contract). With the pipeline on, the brief collapses to one fast
549
- # INDEPENDENT pass — PR-level judgment only, no per-hunk re-derivation, no
550
- # reading hypotheses/ (adjudicate is the fresh-context reader) — because six
551
- # survey families + falsify have already done the deep work and a full
552
- # second review here was measured pure waste (137s / $0.30 per case on
553
- # Haiku, an APPROVE with zero findings while 41 hypotheses sat unread).
554
- # It still writes findings.json: adjudicate seeds from it and post-review
555
- # fails loudly without it.
556
312
  prompt: prompts/review.md
557
313
  skills: [pr-review, code-review]
558
314
  model: "{{models.review}}"
559
315
  variant: "{{variants.review}}"
560
316
 
561
- # WP6c — the exit of the funnel. Everything before this phase APPENDS to
562
- # `hypotheses/<family>.jsonl` and `probes/verdicts.jsonl`, and until now
563
- # NOTHING READ EITHER: verified on a real case, 40 KB of obligations and 18+
564
- # hypotheses ended in an APPROVE with zero posted findings against five gold.
565
- # This is the only rung in the plan that can move recall.
566
- #
567
- # A SIBLING of `post-review`, not a link in its chain, and that placement is
568
- # load-bearing. `trigger_rule` is per-node and applies to every dep, so
569
- # `post-review: depends_on [review, adjudicate]` could not say "all_success
570
- # w.r.t. review, all_done w.r.t. adjudicate" — it would have to relax to
571
- # `all_done` and lose the invariant that a FAILED REVIEW MUST NOT POST, which
572
- # is a worse bug than the one it would fix. Declared above `post-review`, so
573
- # the sequential scheduler (ready[0], in declaration order) still runs it
574
- # first; unreachable from `post-review`'s dep set, so it can never stop a
575
- # review from being posted.
317
+ # The exit of the funnel, and the only phase that can move recall: it ranks,
318
+ # re-tiers and demotes the hypotheses into the review. It DELETES only when a
319
+ # probe transcript refutes a claim.
576
320
  #
577
- # WHAT IT MAY AND MAY NOT DO. It re-ranks, re-tiers, and demotes into the
578
- # review body. It deletes ONLY when a probe transcript refutes the claim.
579
- # That asymmetry is measured, not principled: `aacr-adjudicate.ts` scored two
580
- # models against AACR-Bench's 1,505 valid / 640 invalid comments and NEITHER
581
- # BEAT KEEPING EVERYTHING (F1 0.825 → 0.803 Haiku → 0.745 GLM). Haiku
582
- # destroyed 131 valid comments to catch 98; precision barely moved, which is
583
- # the signature of a filter that is not discriminating, only shrinking. The
584
- # threshold sweep closes it — F1 is flat from t=0.0 to t=0.7 then collapses,
585
- # so there is no operating point to tune toward. A cheap model asked "is this
586
- # comment valid" is worse than useless here.
587
- # ONE role-scoped skill, for the same reason the fan-out has one. This staged
588
- # `[pr-review, code-review]` and its prompt named exactly two things it wanted
589
- # from them — "the workspace layout" and "the finding tiers", ~54 lines of 552
590
- # — then overrode the rest. Three of those overrides are not stylistic: the
591
- # adjudicator's output schema CONTRADICTS `pr-review`'s (which says to write
592
- # "only these content fields" while this phase must carry tier / family /
593
- # obligation / confidence / hypotheses / evidence and a top-level `dropped[]`,
594
- # and whose `references/findings-schema.md` documents the wrong contract);
595
- # `pr-review`'s §1 tells it to write `{"skip": true}` on an already-reviewed
596
- # head, which here would discard five surveys and an oracle; and `pr-review`'s
597
- # confidence gate permits dropping a finding by naming code that refutes it,
598
- # where this phase may delete ONLY on a probe transcript.
599
- #
600
- # `adjudicate-pass` carries the three things the prompt assumes and does not
601
- # state: the workspace layout, the severity vocabulary it ranks on, and the
602
- # prior-review ledger + the two APPROVE constraints it inherits as the only
603
- # pass that owns the posted verdict. It is deliberately NOT `survey-pass`: a
604
- # survey is told to over-produce and posts nothing, an adjudicator ranks and
605
- # owns the verdict, and one skill serving both would be generic again.
321
+ # A SIBLING of `post-review`, not a link in its chain. `trigger_rule` is
322
+ # per-node, so folding it into `post-review`'s deps would force that node to
323
+ # `all_done` and lose the invariant that a FAILED REVIEW MUST NOT POST.
324
+ # Declared first, so the sequential scheduler still runs it first.
606
325
  - name: adjudicate
607
326
  label: Adjudicate
608
327
  skills: [adjudicate-pass]
609
328
  prompt: prompts/review-adjudicate.md
610
- # Its OWN key, `models.review-adjudicate`, because this is a RANKING pass
611
- # over an already-generated set — a different task from survey discovery
612
- # (where Haiku beats Sonnet on recall) — so an overlay must be able to move
613
- # it without also moving `review`. Unset, it falls through to
614
- # `models.review`, preserving the old single-key behaviour byte-for-byte.
615
- # The {{#if}} pair is load-bearing: a bare `{{models.review-adjudicate}}`
616
- # renders EMPTY when unset, and `resolveModelVariant` then falls back to
617
- # the DEFAULT model — not to `models.review`.
329
+ # The `{{#if}}` pair is load-bearing: a bare unset `{{models.review-adjudicate}}`
330
+ # renders EMPTY, and an empty model falls back to the DEFAULT model rather
331
+ # than to `models.review`.
618
332
  model: "{{#if models.review-adjudicate}}{{models.review-adjudicate}}{{/if}}{{#if !models.review-adjudicate}}{{models.review}}{{/if}}"
619
333
  variant: "{{variants.review}}"
620
- skip_if: "analysisEnabled != true"
334
+ skip_if:
335
+ - "analysisEnabled != true"
336
+ - "scratch.reviewTriage.depth == 'light'"
337
+ # `all_success` (the default) where `review` uses `all_done`: a failed
338
+ # review must NOT post.
621
339
  depends_on: [review]
622
340
  generic_loop:
623
- # INSIDE the loop, where the schema reads it. At phase level zod strips
624
- # the key and the policy silently reverts to `{retries: 0, then: fail}` —
625
- # all six survey phases had it in the wrong place until 2026-08-22.
626
341
  on_soft_failure: { retries: 1, then: complete }
627
342
  max_iterations: 2
628
- # The fresh-context adjudication AnyPoC recommends: it reads the
629
- # hypothesis RECORDS, the quotes and the transcripts — not the survey's
630
- # reasoning, which is what makes rejecting a false report possible at all
631
- # (baseline agents fail to reject 96% of false reports when they can see
632
- # the reasoning that produced them).
633
343
  fresh_context: true
634
- # The CONSERVATION gate. "Existence-plus-schema" was explicitly judged not
635
- # enough: an adjudicator reading 30 hypotheses and writing 6 findings
636
- # would have passed every other gate in this plan, and that is exactly v2
637
- # — which "worked mechanically" and cost recall anyway. Every hypothesis
638
- # id must appear with exactly one disposition, and a `dropped` one must
639
- # name a transcript that EXISTS. Silent omission becomes impossible by
640
- # construction rather than by instruction.
641
- #
642
- # Literal shell, no template markers: `validateShellCommand` rejects any
643
- # command containing `{{` outright.
344
+ # The CONSERVATION gate: every hypothesis id must appear with exactly one
345
+ # disposition, and a `dropped` one must name a transcript that EXISTS.
346
+ # Silent omission is impossible by construction rather than by
347
+ # instruction. Literal shell — no `{{` markers allowed.
644
348
  until_bash: |
645
349
  FACTS="${LASTLIGHT_FACTS_BIN:-$(command -v lastlight-facts || echo /opt/lastlight/bin/lastlight-facts)}"
646
350
  "$FACTS" findings --dir .lastlight/pr-review
647
351
 
648
- # §D12's FLOOR, and the reason the gate above is a mechanism rather than a
649
- # request. Reaching `max_iterations` without the condition is NOT a phase
650
- # failure in this engine (phase-executor.ts) — the loop simply ends — so an
651
- # adjudicator that never satisfied conservation would otherwise leave
652
- # hypotheses silently unaccounted for, which is the one outcome the gate
653
- # exists to prevent.
654
- #
655
- # `--repair` writes every uncovered hypothesis into findings.json at
656
- # `internal` tier, and PROMOTES any `dropped` entry whose transcript does not
657
- # exist back to `internal` — an unjustified deletion becomes a recorded
658
- # non-deletion. It is idempotent, so on a run where the model DID satisfy the
659
- # gate this phase is a no-op.
660
- #
661
- # Deterministic, model-free, and it exits 0 on every path: a phase that fails
662
- # hard records no `assessedHeadShaByWorkflow` and hands `cron-review.yaml`
663
- # something to re-dispatch every thirty minutes, forever.
352
+ # The floor under that gate: reaching `max_iterations` unsatisfied is not a
353
+ # phase failure in this engine, so hypotheses would otherwise go unaccounted
354
+ # for. `--repair` writes every uncovered hypothesis into findings.json at
355
+ # `internal` tier and promotes back any `dropped` entry whose transcript does
356
+ # not exist. Idempotent, model-free, and exits 0 on every path.
664
357
  - name: reconcile
665
358
  label: Reconcile · the conservation floor
666
359
  type: bash
667
- skip_if: "analysisEnabled != true"
360
+ skip_if:
361
+ - "analysisEnabled != true"
362
+ - "scratch.reviewTriage.depth == 'light'"
668
363
  depends_on: [adjudicate]
669
- # `all_done`: the floor must apply even when the adjudicator failed or was
670
- # cut short — that is precisely when there is something to repair.
364
+ # `all_done`: the floor must apply even when the adjudicator failed — that
365
+ # is precisely when there is something to repair.
671
366
  trigger_rule: all_done
672
367
  timeout_seconds: 120
673
368
  command: |
@@ -678,21 +373,12 @@ phases:
678
373
  fi
679
374
  exit 0
680
375
 
681
- # First-class, in-process submission (type: post-review → PhaseExecutor.
682
- # runPostReview). Reads the agent's findings.json for the review *content*
683
- # (skip? / summary / event / findings[]) and supplies everything else from
684
- # the harness itself — PR number (run context), base ref (baseBranch), head
685
- # SHA + diff (the pre-cloned checkout) — so the AI never hand-copies metadata.
686
- # It anchors each finding to a changed line, demotes off-diff findings to the
687
- # body (GitHub 422s on off-diff lines), and posts ONE review via GitHubClient
688
- # (App auth in prod; token + githubApiBaseUrl against the eval mock). A
689
- # genuine failure — missing findings after a real review, or a GitHub error
690
- # that survives the body-only retry — FAILS this phase visibly; a legitimate
691
- # `skip` succeeds without posting. Idempotent on resume (no-op if a bot review
692
- # already exists on the head SHA).
376
+ # In-process submission. Reads findings.json for the review CONTENT and
377
+ # supplies the rest from the harness itself — PR number, base ref, head SHA
378
+ # and diff — so the agent never hand-copies metadata. Anchors each finding to
379
+ # a changed line, demotes off-diff findings to the body, and posts one
380
+ # review. Idempotent on resume.
693
381
  - name: post-review
694
382
  label: Post inline review
695
383
  type: post-review
696
- # `all_success` (the default) is deliberate here where `review` uses
697
- # `all_done`: a failed review must NOT post.
698
384
  depends_on: [review]