lastlight-core 0.25.9 → 0.27.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/config/default.yaml +317 -1
- package/dist/admin/chat-session-reader.d.ts +3 -3
- package/dist/admin/chat-session-reader.js +8 -8
- package/dist/admin/chat-session-reader.js.map +1 -1
- package/dist/admin/docker.js.map +1 -1
- package/dist/admin/routes.js +97 -99
- package/dist/admin/routes.js.map +1 -1
- package/dist/admin/sessions.d.ts +7 -7
- package/dist/admin/sessions.js +6 -4
- package/dist/admin/sessions.js.map +1 -1
- package/dist/admin/tail.js.map +1 -1
- package/dist/config/config.d.ts +29 -0
- package/dist/config/config.js +141 -0
- package/dist/config/config.js.map +1 -1
- package/dist/config/repo-config.js +6 -7
- package/dist/config/repo-config.js.map +1 -1
- package/dist/connectors/messaging/base.js +2 -2
- package/dist/connectors/messaging/base.js.map +1 -1
- package/dist/connectors/messaging/session-manager.d.ts +29 -31
- package/dist/connectors/messaging/session-manager.js +156 -189
- package/dist/connectors/messaging/session-manager.js.map +1 -1
- package/dist/connectors/messaging/thread-transcript.d.ts +2 -2
- package/dist/connectors/messaging/thread-transcript.js +14 -8
- package/dist/connectors/messaging/thread-transcript.js.map +1 -1
- package/dist/connectors/slack/connector.js +5 -5
- package/dist/connectors/slack/connector.js.map +1 -1
- package/dist/cron/dependabot-discovery.js.map +1 -1
- package/dist/cron/feedback-poll.js +6 -6
- package/dist/cron/feedback-poll.js.map +1 -1
- package/dist/cron/handlers.js +3 -3
- package/dist/cron/handlers.js.map +1 -1
- package/dist/cron/jobs.d.ts +1 -1
- package/dist/cron/jobs.js +2 -2
- package/dist/cron/jobs.js.map +1 -1
- package/dist/cron/repo-digest.js +4 -4
- package/dist/cron/repo-digest.js.map +1 -1
- package/dist/cron/review-discovery.js.map +1 -1
- package/dist/cron/runner.js +2 -2
- package/dist/cron/runner.js.map +1 -1
- package/dist/cron/scheduler.js +1 -1
- package/dist/cron/scheduler.js.map +1 -1
- package/dist/engine/agent-executor.d.ts +25 -1
- package/dist/engine/agent-executor.js +41 -1
- package/dist/engine/agent-executor.js.map +1 -1
- package/dist/engine/chat/chat-prompt.d.ts +11 -4
- package/dist/engine/chat/chat-prompt.js.map +1 -1
- package/dist/engine/chat/chat-runner.d.ts +3 -2
- package/dist/engine/chat/chat-runner.js +9 -7
- package/dist/engine/chat/chat-runner.js.map +1 -1
- package/dist/engine/dispatcher.js +29 -25
- package/dist/engine/dispatcher.js.map +1 -1
- package/dist/engine/event-shim.d.ts +18 -0
- package/dist/engine/event-shim.js +2 -0
- package/dist/engine/event-shim.js.map +1 -1
- package/dist/engine/executors/orchestrator.d.ts +120 -1
- package/dist/engine/executors/orchestrator.js +214 -47
- package/dist/engine/executors/orchestrator.js.map +1 -1
- package/dist/engine/executors/shared.js.map +1 -1
- package/dist/engine/feedback/ingest.d.ts +4 -4
- package/dist/engine/feedback/ingest.js +13 -13
- package/dist/engine/feedback/ingest.js.map +1 -1
- package/dist/engine/feedback/slack.d.ts +2 -2
- package/dist/engine/feedback/slack.js +6 -6
- package/dist/engine/feedback/slack.js.map +1 -1
- package/dist/engine/fix-harvest.d.ts +1 -1
- package/dist/engine/fix-harvest.js +3 -3
- package/dist/engine/fix-harvest.js.map +1 -1
- package/dist/engine/github/github.d.ts +59 -0
- package/dist/engine/github/github.js +72 -0
- package/dist/engine/github/github.js.map +1 -1
- package/dist/engine/github/installations.js.map +1 -1
- package/dist/engine/github/review-poster.d.ts +388 -9
- package/dist/engine/github/review-poster.js +550 -50
- package/dist/engine/github/review-poster.js.map +1 -1
- package/dist/engine/github/team-visibility.js +7 -7
- package/dist/engine/github/team-visibility.js.map +1 -1
- package/dist/engine/llm.js.map +1 -1
- package/dist/engine/pr-decisions.d.ts +13 -5
- package/dist/engine/pr-decisions.js +204 -5
- package/dist/engine/pr-decisions.js.map +1 -1
- package/dist/engine/pr-escalation.js +7 -7
- package/dist/engine/pr-escalation.js.map +1 -1
- package/dist/engine/pr-state.d.ts +59 -1
- package/dist/engine/pr-state.js +76 -10
- package/dist/engine/pr-state.js.map +1 -1
- package/dist/engine/review-check.d.ts +1 -1
- package/dist/engine/review-check.js +5 -5
- package/dist/engine/review-check.js.map +1 -1
- package/dist/engine/review-spec.d.ts +264 -0
- package/dist/engine/review-spec.js +723 -0
- package/dist/engine/review-spec.js.map +1 -0
- package/dist/engine/router.js +3 -3
- package/dist/engine/router.js.map +1 -1
- package/dist/engine/screen/classifier.js.map +1 -1
- package/dist/engine/screen/screen.js.map +1 -1
- package/dist/evals-api.d.ts +3 -0
- package/dist/evals-api.js +20 -0
- package/dist/evals-api.js.map +1 -1
- package/dist/index.js +145 -67
- package/dist/index.js.map +1 -1
- package/dist/notify/digest-blocks.js.map +1 -1
- package/dist/notify/model.js.map +1 -1
- package/dist/notify/transports/github.js.map +1 -1
- package/dist/notify/transports/slack.js.map +1 -1
- package/dist/sandbox/artifact-backend.js.map +1 -1
- package/dist/sandbox/artifact-store.js.map +1 -1
- package/dist/sandbox/docker.d.ts +56 -5
- package/dist/sandbox/docker.js +96 -2
- package/dist/sandbox/docker.js.map +1 -1
- package/dist/sandbox/egress-allowlist.js.map +1 -1
- package/dist/sandbox/k8s/agent-context-registry.js.map +1 -1
- package/dist/sandbox/k8s/client.js.map +1 -1
- package/dist/sandbox/k8s/kubernetes-sandbox.d.ts +3 -0
- package/dist/sandbox/k8s/kubernetes-sandbox.js +9 -0
- package/dist/sandbox/k8s/kubernetes-sandbox.js.map +1 -1
- package/dist/sandbox/k8s/pod.d.ts +11 -0
- package/dist/sandbox/k8s/pod.js +11 -6
- package/dist/sandbox/k8s/pod.js.map +1 -1
- package/dist/sandbox/k8s/resource-name.js.map +1 -1
- package/dist/sandbox/k8s/run-id.js.map +1 -1
- package/dist/sandbox/k8s/run-secrets.js.map +1 -1
- package/dist/sandbox/k8s/service-containers.d.ts +43 -0
- package/dist/sandbox/k8s/service-containers.js +87 -0
- package/dist/sandbox/k8s/service-containers.js.map +1 -0
- package/dist/sandbox/k8s/skill-bundle.js.map +1 -1
- package/dist/sandbox/k8s/workspace-provisioner.js +10 -2
- package/dist/sandbox/k8s/workspace-provisioner.js.map +1 -1
- package/dist/sandbox/reap.d.ts +9 -0
- package/dist/sandbox/reap.js +36 -0
- package/dist/sandbox/reap.js.map +1 -1
- package/dist/sandbox/sandbox.d.ts +34 -0
- package/dist/sandbox/sandbox.js +36 -6
- package/dist/sandbox/sandbox.js.map +1 -1
- package/dist/sandbox/service-containers-docker.d.ts +45 -0
- package/dist/sandbox/service-containers-docker.js +78 -0
- package/dist/sandbox/service-containers-docker.js.map +1 -0
- package/dist/session-log.js.map +1 -1
- package/dist/state/approval-store.d.ts +23 -14
- package/dist/state/approval-store.js +137 -86
- package/dist/state/approval-store.js.map +1 -1
- package/dist/state/build-assets.js.map +1 -1
- package/dist/state/client.d.ts +105 -0
- package/dist/state/client.js +68 -0
- package/dist/state/client.js.map +1 -0
- package/dist/state/cron-run-store.d.ts +32 -12
- package/dist/state/cron-run-store.js +105 -39
- package/dist/state/cron-run-store.js.map +1 -1
- package/dist/state/data-migrate.d.ts +135 -0
- package/dist/state/data-migrate.js +309 -0
- package/dist/state/data-migrate.js.map +1 -0
- package/dist/state/db.d.ts +82 -23
- package/dist/state/db.js +201 -105
- package/dist/state/db.js.map +1 -1
- package/dist/state/dialect.d.ts +77 -0
- package/dist/state/dialect.js +129 -0
- package/dist/state/dialect.js.map +1 -0
- package/dist/state/execution-store.d.ts +124 -103
- package/dist/state/execution-store.js +569 -374
- package/dist/state/execution-store.js.map +1 -1
- package/dist/state/feedback-store.d.ts +20 -20
- package/dist/state/feedback-store.js +241 -187
- package/dist/state/feedback-store.js.map +1 -1
- package/dist/state/legacy-sqlite.d.ts +15 -0
- package/dist/state/legacy-sqlite.js +131 -0
- package/dist/state/legacy-sqlite.js.map +1 -0
- package/dist/state/pg-client.d.ts +44 -0
- package/dist/state/pg-client.js +81 -0
- package/dist/state/pg-client.js.map +1 -0
- package/dist/state/repo-ref.d.ts +9 -4
- package/dist/state/repo-ref.js +12 -6
- package/dist/state/repo-ref.js.map +1 -1
- package/dist/state/schema/pg.d.ts +2788 -0
- package/dist/state/schema/pg.js +301 -0
- package/dist/state/schema/pg.js.map +1 -0
- package/dist/state/schema/sqlite.d.ts +3063 -0
- package/dist/state/schema/sqlite.js +391 -0
- package/dist/state/schema/sqlite.js.map +1 -0
- package/dist/state/state-cli.d.ts +8 -0
- package/dist/state/state-cli.js +247 -0
- package/dist/state/state-cli.js.map +1 -0
- package/dist/state/team-store.d.ts +26 -13
- package/dist/state/team-store.js +140 -93
- package/dist/state/team-store.js.map +1 -1
- package/dist/state/user-store.d.ts +31 -13
- package/dist/state/user-store.js +180 -80
- package/dist/state/user-store.js.map +1 -1
- package/dist/state/workflow-run-store.d.ts +95 -56
- package/dist/state/workflow-run-store.js +419 -314
- package/dist/state/workflow-run-store.js.map +1 -1
- package/dist/telemetry/index.js.map +1 -1
- package/dist/workflows/admission.d.ts +4 -3
- package/dist/workflows/admission.js +34 -10
- package/dist/workflows/admission.js.map +1 -1
- package/dist/workflows/handlers/fanout.d.ts +157 -0
- package/dist/workflows/handlers/fanout.js +663 -0
- package/dist/workflows/handlers/fanout.js.map +1 -0
- package/dist/workflows/handlers/post-review.d.ts +98 -8
- package/dist/workflows/handlers/post-review.js +394 -23
- package/dist/workflows/handlers/post-review.js.map +1 -1
- package/dist/workflows/resume.js +22 -15
- package/dist/workflows/resume.js.map +1 -1
- package/dist/workflows/runner.js +60 -12
- package/dist/workflows/runner.js.map +1 -1
- package/dist/workflows/simple.d.ts +23 -0
- package/dist/workflows/simple.js +40 -16
- package/dist/workflows/simple.js.map +1 -1
- package/docker-compose.yml +50 -0
- package/drizzle/pg/0000_init.sql +235 -0
- package/drizzle/pg/meta/0000_snapshot.json +1751 -0
- package/drizzle/pg/meta/_journal.json +13 -0
- package/drizzle/sqlite/0000_baseline.sql +257 -0
- package/drizzle/sqlite/0001_backfill_repo_refs.sql +74 -0
- package/drizzle/sqlite/meta/0000_snapshot.json +1593 -0
- package/drizzle/sqlite/meta/0001_snapshot.json +1593 -0
- package/drizzle/sqlite/meta/_journal.json +20 -0
- package/package.json +31 -15
- package/sandbox.Dockerfile +54 -0
- package/skills/code-review/SKILL.md +98 -13
- package/skills/pr-review/SKILL.md +97 -21
- package/skills/pr-review/references/findings-schema.md +37 -6
- package/workflows/pr-review.yaml +567 -0
- package/workflows/prompts/dependabot-pr-merge.md +22 -2
- package/workflows/prompts/review-adjudicate.md +323 -0
- package/workflows/prompts/review-falsify.md +149 -0
- package/workflows/prompts/review.md +80 -0
- package/workflows/prompts/survey-contract.md +109 -0
- package/workflows/prompts/survey-enforcement.md +126 -0
- package/workflows/prompts/survey-security.md +118 -0
- package/workflows/prompts/survey-spec.md +110 -0
- package/workflows/prompts/survey-state.md +143 -0
- package/workflows/prompts/survey-tests.md +99 -0
- package/dist/state/migrate.d.ts +0 -15
- package/dist/state/migrate.js +0 -518
- package/dist/state/migrate.js.map +0 -1
package/workflows/pr-review.yaml
CHANGED
|
@@ -32,8 +32,456 @@ 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
|
+
skills: [pr-review, code-review]
|
|
294
|
+
model: "{{models.review-survey}}"
|
|
295
|
+
skip_if: "analysisEnabled != true"
|
|
296
|
+
depends_on: [seed]
|
|
297
|
+
trigger_rule: all_done
|
|
298
|
+
max_concurrent: { from: surveyConcurrency, default: 6 }
|
|
299
|
+
# The fan-out's own key, NOT `on_soft_failure` — that name belongs to
|
|
300
|
+
# `generic_loop`, and at phase level zod strips it silently. All six surveys
|
|
301
|
+
# carried it in the wrong place until 2026-08-22 and therefore ran with
|
|
302
|
+
# `{retries: 0, then: fail}`: one degenerate turn HARD-FAILED the whole
|
|
303
|
+
# review, which records no `assessedHeadShaByWorkflow` and hands
|
|
304
|
+
# cron-review.yaml something to re-dispatch every thirty minutes, forever.
|
|
305
|
+
# A distinct key cannot be confused with it; `fanout-policy.test.ts` pins
|
|
306
|
+
# the EFFECTIVE value read off this file rather than the key's presence.
|
|
307
|
+
on_branch_soft_failure: { retries: 1, then: complete }
|
|
308
|
+
#
|
|
309
|
+
# `context_file` — WHY THE OBLIGATIONS ARE NOT A PATH IN THE PROMPT ANY MORE.
|
|
310
|
+
#
|
|
311
|
+
# They were, and it cost a quarter of the branches their seed. Measured over
|
|
312
|
+
# the three stored runs of 2026-08-22: across 120 non-spec survey branches,
|
|
313
|
+
# 27 first-turn reads of `obligations/<family>.md` resolved against the
|
|
314
|
+
# SANDBOX ROOT rather than the checkout and hit ENOENT; 23 branches never
|
|
315
|
+
# recovered. The split is total — every one of the 27 failures used the
|
|
316
|
+
# workspace-root ABSOLUTE form, and all 98 relative reads succeeded — because
|
|
317
|
+
# the only absolute path a branch has been handed by its first turn is its
|
|
318
|
+
# skill bundle, `<workspaceRoot>/.lastlight-skills/<phase>/<skill>/SKILL.md`,
|
|
319
|
+
# which lives one level ABOVE the checkout the deterministic phases write in.
|
|
320
|
+
# Those branches then took the prompt's "if the file does not exist, work the
|
|
321
|
+
# diff directly" escape hatch and free-styled, so a SEEDED pass became an
|
|
322
|
+
# unseeded one with nothing anywhere recording that it had. That is the best
|
|
323
|
+
# mechanical account there is of identical obligations producing 18
|
|
324
|
+
# hypotheses on one run and 43 on the next: which branches lose their seed
|
|
325
|
+
# varies per run, so which questions get asked varies per run.
|
|
326
|
+
#
|
|
327
|
+
# The harness now reads the file at `hostAgentCwd` — the host end of the very
|
|
328
|
+
# `cwd` the `seed` phase's shell ran in — and appends it to the branch's
|
|
329
|
+
# prompt. The producer and the consumer resolve against ONE base by
|
|
330
|
+
# construction, and the model resolves nothing at all. When the read fails,
|
|
331
|
+
# what is appended is a loud NOT AVAILABLE notice instead: a lost seed can
|
|
332
|
+
# no longer be mistaken for a family with genuinely nothing to check.
|
|
333
|
+
#
|
|
334
|
+
# `until_bash` — WHY THE GATE IS NO LONGER `test -s`.
|
|
335
|
+
#
|
|
336
|
+
# It was, and `test -s` is passed by ONE LINE OF ANY CONTENT. So the gate a
|
|
337
|
+
# survey had to clear was "write a byte", while the contract in its
|
|
338
|
+
# obligations block demanded a QUOTE/ABSENT/PARTIAL/PROBE discharge for every
|
|
339
|
+
# obligation. Measured over both preserved runs of 2026-08-22 — all 8 cases,
|
|
340
|
+
# every family — NOT ONE obligation ever carried a discharge code: 0 of 31,
|
|
341
|
+
# 0 of 34, 0 of 40. That was not the models ignoring the rule; the prescribed
|
|
342
|
+
# row shape in the same block had no field to record one in, so compliance
|
|
343
|
+
# was impossible. The shape now carries `discharge`, and this gate reads it.
|
|
344
|
+
#
|
|
345
|
+
# It is also what closes the hole the `context_file` note above leaves open:
|
|
346
|
+
# a branch that lost its seed and free-styled still writes a file, and
|
|
347
|
+
# `test -s` cannot tell that from a discharged pass. A `NOT_SEEDED` row
|
|
348
|
+
# discharges nothing, so this gate fails it.
|
|
349
|
+
#
|
|
350
|
+
# `discharge` exits 0 (satisfied, or the family has no obligations, or it is
|
|
351
|
+
# NOT MEASURED), 3 (something outstanding — iterate), or 2 (nothing to
|
|
352
|
+
# grade). Any non-zero re-runs the branch. With no readable obligations
|
|
353
|
+
# document it deliberately DEGRADES to the `test -s` floor it replaces
|
|
354
|
+
# rather than failing forever: `seed` runs with `|| true` and writes nothing
|
|
355
|
+
# on a `coverage: "none"` envelope, and a gate an agent cannot satisfy burns
|
|
356
|
+
# every iteration it has — which is the WP3 `$LL_FAMILY` bug, exactly.
|
|
357
|
+
#
|
|
358
|
+
# `spec` keeps `test -s`: its obligations are built harness-side and never
|
|
359
|
+
# reach `obligations.json`, so the gate would be vacuous there. That leaves
|
|
360
|
+
# it constraining five branches, and meaningfully four until WP4's `prepare`
|
|
361
|
+
# gives the `tests` family a coverage artifact to be measured against.
|
|
362
|
+
#
|
|
363
|
+
# UNDER `review.analysis.obligationContract: minimal` ALL SIX ARE `test -s`,
|
|
364
|
+
# and the gate commands below do NOT change to say so. `seed --contract
|
|
365
|
+
# minimal` stamps the mode into obligations.json and `discharge` reads it,
|
|
366
|
+
# degrading to the same `test -s` floor it degrades to when the document is
|
|
367
|
+
# unreadable — one mechanism, two triggers. That is deliberate: an
|
|
368
|
+
# until_bash rewritten per arm could disagree with the block the survey was
|
|
369
|
+
# actually handed, which is the separability this pipeline keeps paying for.
|
|
370
|
+
# The reason it must degrade at all is measured: under the `minimal` block
|
|
371
|
+
# NOT ONE obligation ever carried a code (0/31, 0/34, 0/40), because that
|
|
372
|
+
# block's prescribed row has no field to put one in. What it would cost
|
|
373
|
+
# today is a false signal rather than money — a fan-out branch gate is
|
|
374
|
+
# OBSERVATIONAL (handlers/fanout.ts `runBranchGate`: it runs once, records
|
|
375
|
+
# condition_met/not_met and never re-runs the branch, exactly as the six
|
|
376
|
+
# chained `generic_loop: {max_iterations: 1}` phases did) — but that handler
|
|
377
|
+
# frames single-shot as reproducing the old loops, so the loop can come back
|
|
378
|
+
# and the burned budget with it.
|
|
379
|
+
branches:
|
|
380
|
+
- name: contract
|
|
381
|
+
prompt: prompts/survey-contract.md
|
|
382
|
+
context_file: .lastlight/pr-review/obligations/contract.md
|
|
383
|
+
until_bash: |
|
|
384
|
+
FACTS="${LASTLIGHT_FACTS_BIN:-$(command -v lastlight-facts || echo /opt/lastlight/bin/lastlight-facts)}"
|
|
385
|
+
"$FACTS" discharge --dir .lastlight/pr-review --family contract
|
|
386
|
+
- name: enforcement
|
|
387
|
+
prompt: prompts/survey-enforcement.md
|
|
388
|
+
context_file: .lastlight/pr-review/obligations/enforcement.md
|
|
389
|
+
until_bash: |
|
|
390
|
+
FACTS="${LASTLIGHT_FACTS_BIN:-$(command -v lastlight-facts || echo /opt/lastlight/bin/lastlight-facts)}"
|
|
391
|
+
"$FACTS" discharge --dir .lastlight/pr-review --family enforcement
|
|
392
|
+
- name: security
|
|
393
|
+
prompt: prompts/survey-security.md
|
|
394
|
+
# The one branch with a third skill — the others inherit the phase's two.
|
|
395
|
+
skills: [pr-review, code-review, security-review]
|
|
396
|
+
context_file: .lastlight/pr-review/obligations/security.md
|
|
397
|
+
until_bash: |
|
|
398
|
+
FACTS="${LASTLIGHT_FACTS_BIN:-$(command -v lastlight-facts || echo /opt/lastlight/bin/lastlight-facts)}"
|
|
399
|
+
"$FACTS" discharge --dir .lastlight/pr-review --family security
|
|
400
|
+
- name: state
|
|
401
|
+
prompt: prompts/survey-state.md
|
|
402
|
+
context_file: .lastlight/pr-review/obligations/state.md
|
|
403
|
+
until_bash: |
|
|
404
|
+
FACTS="${LASTLIGHT_FACTS_BIN:-$(command -v lastlight-facts || echo /opt/lastlight/bin/lastlight-facts)}"
|
|
405
|
+
"$FACTS" discharge --dir .lastlight/pr-review --family state
|
|
406
|
+
# There is deliberately NO `tests` branch. The family is dead at both
|
|
407
|
+
# ends — no seeder function exists for it in `code-facts`, and the
|
|
408
|
+
# `coverage` extractor it would read from needs a report that only
|
|
409
|
+
# `prepare` (probes-gated, skipped on every measured run) can produce.
|
|
410
|
+
# Measured: 0 artifacts across 50 corpus cases AND all 8 gate cases, in
|
|
411
|
+
# every run ever taken. Running the branch paid a sixth of the survey
|
|
412
|
+
# fan-out to write NOT MEASURED. The seeder still emits the family's
|
|
413
|
+
# block and `obligations.json` row (`measured: false`), so the eval
|
|
414
|
+
# instrument keeps reporting it as `notMeasured` — never as "did not
|
|
415
|
+
# convert" — and reinstating the branch is this entry plus a seeder.
|
|
416
|
+
# `spec` is WP0's and is built HARNESS-side from the PR body and linked
|
|
417
|
+
# issues (review-spec.ts), so it reads `{{specObligations}}` from the
|
|
418
|
+
# context rather than a block on disk. It is the only untried axis and it
|
|
419
|
+
# is orthogonal to everything the investigation has tried.
|
|
420
|
+
- name: spec
|
|
421
|
+
prompt: prompts/survey-spec.md
|
|
422
|
+
until_bash: test -s .lastlight/pr-review/hypotheses/spec.jsonl
|
|
423
|
+
|
|
424
|
+
# ── WP4's oracle. The only phase that RUNS anything. ───────────────────────
|
|
425
|
+
#
|
|
426
|
+
# Gated on `probesEnabled` like `prepare`, and for one shared reason: a probe
|
|
427
|
+
# needs a tree it can execute in. With probes off this skips and the run is
|
|
428
|
+
# WP3 exactly — six surveys and the shipped reviewer.
|
|
429
|
+
#
|
|
430
|
+
# It reads the hypothesis RECORDS and the code, never an earlier pass's
|
|
431
|
+
# transcript. That is AnyPoC's checker-with-no-access-to-the-generator's-context,
|
|
432
|
+
# implemented with the mechanism this engine has (a separate phase), and it is
|
|
433
|
+
# why the phase exists rather than a seventh survey: baseline agents fail to
|
|
434
|
+
# reject 96% of false reports when they can see the reasoning that produced
|
|
435
|
+
# them.
|
|
436
|
+
#
|
|
437
|
+
# NOTE what it cannot do yet. Nothing reads `probes/verdicts.jsonl` — WP6's
|
|
438
|
+
# `adjudicate` is its consumer and does not exist, so this phase moves the
|
|
439
|
+
# MECHANISM metrics (probes attempted / succeeded / reproduced / refuted) and
|
|
440
|
+
# cannot move recall. That is a known non-goal, not an oversight.
|
|
441
|
+
- name: falsify
|
|
442
|
+
label: Falsify · run the probe
|
|
443
|
+
skills: [pr-review, code-review]
|
|
444
|
+
prompt: prompts/review-falsify.md
|
|
445
|
+
model: "{{models.review-survey}}"
|
|
446
|
+
skip_if:
|
|
447
|
+
- "analysisEnabled != true"
|
|
448
|
+
- "probesEnabled != true"
|
|
449
|
+
depends_on: [survey]
|
|
450
|
+
trigger_rule: all_done
|
|
451
|
+
generic_loop:
|
|
452
|
+
# `on_soft_failure` lives INSIDE the loop — see the fan-out above for
|
|
453
|
+
# what it costs when it does not.
|
|
454
|
+
on_soft_failure: { retries: 1, then: complete }
|
|
455
|
+
# Two rounds. v3's lesson 3 is the sizing argument and it was measured: a
|
|
456
|
+
# five-line existence gate earned the investigation's only gold match,
|
|
457
|
+
# while v2's full quote validator was overkill and cost 2.4x.
|
|
458
|
+
max_iterations: { from: probeRounds, default: 2 }
|
|
459
|
+
# The gate is an EXISTENCE check and it is deliberately satisfiable in one
|
|
460
|
+
# pass without lying: a hypothesis that genuinely cannot be executed
|
|
461
|
+
# against is recorded `unprobed`, which closes the gate for it and carries
|
|
462
|
+
# the claim forward to adjudication with lowered confidence. An
|
|
463
|
+
# unsatisfiable gate is the shape WP3 already hit once — `$LL_FAMILY` was
|
|
464
|
+
# never set, so the gate tested `hypotheses/.jsonl`, always failed, and the
|
|
465
|
+
# loop ran to `max_iterations` against a condition that meant nothing.
|
|
466
|
+
#
|
|
467
|
+
# Literal shell, no template markers: `validateShellCommand` rejects any
|
|
468
|
+
# command containing `{{` outright.
|
|
469
|
+
until_bash: |
|
|
470
|
+
FACTS="${LASTLIGHT_FACTS_BIN:-$(command -v lastlight-facts || echo /opt/lastlight/bin/lastlight-facts)}"
|
|
471
|
+
"$FACTS" probes --dir .lastlight/pr-review
|
|
472
|
+
|
|
35
473
|
- name: review
|
|
36
474
|
label: Review
|
|
475
|
+
# EXPLICIT, and `all_done` rather than the default `all_success`, because
|
|
476
|
+
# declaring `depends_on` anywhere in a workflow disables the synthesized
|
|
477
|
+
# linear chain for ALL of it (`buildDag`'s `anyDeclared`). Without these two
|
|
478
|
+
# lines `review` and `post-review` become root nodes and run in PARALLEL
|
|
479
|
+
# with the surveys — and with `all_success` they would instead be SKIPPED
|
|
480
|
+
# whenever the analysis phases skip, which is every deployment that has not
|
|
481
|
+
# enabled the pipeline. `all_done` is the rule the schema names for exactly
|
|
482
|
+
# this: a skipped node is not `succeeded`.
|
|
483
|
+
depends_on: [falsify]
|
|
484
|
+
trigger_rule: all_done
|
|
37
485
|
# pr-review: the PR procedure (primary). code-review: the finding-tier +
|
|
38
486
|
# what-to-check rubric. No `building` — pr-review is a pure code review; CI
|
|
39
487
|
# validates that the change builds/runs.
|
|
@@ -42,10 +490,126 @@ phases:
|
|
|
42
490
|
# findings (content only: skip? / summary / event / findings[]) to
|
|
43
491
|
# .lastlight/pr-review/findings.json. The first-class `post-review` action
|
|
44
492
|
# below reads that file and posts one formal review.
|
|
493
|
+
#
|
|
494
|
+
# §3b lever f4: a TWO-MODE brief. With the pipeline off, the prompt is the
|
|
495
|
+
# old skill nudge plus a curated Context section (this phase used to have no
|
|
496
|
+
# `prompt:` at all and rode `buildPhasePrompt`'s skills fallback, which
|
|
497
|
+
# serialises the ENTIRE render context — the byte-for-byte guarantee on that
|
|
498
|
+
# dump is deliberately retired; golden-pr-review.test.ts pins the new
|
|
499
|
+
# contract). With the pipeline on, the brief collapses to one fast
|
|
500
|
+
# INDEPENDENT pass — PR-level judgment only, no per-hunk re-derivation, no
|
|
501
|
+
# reading hypotheses/ (adjudicate is the fresh-context reader) — because six
|
|
502
|
+
# survey families + falsify have already done the deep work and a full
|
|
503
|
+
# second review here was measured pure waste (137s / $0.30 per case on
|
|
504
|
+
# Haiku, an APPROVE with zero findings while 41 hypotheses sat unread).
|
|
505
|
+
# It still writes findings.json: adjudicate seeds from it and post-review
|
|
506
|
+
# fails loudly without it.
|
|
507
|
+
prompt: prompts/review.md
|
|
45
508
|
skills: [pr-review, code-review]
|
|
46
509
|
model: "{{models.review}}"
|
|
47
510
|
variant: "{{variants.review}}"
|
|
48
511
|
|
|
512
|
+
# WP6c — the exit of the funnel. Everything before this phase APPENDS to
|
|
513
|
+
# `hypotheses/<family>.jsonl` and `probes/verdicts.jsonl`, and until now
|
|
514
|
+
# NOTHING READ EITHER: verified on a real case, 40 KB of obligations and 18+
|
|
515
|
+
# hypotheses ended in an APPROVE with zero posted findings against five gold.
|
|
516
|
+
# This is the only rung in the plan that can move recall.
|
|
517
|
+
#
|
|
518
|
+
# A SIBLING of `post-review`, not a link in its chain, and that placement is
|
|
519
|
+
# load-bearing. `trigger_rule` is per-node and applies to every dep, so
|
|
520
|
+
# `post-review: depends_on [review, adjudicate]` could not say "all_success
|
|
521
|
+
# w.r.t. review, all_done w.r.t. adjudicate" — it would have to relax to
|
|
522
|
+
# `all_done` and lose the invariant that a FAILED REVIEW MUST NOT POST, which
|
|
523
|
+
# is a worse bug than the one it would fix. Declared above `post-review`, so
|
|
524
|
+
# the sequential scheduler (ready[0], in declaration order) still runs it
|
|
525
|
+
# first; unreachable from `post-review`'s dep set, so it can never stop a
|
|
526
|
+
# review from being posted.
|
|
527
|
+
#
|
|
528
|
+
# WHAT IT MAY AND MAY NOT DO. It re-ranks, re-tiers, and demotes into the
|
|
529
|
+
# review body. It deletes ONLY when a probe transcript refutes the claim.
|
|
530
|
+
# That asymmetry is measured, not principled: `aacr-adjudicate.ts` scored two
|
|
531
|
+
# models against AACR-Bench's 1,505 valid / 640 invalid comments and NEITHER
|
|
532
|
+
# BEAT KEEPING EVERYTHING (F1 0.825 → 0.803 Haiku → 0.745 GLM). Haiku
|
|
533
|
+
# destroyed 131 valid comments to catch 98; precision barely moved, which is
|
|
534
|
+
# the signature of a filter that is not discriminating, only shrinking. The
|
|
535
|
+
# threshold sweep closes it — F1 is flat from t=0.0 to t=0.7 then collapses,
|
|
536
|
+
# so there is no operating point to tune toward. A cheap model asked "is this
|
|
537
|
+
# comment valid" is worse than useless here.
|
|
538
|
+
- name: adjudicate
|
|
539
|
+
label: Adjudicate
|
|
540
|
+
skills: [pr-review, code-review]
|
|
541
|
+
prompt: prompts/review-adjudicate.md
|
|
542
|
+
# Its OWN key, `models.review-adjudicate`, because this is a RANKING pass
|
|
543
|
+
# over an already-generated set — a different task from survey discovery
|
|
544
|
+
# (where Haiku beats Sonnet on recall) — so an overlay must be able to move
|
|
545
|
+
# it without also moving `review`. Unset, it falls through to
|
|
546
|
+
# `models.review`, preserving the old single-key behaviour byte-for-byte.
|
|
547
|
+
# The {{#if}} pair is load-bearing: a bare `{{models.review-adjudicate}}`
|
|
548
|
+
# renders EMPTY when unset, and `resolveModelVariant` then falls back to
|
|
549
|
+
# the DEFAULT model — not to `models.review`.
|
|
550
|
+
model: "{{#if models.review-adjudicate}}{{models.review-adjudicate}}{{/if}}{{#if !models.review-adjudicate}}{{models.review}}{{/if}}"
|
|
551
|
+
variant: "{{variants.review}}"
|
|
552
|
+
skip_if: "analysisEnabled != true"
|
|
553
|
+
depends_on: [review]
|
|
554
|
+
generic_loop:
|
|
555
|
+
# INSIDE the loop, where the schema reads it. At phase level zod strips
|
|
556
|
+
# the key and the policy silently reverts to `{retries: 0, then: fail}` —
|
|
557
|
+
# all six survey phases had it in the wrong place until 2026-08-22.
|
|
558
|
+
on_soft_failure: { retries: 1, then: complete }
|
|
559
|
+
max_iterations: 2
|
|
560
|
+
# The fresh-context adjudication AnyPoC recommends: it reads the
|
|
561
|
+
# hypothesis RECORDS, the quotes and the transcripts — not the survey's
|
|
562
|
+
# reasoning, which is what makes rejecting a false report possible at all
|
|
563
|
+
# (baseline agents fail to reject 96% of false reports when they can see
|
|
564
|
+
# the reasoning that produced them).
|
|
565
|
+
fresh_context: true
|
|
566
|
+
# The CONSERVATION gate. "Existence-plus-schema" was explicitly judged not
|
|
567
|
+
# enough: an adjudicator reading 30 hypotheses and writing 6 findings
|
|
568
|
+
# would have passed every other gate in this plan, and that is exactly v2
|
|
569
|
+
# — which "worked mechanically" and cost recall anyway. Every hypothesis
|
|
570
|
+
# id must appear with exactly one disposition, and a `dropped` one must
|
|
571
|
+
# name a transcript that EXISTS. Silent omission becomes impossible by
|
|
572
|
+
# construction rather than by instruction.
|
|
573
|
+
#
|
|
574
|
+
# Literal shell, no template markers: `validateShellCommand` rejects any
|
|
575
|
+
# command containing `{{` outright.
|
|
576
|
+
until_bash: |
|
|
577
|
+
FACTS="${LASTLIGHT_FACTS_BIN:-$(command -v lastlight-facts || echo /opt/lastlight/bin/lastlight-facts)}"
|
|
578
|
+
"$FACTS" findings --dir .lastlight/pr-review
|
|
579
|
+
|
|
580
|
+
# §D12's FLOOR, and the reason the gate above is a mechanism rather than a
|
|
581
|
+
# request. Reaching `max_iterations` without the condition is NOT a phase
|
|
582
|
+
# failure in this engine (phase-executor.ts) — the loop simply ends — so an
|
|
583
|
+
# adjudicator that never satisfied conservation would otherwise leave
|
|
584
|
+
# hypotheses silently unaccounted for, which is the one outcome the gate
|
|
585
|
+
# exists to prevent.
|
|
586
|
+
#
|
|
587
|
+
# `--repair` writes every uncovered hypothesis into findings.json at
|
|
588
|
+
# `internal` tier, and PROMOTES any `dropped` entry whose transcript does not
|
|
589
|
+
# exist back to `internal` — an unjustified deletion becomes a recorded
|
|
590
|
+
# non-deletion. It is idempotent, so on a run where the model DID satisfy the
|
|
591
|
+
# gate this phase is a no-op.
|
|
592
|
+
#
|
|
593
|
+
# Deterministic, model-free, and it exits 0 on every path: a phase that fails
|
|
594
|
+
# hard records no `assessedHeadShaByWorkflow` and hands `cron-review.yaml`
|
|
595
|
+
# something to re-dispatch every thirty minutes, forever.
|
|
596
|
+
- name: reconcile
|
|
597
|
+
label: Reconcile · the conservation floor
|
|
598
|
+
type: bash
|
|
599
|
+
skip_if: "analysisEnabled != true"
|
|
600
|
+
depends_on: [adjudicate]
|
|
601
|
+
# `all_done`: the floor must apply even when the adjudicator failed or was
|
|
602
|
+
# cut short — that is precisely when there is something to repair.
|
|
603
|
+
trigger_rule: all_done
|
|
604
|
+
timeout_seconds: 120
|
|
605
|
+
command: |
|
|
606
|
+
set -u
|
|
607
|
+
FACTS="${LASTLIGHT_FACTS_BIN:-$(command -v lastlight-facts || echo /opt/lastlight/bin/lastlight-facts)}"
|
|
608
|
+
if ! "$FACTS" findings --dir .lastlight/pr-review --repair; then
|
|
609
|
+
echo "reconcile: could not repair findings.json; it stands as the review phase wrote it"
|
|
610
|
+
fi
|
|
611
|
+
exit 0
|
|
612
|
+
|
|
49
613
|
# First-class, in-process submission (type: post-review → PhaseExecutor.
|
|
50
614
|
# runPostReview). Reads the agent's findings.json for the review *content*
|
|
51
615
|
# (skip? / summary / event / findings[]) and supplies everything else from
|
|
@@ -61,3 +625,6 @@ phases:
|
|
|
61
625
|
- name: post-review
|
|
62
626
|
label: Post inline review
|
|
63
627
|
type: post-review
|
|
628
|
+
# `all_success` (the default) is deliberate here where `review` uses
|
|
629
|
+
# `all_done`: a failed review must NOT post.
|
|
630
|
+
depends_on: [review]
|
|
@@ -244,8 +244,9 @@ vocabulary (Renovate's `rebase` label, a maintainer's `blocked`, a release label
|
|
|
244
244
|
all must survive untouched).
|
|
245
245
|
- **TRIVIAL** → add `dependency-trivial`; remove `dependency-functional` if
|
|
246
246
|
present. Also remove `requires-human` for now — the default trivial path lands
|
|
247
|
-
automatically. (STEP 3 re-adds `requires-human` in the
|
|
248
|
-
PR still can't land without a maintainer: auto-merge disabled on the repo
|
|
247
|
+
automatically. (STEP 3 re-adds `requires-human` in the two cases where a trivial
|
|
248
|
+
PR still can't land without a maintainer: auto-merge disabled on the repo, or a
|
|
249
|
+
required approving review this harness cannot supply.)
|
|
249
250
|
- **FUNCTIONAL** → add `dependency-functional` and `requires-human`; remove
|
|
250
251
|
`dependency-trivial` if present.
|
|
251
252
|
- **Impact, for a major only** → add exactly ONE of `dependency-major-low` /
|
|
@@ -353,6 +354,25 @@ STEP 3 — Act on the classification.
|
|
|
353
354
|
(squash) so GitHub lands it once the remaining requirement clears, and stop.
|
|
354
355
|
Do NOT direct-merge.
|
|
355
356
|
|
|
357
|
+
Then, for `blocked` ONLY, establish WHETHER the outstanding requirement is a
|
|
358
|
+
review — because that is the one kind nothing here can ever clear. `unstable`
|
|
359
|
+
and `unknown` resolve themselves once GitHub finishes; a branch rule demanding
|
|
360
|
+
an approval waits on a person indefinitely, and auto-merge armed behind it is
|
|
361
|
+
silence, not progress. Call `github_list_pull_request_reviews`: if NO review is
|
|
362
|
+
currently `APPROVED` (a review dismissed by a later push reads `DISMISSED` and
|
|
363
|
+
does not count), the block is the review requirement, and this trivial PR
|
|
364
|
+
cannot land without a maintainer. Treat that exactly like the
|
|
365
|
+
auto-merge-disabled case above — keep `dependency-trivial` (the bump IS safe),
|
|
366
|
+
add `requires-human` via `github_add_labels`, and post ONE brief comment saying
|
|
367
|
+
the update looks safe and auto-merge is armed, but the repo requires an
|
|
368
|
+
approving review, so a maintainer should approve or merge it. Same anti-repeat
|
|
369
|
+
discipline as everything else: skip the comment when `requires-human` was
|
|
370
|
+
already in the dispatch labels above, or when you can see you have already left
|
|
371
|
+
an equivalent one — this branch re-runs on every check-pass and every daily
|
|
372
|
+
cron, and the label is the durable signal. If a current `APPROVED` review IS
|
|
373
|
+
present, the block is something else (a required check that hasn't reported, an
|
|
374
|
+
unresolved conversation): leave it to auto-merge and stay silent.
|
|
375
|
+
|
|
356
376
|
STEP 3b — The audit comment, for an auto-merged MAJOR only.
|
|
357
377
|
{{#if dependencies.auditComment}}
|
|
358
378
|
When you auto-merged (or direct-merged) a **major** bump, post exactly ONE
|