lastlight-core 0.34.1 → 0.35.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 (70) hide show
  1. package/config/default.yaml +100 -138
  2. package/dist/config/config.d.ts +11 -0
  3. package/dist/config/config.js +93 -30
  4. package/dist/config/config.js.map +1 -1
  5. package/dist/engine/github/github.d.ts +42 -0
  6. package/dist/engine/github/github.js +41 -0
  7. package/dist/engine/github/github.js.map +1 -1
  8. package/dist/engine/github/review-poster.d.ts +16 -3
  9. package/dist/engine/github/review-poster.js +3 -3
  10. package/dist/engine/github/review-poster.js.map +1 -1
  11. package/dist/engine/github/review-summary.d.ts +2 -2
  12. package/dist/engine/github/review-summary.js +1 -1
  13. package/dist/engine/github/review-summary.js.map +1 -1
  14. package/dist/engine/pr-decisions.d.ts +7 -0
  15. package/dist/engine/pr-decisions.js +84 -97
  16. package/dist/engine/pr-decisions.js.map +1 -1
  17. package/dist/engine/pr-discussion.d.ts +23 -0
  18. package/dist/engine/pr-discussion.js +55 -0
  19. package/dist/engine/pr-discussion.js.map +1 -0
  20. package/dist/engine/pr-intent.d.ts +32 -0
  21. package/dist/engine/pr-intent.js +55 -0
  22. package/dist/engine/pr-intent.js.map +1 -0
  23. package/dist/engine/pr-state.d.ts +10 -2
  24. package/dist/engine/pr-state.js +14 -2
  25. package/dist/engine/pr-state.js.map +1 -1
  26. package/dist/engine/review-spec.d.ts +2 -87
  27. package/dist/engine/review-spec.js +2 -445
  28. package/dist/engine/review-spec.js.map +1 -1
  29. package/dist/engine/review-triage.d.ts +27 -9
  30. package/dist/engine/review-triage.js +20 -7
  31. package/dist/engine/review-triage.js.map +1 -1
  32. package/dist/evals-api.d.ts +7 -0
  33. package/dist/evals-api.js +21 -0
  34. package/dist/evals-api.js.map +1 -1
  35. package/dist/sandbox/sandbox.d.ts +25 -0
  36. package/dist/sandbox/sandbox.js +97 -14
  37. package/dist/sandbox/sandbox.js.map +1 -1
  38. package/dist/workflows/handlers/fanout.d.ts +17 -4
  39. package/dist/workflows/handlers/fanout.js +68 -31
  40. package/dist/workflows/handlers/fanout.js.map +1 -1
  41. package/dist/workflows/handlers/host-repo-dir.d.ts +38 -0
  42. package/dist/workflows/handlers/host-repo-dir.js +55 -0
  43. package/dist/workflows/handlers/host-repo-dir.js.map +1 -0
  44. package/dist/workflows/handlers/post-review.d.ts +9 -1
  45. package/dist/workflows/handlers/post-review.js +39 -16
  46. package/dist/workflows/handlers/post-review.js.map +1 -1
  47. package/dist/workflows/handlers/survey-units.d.ts +323 -0
  48. package/dist/workflows/handlers/survey-units.js +1211 -0
  49. package/dist/workflows/handlers/survey-units.js.map +1 -0
  50. package/dist/workflows/runner.js +42 -15
  51. package/dist/workflows/runner.js.map +1 -1
  52. package/package.json +9 -9
  53. package/skills/code-review/SKILL.md +2 -3
  54. package/skills/pr-review/references/findings-schema.md +4 -4
  55. package/workflows/pr-review.yaml +491 -271
  56. package/workflows/prompts/review-falsify.md +17 -9
  57. package/workflows/prompts/review-select.md +113 -0
  58. package/workflows/prompts/review-site-summary.md +48 -0
  59. package/workflows/prompts/review-site.md +305 -0
  60. package/workflows/prompts/review.md +0 -60
  61. package/workflows/prompts/survey-unit.md +60 -0
  62. package/skills/adjudicate-pass/SKILL.md +0 -149
  63. package/skills/survey-pass/SKILL.md +0 -139
  64. package/workflows/prompts/review-adjudicate.md +0 -498
  65. package/workflows/prompts/survey-contract.md +0 -121
  66. package/workflows/prompts/survey-enforcement.md +0 -105
  67. package/workflows/prompts/survey-security.md +0 -162
  68. package/workflows/prompts/survey-spec.md +0 -131
  69. package/workflows/prompts/survey-state.md +0 -152
  70. package/workflows/prompts/survey-tests.md +0 -99
@@ -18,12 +18,11 @@ botName: last-light
18
18
 
19
19
  models:
20
20
  default: anthropic/claude-sonnet-4-6
21
- # The five `pr-review.yaml` survey branches and `falsify`. SET, not an
22
- # example — see the note below: this is the measured RECALL winner for
23
- # hypothesis generation, not a cost downgrade, and leaving it unset silently
24
- # ran six Sonnet phases under every number the pipeline was tuned on. A
21
+ # The unit survey (`survey-units`), and the fall-through of `review-site`
22
+ # and `review-falsify`. SET, not an example — see the note below: this is the
23
+ # measured RECALL winner for hypothesis generation, not a cost downgrade. A
25
24
  # deployment whose `models.default` points at a non-Anthropic provider MUST
26
- # override this in its overlay `config.yaml`, or these six phases reach for a
25
+ # override this in its overlay `config.yaml`, or these phases reach for a
27
26
  # provider it has no key for.
28
27
  review-survey: anthropic/claude-haiku-4-5-20251001
29
28
  # The `triage` phase of `pr-review.yaml` — "how much review is this push
@@ -38,9 +37,11 @@ models:
38
37
  # screener: anthropic/claude-haiku-4-5-20251001 # the prompt-injection screener
39
38
  # diagnose: anthropic/claude-haiku-4-5-20251001 # the CI-failure classifier
40
39
  # pr-fix-retry: anthropic/claude-opus-4-8 # used above fix.escalateModelAfterAttempt
41
- # review-adjudicate: anthropic/claude-sonnet-4-6 # the adjudication pass
42
40
  # review-summary: openai/gpt-5.4-mini # post-review's summary, written after the caps
43
41
  # review-falsify: anthropic/claude-haiku-4-5-20251001 # the probe oracle
42
+ # review-site: anthropic/claude-haiku-4-5-20251001 # a site investigator
43
+ # review-site-pair: opencode/deepseek-v4-flash # a second investigator per site (opt-in)
44
+ # review-select: anthropic/claude-sonnet-4-6 # the sites engine's selection pass
44
45
  # A per-task entry wins over `default`. `classifier`/`screener` are the cheap
45
46
  # one-shot helpers (src/engine/llm.ts); when unset they fall back to the first
46
47
  # configured provider's fast model, NOT `default`.
@@ -54,47 +55,43 @@ models:
54
55
  # each fix run costs one extra call at the default model until you pin it.
55
56
  #
56
57
  # `review-survey` is SET above, and it is the one entry in this block that is
57
- # not an example. It is the key the five survey branches of `pr-review.yaml`
58
- # declare (`model: "{{models.review-survey}}"`, one per obligation family),
59
- # and the `falsify` phase's fall-through.
58
+ # not an example. It is the model of `survey-units` (one call per unit), and
59
+ # the fall-through of `review-site` and `review-falsify`.
60
60
  #
61
- # Pinning it to Haiku 4.5 is NOT a cost downgrade, and that is the unusual
62
- # part: on review RECALL, Haiku 4.5 BEATS Sonnet 4.6 on two independent evals
63
- # — 41.2% vs 22.1% on the Martian corpus. It is the better model for
64
- # HYPOTHESIS GENERATION, which is what a survey branch does; its price is
65
- # merely what makes a five-way fan-out affordable inside the pipeline's 2–3x
66
- # budget. It is a different question from the SAYING phases (`review`,
67
- # `adjudicate`), which are not pinned here.
61
+ # Pinning it to Haiku 4.5 is NOT a cost downgrade: on review RECALL, Haiku
62
+ # 4.5 BEAT Sonnet 4.6 on two independent evals — 41.2% vs 22.1% on the
63
+ # Martian corpus — for HYPOTHESIS GENERATION, which is what a survey does.
64
+ # It is a different question from the SAYING phases (`review`, `select`),
65
+ # which are not pinned here.
68
66
  #
69
67
  # It was deliberately left unset for a long time, for the `diagnose` reason
70
68
  # above — these are Anthropic model ids, and a deployment that overrode only
71
- # `default` to another provider would find six phases reaching for a provider
72
- # it has no key for. That reason has not gone away; it is now handled the
73
- # other way round, because the cost of the unset default turned out to be
74
- # worse. Unset, all six fell through to `default` (Sonnet) SILENTLY, so an
75
- # operator who enabled the pipeline ran a configuration no measurement in
76
- # `docs/plans/deterministic-pr-levers.md` describes — every recall, cost and
77
- # latency number on record assumes Haiku surveys. A wrong-provider failure is
78
- # loud on the first run; a quietly-different model is not.
69
+ # `default` to another provider would find the survey reaching for a provider
70
+ # it has no key for. That reason has not gone away; it is handled the other
71
+ # way round, because unset, the survey fell through to `default` SILENTLY and
72
+ # an operator who enabled the pipeline ran a configuration no measurement
73
+ # describes. A wrong-provider failure is loud on the first run; a
74
+ # quietly-different model is not.
79
75
  #
80
76
  # SO: a non-Anthropic deployment must override this key in its overlay
81
77
  # `config.yaml` (a cheap, fast model of its own provider), exactly as it
82
78
  # already overrides `models.default`.
83
79
  #
84
80
  # `review-falsify` is the ORACLE's own key — the one phase that runs code.
85
- # Unset, it falls through to `review-survey` (its template is the same
86
- # `{{#if}}` pair `adjudicate` uses, so an unset key lands on the survey model
87
- # and not on `default`), which is exactly the behaviour before the key
88
- # existed. It exists so the oracle's model can be moved on its own: it was
89
- # hard-wired to `review-survey`, so asking "is a cheap model good enough at
90
- # WRITING AND RUNNING a probe?" meant moving all five survey branches too —
91
- # two variables, and therefore not a runnable experiment.
81
+ # Unset, it falls through to `review-survey` (an `{{#if}}` pair, so an unset
82
+ # key lands on the survey model and not on `default`). Not attached yet —
83
+ # see `review.analysis.probes`.
92
84
  #
93
- # `review-adjudicate` is the adjudicate phase's own key in `pr-review.yaml` —
94
- # the RANKING pass over what the surveys found, a different task from survey
95
- # discovery, so it can be moved independently of `models.review`. Unset, it
96
- # falls through to `models.review` (the phase's template guards it), so a
97
- # deployment that never sets it keeps today's behaviour exactly.
85
+ # `review-site` and `review-select` are the `sites` review engine's keys: the
86
+ # site investigators fall through to `review-survey`, and `select` — the
87
+ # one call that merges and orders their findings — to `models.review`.
88
+ # Measured (docs/plans/pr-review-units-sites.md): cheap investigators
89
+ # (`openai/gpt-6-luna`, `opencode/deepseek-v4-flash`, medium) beat Haiku on
90
+ # recall and posted precision at ¼–½ the cost. Left UNSET here for the
91
+ # `diagnose` reason — a default must be a provider every deployment has a key
92
+ # for — so pin it in your overlay. `review-site-pair` is OFF unless set: it
93
+ # puts a second investigator, on this model, on every selected site
94
+ # (`review.analysis.siteTop`), and `select` merges what the two agree on.
98
95
 
99
96
  # Provider endpoints. Ships EMPTY — every provider keeps the endpoint baked into
100
97
  # the registry (packages/shared/src/providers.ts), which is exactly today's
@@ -444,36 +441,21 @@ review:
444
441
  # is absent from the template context rather than present-and-empty. Each
445
442
  # stage lands dark and is switched on per deployment once it is measured.
446
443
  #
447
- # What `enabled: true` adds today (WP0, the `spec` axis):
448
- # - `{{prBody}}` + `{{linkedIssues}}` — the PR body and the issues it closes
449
- # (`closingIssuesReferences`), neither of which reached a prompt before.
450
- # - `{{specObligations}}` — one obligation per acceptance criterion found in
451
- # the issue/PR body, each naming BOTH ENDS of the mechanism: the criterion
452
- # itself, and the changed files that could satisfy it with `found: false`.
453
- # A one-ended seed measures WORSE than no seed (IRIS ablation: -3), which
454
- # is why the second end is the mechanical changed-file list and never
455
- # prose.
456
- # - the split verdict: `findings.json` may carry
457
- # `verdict: { spec, standards }` and a `fail` on either axis stops the
458
- # review being an APPROVE, so a clean standards pass can no longer hide a
459
- # spec miss (issue #271 fix 7).
444
+ # What `enabled: true` adds: `facts` → `seed` → the unit survey → the `sites`
445
+ # review engine → `reconcile`, which together write the findings.json that
446
+ # `post-review` posts (the path is spelled out at `siteConcurrency` below).
447
+ # The `review` phase then runs only on a light re-review. Spec obligations —
448
+ # one per acceptance criterion in the linked issue / PR body, each naming
449
+ # BOTH ENDS (the criterion and the changed files that could satisfy it) —
450
+ # are cut into units with the facts-derived ones.
460
451
  #
461
452
  # OPERATOR-ONLY — unlike every other `review:` key, a repo may not set this.
462
453
  # It is spend, with no "more conservative" direction to clamp towards.
463
- # What `enabled: true` additionally adds from WP3 (the facts-derived families):
464
- # - a `facts` phase writing .lastlight/pr-review/facts.json (no model spend)
465
- # - a `seed` phase turning it into obligations.json + one rendered block per
466
- # family, each naming BOTH ENDS of a mechanism
467
- # - five survey branches, one per live family, each appending to its OWN
468
- # hypotheses/<family>.jsonl — no pass ever reads or rewrites another's,
469
- # which makes consensus collapse impossible by construction rather than
470
- # by instruction
471
- #
472
- # Neither phase can run where `lastlight-facts` is not resolvable. That is
454
+ # No analysis phase can run where `lastlight-facts` is not resolvable. That is
473
455
  # true of the SANDBOX IMAGE today (WP2 is what installs it); the eval harness
474
456
  # runs `--sandbox none` on the host, where it is. Set LASTLIGHT_FACTS_BIN to
475
457
  # point at a specific build. A missing binary degrades to a `coverage: "none"`
476
- # envelope and the survey phases say so — it never fails the run.
458
+ # envelope and the downstream phases say so — it never fails the run.
477
459
  analysis:
478
460
  enabled: false
479
461
  # A SAFETY BOUND, not a budget — it should never bind on a real PR. The
@@ -493,9 +475,9 @@ review:
493
475
  maxSpecObligations: 40
494
476
  # The five facts-derived families are bounded PER FAMILY, not pooled:
495
477
  # contract 12, enforcement 12, state 8, security 8, tests 8 (FAMILY_CAPS in
496
- # packages/code-facts/src/seed.ts). Each family's obligations feed exactly
497
- # ONE survey branch, so the cost is per branch and a pooled cap never bound
498
- # the fattest one; and cross-family ranking prices incommensurable mechanism
478
+ # packages/code-facts/src/seed.ts). Measured on the (since removed) agent
479
+ # survey, where each family fed one branch: a pooled cap never bound the
480
+ # fattest one, and cross-family ranking prices incommensurable mechanism
499
481
  # classes against each other — measured, `contract` minted 89 across the
500
482
  # eight gate cases while `security` minted 3, and the pool went to contract.
501
483
  #
@@ -504,7 +486,10 @@ review:
504
486
  # that raising one ceiling is a bounded act rather than an unbounded one.
505
487
  maxObligations: 48
506
488
 
507
- # Which obligation BLOCK the six families are handed. `full` | `minimal`.
489
+ # Which obligation contract `lastlight-facts seed` records. `full` |
490
+ # `minimal`. Today it only changes how strictly the `discharge` post-check
491
+ # in `units-ingest` grades; the history below was measured on the (since
492
+ # removed) agent survey.
508
493
  #
509
494
  # This is a CONTROL, not a dial. On 2026-08-23 the block gained a mandatory
510
495
  # discharge contract (a `discharge` field the row can actually hold a code
@@ -535,51 +520,6 @@ review:
535
520
  # telemetry (and the clean-discharge demotion it enables at the posting
536
521
  # boundary), at the cost of the verification-report volume above.
537
522
  obligationContract: minimal
538
- # What `adjudicate` is handed, and what shape it writes back (#399).
539
- #
540
- # legacy — the shipped phase. The prompt names the files and the model
541
- # shells out to assemble them, then writes a `tier` and a
542
- # `confidence` per finding.
543
- # dossier — a deterministic `dossier` phase renders every record the
544
- # phase needs and the harness attaches it, and the model writes
545
- # typed attributes (`claim` / `category` / `fix`) from which a
546
- # pure function derives the tier. `confidence` is not asked for.
547
- #
548
- # ONE key for both halves deliberately: they move the same phase's measured
549
- # surface — its input and its output — so shipping them together costs one
550
- # comparability break with the archive instead of two, and one arm validates
551
- # both.
552
- #
553
- # What it targets, measured on the 8-case probes arm: adjudicate spends 137
554
- # bash calls across 8 adjudications (35 turns, 30 of them bash on the stress
555
- # case) re-deriving records the harness already holds — about a third of
556
- # case cost — and makes its actual judgement at the end of that transcript.
557
- #
558
- # jev — implies `dossier` (same rendering, same typed output) and
559
- # additionally runs `jev-classify`: one TypeSafe `systemOne`
560
- # call PER HYPOTHESIS (not per finding — hypotheses vastly
561
- # outnumber findings, and per-hypothesis is the volume a
562
- # System-1 primitive is for), asking only the category axis
563
- # measured at AUC 0.897 (never correctness, measured dead at
564
- # AUC 0.534). Its category is rendered into the dossier as an
565
- # ADVISORY line — Sonnet still writes every disposition
566
- # itself. Measured 2026-09-22: 260 hypotheses / 8 cases,
567
- # 83.6% agreement with Sonnet's own call on identical
568
- # evidence, $0.0053. Weakest on the rarest, highest-stakes
569
- # categories (`defect` 33%, `correctness-risk` 40% recall
570
- # against Sonnet) — that is why it annotates rather than
571
- # decides. Needs `TYPESAFE_KEY` (or `TYPESAFE_API_KEY`); its
572
- # absence degrades the phase to "no annotation", never a
573
- # failed run.
574
- #
575
- # `legacy` until an arm has run for each. An unrecognised value lands there
576
- # too.
577
- adjudicate: legacy
578
- # The TypeSafe model `jev-classify` calls, under `adjudicate: "jev"`.
579
- # `null` = the CLI's own default (`TYPESAFE_MODEL` env, else `jev-latest`).
580
- # Kept out of the `models:` map above — TypeSafe is a distinct provider
581
- # from the `provider/model` chat models that map resolves.
582
- jevModel: null
583
523
 
584
524
  # Which D2 minting rules `lastlight-facts seed` runs beyond the original
585
525
  # four. A comma-list; the valid tokens are `all-in-diff` (contract
@@ -594,35 +534,57 @@ review:
594
534
  # typo'd arm is loud rather than silently running baseline.
595
535
  mint: all-in-diff,registrations
596
536
 
597
- # RECORDED, NOT CONSUMED. The fan-out's branch list in `pr-review.yaml` is
598
- # the authority (five branches; `tests` has no seeder and no branch), and
599
- # nothing reads this key to pick or drop branches — it exists so the value
600
- # an operator believed they set is on the record. A previous design DID
601
- # consume a count (defaulted to 3 against six families, never recording
602
- # which three ran), which is exactly why the branch list is now the one
603
- # authority.
604
- surveyPasses: 6
605
537
 
606
- # How many of those families run AT ONCE (WP11c).
538
+ # How many `site-review` investigators run AT ONCE.
607
539
  #
608
540
  # A CEILING the run clamps again per backend, never the effective value. On
609
541
  # the shipped default backend (gondolin) each agent session is a QEMU
610
542
  # micro-VM inside the harness process, so it pins to 1 and this key changes
611
- # nothing at all until that is measured; `none` and `docker` take it as
612
- # written.
613
- #
614
- # Six because the six families write six disjoint, append-only
615
- # `hypotheses/<family>.jsonl` and never read each other's — there was never
616
- # an ordering constraint between them, only a scheduler that ran one DAG
617
- # node at a time. Chained, they were 851s of a 29-minute review (49% of the
618
- # wall clock); concurrent, they cost the slowest single family.
619
- #
620
- # Lower it to bound provider rate-limit pressure or memory, NOT to bound
621
- # spend: six passes cost the same in tokens either way.
622
- surveyConcurrency: 6
543
+ # nothing at all until that is measured; `none` takes it up to 16 (a
544
+ # paired top-8 fan-out) and `docker` up to 6. Lower it to bound provider rate-limit pressure or memory, NOT to
545
+ # bound spend: the investigators cost the same in tokens either way.
546
+ # `surveyConcurrency` is still read as its old name.
547
+ siteConcurrency: 6
548
+
549
+ # How many vote-ranked sites get an investigator (1–8). Top 5 put 16 of 25
550
+ # gold-mapped rows inside a selected site on the Martian audit, top 8 put
551
+ # 21, for ~2 more investigators per PR. Setting `models.review-site-pair`
552
+ # puts a SECOND investigator on every selected site (a different model:
553
+ # two models' blind spots are disjoint), so the sessions double.
554
+ siteTop: 5
555
+
556
+ # The analysis path (docs/plans/pr-review-units-sites.md): `facts` and
557
+ # `seed`, then the unit survey — `lastlight-facts units` (deterministic
558
+ # units: a symbol, a module, the PR), ONE bounded, non-agentic model call
559
+ # per unit on `models.review-survey`, and `lastlight-facts units-ingest`,
560
+ # which writes `hypotheses/<family>.jsonl` — then the `sites` engine: the
561
+ # rows are only a VOLUME signal, `lastlight-facts sites --plan` ranks the
562
+ # places they point at (distinct-unit votes, span ≤ 60, test files
563
+ # skipped), one investigator per top-5 site writes grounded findings (the
564
+ # `site-review` fan-out, model `models.review-site`, else review-survey),
565
+ # `merge` pools them and `select` (one agent call, model
566
+ # `models.review-select`, else review) merges duplicates and orders them by
567
+ # importance. Every row is filed `internal`. `survey-units` reads and writes
568
+ # the workspace from the harness, so config load REFUSES `enabled: true` on
569
+ # the kubernetes backend (no host checkout).
570
+ # Unit calls in flight at once in `survey-units`. No backend
571
+ # clamp — they are HTTP requests from the harness, not sandboxes — so lower
572
+ # it only to ease provider rate limits. Spend is the same either way.
573
+ surveyUnitConcurrency: 16
574
+ # The WHOLE-PHASE deadline on `survey-units`, in seconds — one
575
+ # AbortController over every unit call. A unit not finished by then is
576
+ # recorded `ok: false` ("phase deadline") and `units-ingest` records each
577
+ # obligation it owned as unanswered; the phase itself still succeeds, so a
578
+ # slow provider degrades the survey rather than failing the review.
579
+ surveyUnitsTimeoutSeconds: 600
623
580
 
624
581
  # ── WP4: `prepare` (the affordance) + `falsify` (the oracle) ──────────────
625
582
  #
583
+ # NOT ATTACHED to the sites engine yet: the three probe phases skip whatever
584
+ # this says, because nothing reads their output
585
+ # (docs/plans/pr-review-units-sites.md, stage 5). The keys stay so the
586
+ # re-attachment is a wiring change, not a config one.
587
+ #
626
588
  # A SECOND switch under an already-gated block, and TRI-STATE — the middle
627
589
  # value is the point of it.
628
590
  #
@@ -633,9 +595,8 @@ review:
633
595
  # with `--no-install`, so it writes a real `env.json`
634
596
  # (`install: "skipped"`, `installed` still read off the
635
597
  # filesystem) and `falsify` gets the fact its prompt is written
636
- # against: it already branches on `installed: false`, records
637
- # what it cannot run as `unprobed` with a reason, and those
638
- # hypotheses SURVIVE to adjudication. The oracle was written
598
+ # against: it already branches on `installed: false` and
599
+ # records what it cannot run as `unprobed` with a reason. The oracle was written
639
600
  # for the zero-install world; one shared gate was all that kept
640
601
  # it out of one. Seconds of CPU, no package manager, no test
641
602
  # suite, no `postinstall` from a pull request head.
@@ -695,6 +656,12 @@ review:
695
656
  # five-line existence gate, not a validator — v2's full quote validator was
696
657
  # overkill and cost 2.4x for a worse result.
697
658
  probeRounds: 2
659
+ # At most this many hypotheses go in front of `falsify`, `null` for no cap.
660
+ # `lastlight-facts probe-plan` derives the owed set (a derived-Critical row,
661
+ # or a survey's own `needsProbe`), ranks it and cuts it here. Provisional:
662
+ # under the unit survey 16–25 rows were owed on the 1587 cases. The
663
+ # micro-falsify eval is what should move this number.
664
+ maxProbes: 8
698
665
  # The WHOLE-PHASE ceiling on `falsify`, across every round. It had none at
699
666
  # all until the oracle could run without an install, and `probeRounds` was
700
667
  # never a budget: a round count bounds how many times the loop may go round,
@@ -703,11 +670,6 @@ review:
703
670
  # construction (a differential `git` run, a copied pure function under plain
704
671
  # `node`) and whose real cost is model latency.
705
672
  falsifyTimeoutSeconds: 600
706
- # The WHOLE-PHASE ceiling on `jev-classify`, under `adjudicate: "jev"`.
707
- # Each call is a TypeSafe `systemOne` round trip (~100ms typically) but the
708
- # phase makes one per hypothesis and a case can carry dozens; 120s covers
709
- # a slow provider day without threatening the falsify-sized budget above.
710
- jevTimeoutSeconds: 120
711
673
  # The attention boundary (WP6b). Preserving internal recall and spending a
712
674
  # human's attention are two different budgets; conflating them is how a
713
675
  # recall-first reviewer becomes unreadable.
@@ -597,6 +597,17 @@ export declare function loadConfig(): LastLightConfig;
597
597
  * `tests/config.test.ts` pins the two together.
598
598
  */
599
599
  export declare function defaultRouteConfig(): RouteConfig;
600
+ /**
601
+ * `review.analysis` needs a workspace the HARNESS can read and write: the
602
+ * in-process `survey-units` phase reads `units.json` from the host checkout and
603
+ * writes one response per unit back into it for the sandboxed `units-ingest`.
604
+ * A backend with no host checkout ({@link HOST_READABLE_WORKSPACE}, i.e.
605
+ * `kubernetes`) would survey nothing on every review, so the combination is
606
+ * refused at startup, naming both keys — a boot error an operator sees once
607
+ * beats a degraded review on every run. (The repo layer cannot reach this:
608
+ * `review.analysis` is operator-only.)
609
+ */
610
+ export declare function assertReviewAnalysisSupported(enabled: boolean, backend: SandboxBackend): void;
600
611
  export declare function parseOtelCollectorHostsFromEnv(env?: NodeJS.ProcessEnv): string[];
601
612
  export declare function resolveModel(models: ModelConfig, taskType: string): string;
602
613
  export declare function resolveVariant(variants: VariantConfig, taskType: string): string | undefined;
@@ -9,6 +9,7 @@ import { DEFAULT_REPO_CONFIG_ALLOW_KEYS, } from "lastlight-shared/repo-config-sc
9
9
  import { isPgDriver, isPostgresUrl, redactDbUrl, PG_DRIVERS, } from "lastlight-shared/database-url";
10
10
  import { providerOverridesFromEnv, } from "lastlight-shared/providers";
11
11
  import { installProviderOverrides } from "./provider-registry.js";
12
+ import { HOST_READABLE_WORKSPACE } from "../workflows/handlers/host-repo-dir.js";
12
13
  import { logger } from "../logging/logger.js";
13
14
  const log = logger("config");
14
15
  /**
@@ -50,7 +51,7 @@ function loadDotEnv(path) {
50
51
  // compiles — has to name their shape and their shipped defaults. Imported for
51
52
  // in-file use and re-exported so `../config/config.js` stays the one import
52
53
  // surface for the runtime config shape.
53
- import { DIAGNOSIS_CLASSES, coerceAdjudicateMode, coerceProbeMode, defaultDependenciesConfig, defaultFixConfig, defaultReviewPolicy, isDependencyImpact, isDiagnosisClass, isReviewTrigger, } from "lastlight-shared/config-types";
54
+ import { DIAGNOSIS_CLASSES, coerceProbeMode, defaultDependenciesConfig, defaultFixConfig, defaultReviewPolicy, isDependencyImpact, isDiagnosisClass, isReviewTrigger, } from "lastlight-shared/config-types";
54
55
  export { defaultDependenciesConfig, defaultFixConfig, defaultNotificationsConfig, defaultReviewPolicy, } from "lastlight-shared/config-types";
55
56
  export { DEFAULT_REPO_CONFIG_ALLOW_KEYS } from "lastlight-shared/repo-config-schema";
56
57
  let currentConfig;
@@ -234,6 +235,10 @@ function normalizeAutonomyStages(raw) {
234
235
  }
235
236
  return out;
236
237
  }
238
+ /** `review.analysis.siteTop`: an integer 1–8, else the packaged default. */
239
+ function siteTopOrDefault(raw, fallback) {
240
+ return typeof raw === "number" && Number.isInteger(raw) && raw >= 1 && raw <= 8 ? raw : fallback;
241
+ }
237
242
  /**
238
243
  * The budget bounds. Every leaf is `nonNegativeNumber` + the packaged value:
239
244
  * `0` is a real setting ("refuse everything"), while a negative or non-numeric
@@ -303,7 +308,7 @@ export function withReviewDurations(policy, operator) {
303
308
  seedTimeoutSeconds: operator.analysis.seedTimeoutSeconds,
304
309
  reconcileTimeoutSeconds: operator.analysis.reconcileTimeoutSeconds,
305
310
  falsifyTimeoutSeconds: operator.analysis.falsifyTimeoutSeconds,
306
- jevTimeoutSeconds: operator.analysis.jevTimeoutSeconds,
311
+ surveyUnitsTimeoutSeconds: operator.analysis.surveyUnitsTimeoutSeconds,
307
312
  },
308
313
  };
309
314
  }
@@ -335,6 +340,28 @@ function applyDeprecatedGateAlias(layer, label) {
335
340
  gateTimeoutSeconds: legacy,
336
341
  });
337
342
  }
343
+ /**
344
+ * `review.analysis.surveyConcurrency`, the old name of `siteConcurrency`
345
+ * (it bounded the agent survey fan-out, removed with it), applied to ONE layer
346
+ * in place before the merge — as {@link applyDeprecatedGateAlias} does, and for
347
+ * the same reason: `default.yaml` carries the new name, so an alias resolved
348
+ * after the merge would always lose to the packaged value.
349
+ */
350
+ function applySiteConcurrencyAlias(layer, label) {
351
+ const review = layer && isPlainObject(layer.review) ? layer.review : undefined;
352
+ const analysis = review && isPlainObject(review.analysis) ? review.analysis : undefined;
353
+ if (!analysis || !("surveyConcurrency" in analysis))
354
+ return;
355
+ const legacy = analysis.surveyConcurrency;
356
+ delete analysis.surveyConcurrency;
357
+ if (analysis.siteConcurrency !== undefined)
358
+ return;
359
+ analysis.siteConcurrency = legacy;
360
+ log.warn("review.analysis.surveyConcurrency is deprecated — mapped to siteConcurrency; rename it", {
361
+ layer: label,
362
+ siteConcurrency: legacy,
363
+ });
364
+ }
338
365
  /**
339
366
  * The configured HOLD label, with the packaged default when config isn't loaded
340
367
  * yet (unit tests) — see {@link LastLightConfig.holdLabel} and {@link HOLD_LABEL}.
@@ -452,6 +479,7 @@ export function loadConfig() {
452
479
  overlayRaw = readYamlFile(join(overlayDir, "config.yaml"), false);
453
480
  }
454
481
  applyDeprecatedGateAlias(overlayRaw, "overlay");
482
+ applySiteConcurrencyAlias(overlayRaw, "overlay");
455
483
  // Build the env layer once: a partial config tree in the same shape as the
456
484
  // YAML layers. This is the single place that maps env vars onto config paths
457
485
  // (LASTLIGHT_MODELS → models.*, legacy OPENCODE_* aliases, …). Once built,
@@ -464,6 +492,7 @@ export function loadConfig() {
464
492
  env: envLayer,
465
493
  });
466
494
  const fileCfg = normalizeFileConfig(mergedRaw);
495
+ assertReviewAnalysisSupported(fileCfg.review.analysis.enabled, fileCfg.sandbox.backend);
467
496
  const stateDir = resolve(stringEnv("STATE_DIR", "./data"));
468
497
  const models = fileCfg.models;
469
498
  const model = models.default;
@@ -633,7 +662,7 @@ function normalizeFileConfig(raw) {
633
662
  const exploreRaw = isPlainObject(raw.explore) ? raw.explore : {};
634
663
  const reviewRaw = isPlainObject(raw.review) ? raw.review : {};
635
664
  const analysisRaw = isPlainObject(reviewRaw.analysis) ? reviewRaw.analysis : {};
636
- warnRemovedBoundaryKeys(analysisRaw);
665
+ warnRemovedAnalysisKeys(analysisRaw);
637
666
  const triageRaw = isPlainObject(reviewRaw.triage) ? reviewRaw.triage : {};
638
667
  const autonomyRaw = isPlainObject(raw.autonomy) ? raw.autonomy : {};
639
668
  const fixRaw = isPlainObject(raw.fix) ? raw.fix : {};
@@ -795,11 +824,20 @@ function normalizeFileConfig(raw) {
795
824
  // the same rule. A non-string falls back to the default (""), which is
796
825
  // the baseline arm — the direction every switch in this block fails.
797
826
  mint: typeof analysisRaw.mint === "string" ? analysisRaw.mint.trim() : reviewDefaults.analysis.mint,
798
- surveyPasses: nonNegativeNumber(analysisRaw.surveyPasses) ?? reviewDefaults.analysis.surveyPasses,
799
- // WP11c. A CEILING the run clamps again per backend, so an overlay that
800
- // asks for six on gondolin still gets one — the operator's ask is not the
827
+ // A CEILING the run clamps again per backend, so an overlay that asks for
828
+ // six on gondolin still gets one — the operator's ask is not the
801
829
  // effective value and the run logs when the host overrides it.
802
- surveyConcurrency: nonNegativeNumber(analysisRaw.surveyConcurrency) ?? reviewDefaults.analysis.surveyConcurrency,
830
+ // `surveyConcurrency`, its old name, is mapped onto it per layer
831
+ // (`applySiteConcurrencyAlias`).
832
+ siteConcurrency: nonNegativeNumber(analysisRaw.siteConcurrency) ?? reviewDefaults.analysis.siteConcurrency,
833
+ // `sites --plan --top` refuses anything outside 1–8 (the fan-out's
834
+ // static branches), so a bad value falls back here instead of failing
835
+ // every review's plan.
836
+ siteTop: siteTopOrDefault(analysisRaw.siteTop, reviewDefaults.analysis.siteTop),
837
+ // No backend clamp, unlike `siteConcurrency`: unit calls are in-process
838
+ // HTTP requests, not sandboxes, so this bounds rate-limit pressure only.
839
+ // Zero would stall the phase, so it floors at one.
840
+ surveyUnitConcurrency: Math.max(1, nonNegativeNumber(analysisRaw.surveyUnitConcurrency) ?? reviewDefaults.analysis.surveyUnitConcurrency),
803
841
  // WP4. `probes` is TRI-STATE (`off` | `static` | `full`) and the other
804
842
  // three still read `=== true`, for the same reason `enabled` does: each
805
843
  // buys the operator's compute, and two of them — `full` (which installs a
@@ -810,12 +848,6 @@ function normalizeFileConfig(raw) {
810
848
  // `"static"` (so no existing deployment gains an install by upgrading),
811
849
  // and every other value — including `"true"` and `"yes"` — is `"off"`.
812
850
  probes: coerceProbeMode(analysisRaw.probes),
813
- // #399. Selects what `adjudicate` is handed and what shape it writes
814
- // back, in ONE key because both halves move the same phase's measured
815
- // surface. Only the literal `"dossier"` moves a deployment; everything
816
- // else is the shipped phase, which is the direction the whole block
817
- // fails.
818
- adjudicate: coerceAdjudicateMode(analysisRaw.adjudicate),
819
851
  probeLifecycleScripts: analysisRaw.probeLifecycleScripts === true,
820
852
  probeTypecheck: analysisRaw.probeTypecheck === true,
821
853
  probeCoverage: analysisRaw.probeCoverage === true,
@@ -825,7 +857,13 @@ function normalizeFileConfig(raw) {
825
857
  seedTimeoutSeconds: requiredSeconds(analysisRaw.seedTimeoutSeconds, "review.analysis.seedTimeoutSeconds"),
826
858
  reconcileTimeoutSeconds: requiredSeconds(analysisRaw.reconcileTimeoutSeconds, "review.analysis.reconcileTimeoutSeconds"),
827
859
  falsifyTimeoutSeconds: requiredSeconds(analysisRaw.falsifyTimeoutSeconds, "review.analysis.falsifyTimeoutSeconds"),
860
+ surveyUnitsTimeoutSeconds: requiredSeconds(analysisRaw.surveyUnitsTimeoutSeconds, "review.analysis.surveyUnitsTimeoutSeconds"),
828
861
  probeRounds: nonNegativeNumber(analysisRaw.probeRounds) ?? reviewDefaults.analysis.probeRounds,
862
+ // Nullable like `maxBodyComments`: an explicit `null` is "no cap", distinct
863
+ // from an absent key, which takes the shipped default.
864
+ maxProbes: analysisRaw.maxProbes === null
865
+ ? null
866
+ : nonNegativeNumber(analysisRaw.maxProbes) ?? reviewDefaults.analysis.maxProbes,
829
867
  // WP6b, the attention boundary. `maxInlineComments` allows 0 — a
830
868
  // deployment that wants every finding in the review body is a coherent
831
869
  // choice — so `nonNegativeNumber` is right and `|| default` would not be.
@@ -839,11 +877,6 @@ function normalizeFileConfig(raw) {
839
877
  maxBodyComments: analysisRaw.maxBodyComments === null
840
878
  ? null
841
879
  : nonNegativeNumber(analysisRaw.maxBodyComments) ?? reviewDefaults.analysis.maxBodyComments,
842
- // #399 idea 2. `null` ⇒ `jev-classify`'s own default. A non-string is
843
- // the same direction every switch in this block fails: the default,
844
- // never a fabricated model id.
845
- jevModel: typeof analysisRaw.jevModel === "string" ? analysisRaw.jevModel.trim() : reviewDefaults.analysis.jevModel,
846
- jevTimeoutSeconds: requiredSeconds(analysisRaw.jevTimeoutSeconds, "review.analysis.jevTimeoutSeconds"),
847
880
  },
848
881
  };
849
882
  // The autonomy pipeline (issue: the software factory). Lenient like every
@@ -1091,25 +1124,37 @@ function nonNegativeNumber(raw) {
1091
1124
  return typeof raw === "number" && Number.isFinite(raw) && raw >= 0 ? raw : undefined;
1092
1125
  }
1093
1126
  /**
1094
- * Keys this config once honoured under `review.analysis` and now IGNORES.
1127
+ * Keys this config once honoured under `review.analysis` and now IGNORES, each
1128
+ * with why.
1095
1129
  *
1096
- * Both were confidence gates on the attention boundary, removed 2026-09-21
1097
- * after `finding.confidence` measured AUROC 0.228 [0.171, 0.299] over 516
1098
- * findings — a strong signal pointing the wrong way — and after the preserved
1099
- * archive showed neither had ever cost a gold finding. Two overlay repos and
1100
- * ~17 eval overlays may still pin them, so they are ACCEPTED AND IGNORED
1101
- * rather than rejected: this loader reads only the keys it knows, so an
1130
+ * Overlay repos and eval overlays may still pin them, so they are ACCEPTED AND
1131
+ * IGNORED rather than rejected: this loader reads only the keys it knows, so an
1102
1132
  * unknown leaf was already inert. The warning is so an operator who pinned one
1103
- * learns it stopped meaning anything, instead of believing a bar is in force.
1133
+ * learns it stopped meaning anything, instead of believing it is in force.
1104
1134
  */
1105
- const REMOVED_ANALYSIS_KEYS = ["internalFloor", "thresholds"];
1106
- function warnRemovedBoundaryKeys(analysisRaw) {
1107
- const present = REMOVED_ANALYSIS_KEYS.filter((k) => analysisRaw[k] !== undefined);
1135
+ const REMOVED_ANALYSIS_KEYS = {
1136
+ // Confidence gates on the attention boundary, removed 2026-09-21 after
1137
+ // `finding.confidence` measured AUROC 0.228 [0.171, 0.299] over 516 findings.
1138
+ internalFloor: "the attention boundary no longer gates on finding.confidence (AUROC 0.228)",
1139
+ thresholds: "the attention boundary no longer gates on finding.confidence (AUROC 0.228)",
1140
+ // Units + sites became the only analysis path
1141
+ // (docs/plans/pr-review-units-sites.md).
1142
+ surveyEngine: "the unit survey is the only survey engine",
1143
+ reviewEngine: "the sites engine is the only review engine",
1144
+ independentReview: "the sites engine writes findings.json; `review` runs only with the pipeline off or on a light re-review",
1145
+ adjudicate: "the adjudicator was removed; the sites engine selects the review",
1146
+ jevModel: "jev-classify was removed with the adjudicator",
1147
+ admit: "dossier admission was removed with the adjudicator",
1148
+ jevTimeoutSeconds: "jev-classify was removed with the adjudicator",
1149
+ surveyPasses: "the agent survey fan-out was removed",
1150
+ };
1151
+ function warnRemovedAnalysisKeys(analysisRaw) {
1152
+ const present = Object.keys(REMOVED_ANALYSIS_KEYS).filter((k) => analysisRaw[k] !== undefined);
1108
1153
  if (present.length === 0)
1109
1154
  return;
1110
1155
  log.warn("review.analysis keys were removed and are ignored", {
1111
1156
  keys: present,
1112
- detail: "the attention boundary no longer gates on finding.confidence (AUROC 0.228); remove these keys from your overlay",
1157
+ detail: `${present.map((k) => `${k}: ${REMOVED_ANALYSIS_KEYS[k]}`).join("; ")} — remove these keys from your overlay`,
1113
1158
  });
1114
1159
  }
1115
1160
  /**
@@ -1262,6 +1307,24 @@ function optionalStringArray(raw, path) {
1262
1307
  return [];
1263
1308
  return stringArray(raw, path);
1264
1309
  }
1310
+ /**
1311
+ * `review.analysis` needs a workspace the HARNESS can read and write: the
1312
+ * in-process `survey-units` phase reads `units.json` from the host checkout and
1313
+ * writes one response per unit back into it for the sandboxed `units-ingest`.
1314
+ * A backend with no host checkout ({@link HOST_READABLE_WORKSPACE}, i.e.
1315
+ * `kubernetes`) would survey nothing on every review, so the combination is
1316
+ * refused at startup, naming both keys — a boot error an operator sees once
1317
+ * beats a degraded review on every run. (The repo layer cannot reach this:
1318
+ * `review.analysis` is operator-only.)
1319
+ */
1320
+ export function assertReviewAnalysisSupported(enabled, backend) {
1321
+ if (!enabled || HOST_READABLE_WORKSPACE[backend])
1322
+ return;
1323
+ throw new Error(`review.analysis.enabled is not supported on the ${backend} sandbox backend — the survey-units ` +
1324
+ "phase reads and writes the workspace from the harness, and this backend has no host checkout. " +
1325
+ `Set review.analysis.enabled: false, or use a backend with a host-readable workspace ` +
1326
+ `(${Object.keys(HOST_READABLE_WORKSPACE).filter((b) => HOST_READABLE_WORKSPACE[b]).join(", ")}).`);
1327
+ }
1265
1328
  function sandboxBackend(raw, path) {
1266
1329
  if (raw === "gondolin" || raw === "docker" || raw === "smol" || raw === "none" || raw === "kubernetes")
1267
1330
  return raw;