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