@miller-tech/uap 1.214.1 → 1.215.1

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.
@@ -485,4 +485,70 @@ export declare function lastOverlapBlocker(): {
485
485
  */
486
486
  export declare function acquireDeliverLock(projectRoot: string): (() => void) | null;
487
487
  export declare function deliverCommand(instruction: string, options: DeliverOptions): Promise<void>;
488
+ /**
489
+ * Consecutive flat turns after which an epic attempt yields to a fresh one.
490
+ *
491
+ * TWO, from the measurement rather than from taste. In every flat attempt
492
+ * observed (rust-pg-ext, qwen3.8-27b, 2026-08-20) the score was already pinned
493
+ * by turn 2 and never moved again through turn 5 — and `↑ turn 3: enable
494
+ * critic` fired in all four of them without changing anything. Turn 1 can never
495
+ * trip it: the first score is by definition an improvement on "no score yet".
496
+ *
497
+ * Only ever applied when a retry remains, so the cost of being wrong is one
498
+ * fresh attempt on the same epic — the thing that actually rescued the measured
499
+ * case (a flat 5-turn attempt, then a pass in 2).
500
+ */
501
+ /**
502
+ * Consecutive flat turns after which an epic attempt yields to a fresh one.
503
+ *
504
+ * THREE, and the number is measured rather than chosen. Replaying this rail's
505
+ * exact streak logic over 157 deliver logs — 51 attempts where it would arm —
506
+ * gives, per threshold: fires / turns cut / in-attempt breakthroughs destroyed
507
+ *
508
+ * K=2 35 101 5 <- the first draft. Destroys five real wins.
509
+ * K=3 32 67 3
510
+ * K=4 30 35 2
511
+ *
512
+ * Moving 2 -> 3 gives up 34 turns of saving and spares two attempts that went
513
+ * on to PASS from a flat run — `migration-register-rel-record` [75,75,75,PASS]
514
+ * and `contracts` [100,100,100,PASS]. The first draft's comment asserted that a
515
+ * turn-4 breakthrough was something "this sample never showed"; the corpus
516
+ * contains one, and it passed. That claim was wrong and this is the correction.
517
+ *
518
+ * The count is a FLOOR, scaled up with the turn budget by the loop (see
519
+ * `abortOnFlatTurns`): every breakthrough still lost at K=3 is a 6-8 turn
520
+ * attempt from a maxTurns=20 run, where three flat turns is a far weaker signal
521
+ * than it is out of five.
522
+ *
523
+ * Caveat kept in view: the replay reads gate percentages from logs, so it
524
+ * cannot see acceptance movement or inconclusive turns — both of which reset
525
+ * the streak. Every "destroyed" count above is therefore an upper bound.
526
+ */
527
+ export declare const EPIC_FLAT_TURN_YIELD = 3;
528
+ /**
529
+ * The threshold, with an operator override: `UAP_EPIC_FLAT_TURN_YIELD`.
530
+ * `0` or any non-positive value disables the rail entirely.
531
+ *
532
+ * Blank is treated as UNSET, not as zero: an exported-but-empty variable is a
533
+ * common accident, and `Number('')` is 0, which would silently switch the rail
534
+ * off — the exact inversion of the "a typo must not disable it" intent.
535
+ */
536
+ export declare function epicFlatTurnYield(): number | undefined;
537
+ /**
538
+ * The loop option that yields a FLAT epic attempt to a fresh one — or nothing.
539
+ *
540
+ * Extracted so the WIRING is testable, not just the threshold. It carries the
541
+ * whole safety argument: ending an attempt early is defensible only while a
542
+ * fresh attempt remains, so on the last attempt (`retriesRemaining` 0 or
543
+ * absent) this returns `{}` and the attempt plays out exactly as today.
544
+ *
545
+ * WHAT THIS DOES AND DOES NOT BUY, stated precisely because the first draft
546
+ * overclaimed it: no turn budget is transferred. Each attempt gets its own
547
+ * `maxTurns` either way, so a fresh attempt is not made longer by an earlier
548
+ * one ending sooner — the epic's TOTAL exploration shrinks. What is saved is
549
+ * wall clock, on turns whose gate score is provably not moving.
550
+ */
551
+ export declare function epicFlatTurnOption(retriesRemaining: number | undefined, escalationLadderReach?: number): {
552
+ abortOnFlatTurns?: number;
553
+ };
488
554
  //# sourceMappingURL=deliver.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"deliver.d.ts","sourceRoot":"","sources":["../../src/cli/deliver.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AA4BH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAuBzD;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE;IACvC,aAAa,EAAE,OAAO,CAAC;IACvB,WAA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AAO,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAwKhG;AAED;;;;;;;;;;;;GAYG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,eAAO,MAAM,oBAAoB,IAAI,CAAC;AAEtC;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,IAAI,MAAM,GAAG,SAAS,CAOtD;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,kBAAkB,CAChC,gBAAgB,EAAE,MAAM,GAAG,SAAS,EACpC,qBAAqB,SAAI,GACxB;IAAE,gBAAgB,CAAC,EAAE,MAAM,CAAA;CAAE,CAW/B"}
@@ -273,7 +273,7 @@ import { createHaloDeliveryTracer } from '../delivery/halo-trace.js';
273
273
  import { haloTracePath, isHaloTracingEnabled } from '../observability/halo-exporter.js';
274
274
  import { createRunCoordinator } from '../delivery/run-coordinator.js';
275
275
  import { readCuratedIdeas } from './ideate.js';
276
- import { createEscalationController, defaultEscalationLadder } from '../delivery/escalation.js';
276
+ import { createEscalationController, defaultEscalationLadder, DEFAULT_STAGNATION_TURNS } from '../delivery/escalation.js';
277
277
  import { FilePracticeStore, defaultPracticePath, extractKeywords, retrievePracticesSemantic, } from '../delivery/practice.js';
278
278
  import { detectRungs, mergeRedetectedRungs, runLadder, runTieredLadder, tierOf, TIER_ORDER, demoteBaselineFailures, baselineRegressions } from '../delivery/verifier-ladder.js';
279
279
  import { runDeployDevLadder } from '../delivery/deploy-dev-gate.js';
@@ -1127,6 +1127,91 @@ export async function deliverCommand(instruction, options) {
1127
1127
  throw err;
1128
1128
  }
1129
1129
  }
1130
+ /**
1131
+ * Consecutive flat turns after which an epic attempt yields to a fresh one.
1132
+ *
1133
+ * TWO, from the measurement rather than from taste. In every flat attempt
1134
+ * observed (rust-pg-ext, qwen3.8-27b, 2026-08-20) the score was already pinned
1135
+ * by turn 2 and never moved again through turn 5 — and `↑ turn 3: enable
1136
+ * critic` fired in all four of them without changing anything. Turn 1 can never
1137
+ * trip it: the first score is by definition an improvement on "no score yet".
1138
+ *
1139
+ * Only ever applied when a retry remains, so the cost of being wrong is one
1140
+ * fresh attempt on the same epic — the thing that actually rescued the measured
1141
+ * case (a flat 5-turn attempt, then a pass in 2).
1142
+ */
1143
+ /**
1144
+ * Consecutive flat turns after which an epic attempt yields to a fresh one.
1145
+ *
1146
+ * THREE, and the number is measured rather than chosen. Replaying this rail's
1147
+ * exact streak logic over 157 deliver logs — 51 attempts where it would arm —
1148
+ * gives, per threshold: fires / turns cut / in-attempt breakthroughs destroyed
1149
+ *
1150
+ * K=2 35 101 5 <- the first draft. Destroys five real wins.
1151
+ * K=3 32 67 3
1152
+ * K=4 30 35 2
1153
+ *
1154
+ * Moving 2 -> 3 gives up 34 turns of saving and spares two attempts that went
1155
+ * on to PASS from a flat run — `migration-register-rel-record` [75,75,75,PASS]
1156
+ * and `contracts` [100,100,100,PASS]. The first draft's comment asserted that a
1157
+ * turn-4 breakthrough was something "this sample never showed"; the corpus
1158
+ * contains one, and it passed. That claim was wrong and this is the correction.
1159
+ *
1160
+ * The count is a FLOOR, scaled up with the turn budget by the loop (see
1161
+ * `abortOnFlatTurns`): every breakthrough still lost at K=3 is a 6-8 turn
1162
+ * attempt from a maxTurns=20 run, where three flat turns is a far weaker signal
1163
+ * than it is out of five.
1164
+ *
1165
+ * Caveat kept in view: the replay reads gate percentages from logs, so it
1166
+ * cannot see acceptance movement or inconclusive turns — both of which reset
1167
+ * the streak. Every "destroyed" count above is therefore an upper bound.
1168
+ */
1169
+ export const EPIC_FLAT_TURN_YIELD = 3;
1170
+ /**
1171
+ * The threshold, with an operator override: `UAP_EPIC_FLAT_TURN_YIELD`.
1172
+ * `0` or any non-positive value disables the rail entirely.
1173
+ *
1174
+ * Blank is treated as UNSET, not as zero: an exported-but-empty variable is a
1175
+ * common accident, and `Number('')` is 0, which would silently switch the rail
1176
+ * off — the exact inversion of the "a typo must not disable it" intent.
1177
+ */
1178
+ export function epicFlatTurnYield() {
1179
+ const raw = process.env.UAP_EPIC_FLAT_TURN_YIELD;
1180
+ if (raw !== undefined && raw.trim() !== '') {
1181
+ const n = Number(raw);
1182
+ if (Number.isFinite(n))
1183
+ return n >= 1 ? Math.floor(n) : undefined;
1184
+ }
1185
+ return EPIC_FLAT_TURN_YIELD;
1186
+ }
1187
+ /**
1188
+ * The loop option that yields a FLAT epic attempt to a fresh one — or nothing.
1189
+ *
1190
+ * Extracted so the WIRING is testable, not just the threshold. It carries the
1191
+ * whole safety argument: ending an attempt early is defensible only while a
1192
+ * fresh attempt remains, so on the last attempt (`retriesRemaining` 0 or
1193
+ * absent) this returns `{}` and the attempt plays out exactly as today.
1194
+ *
1195
+ * WHAT THIS DOES AND DOES NOT BUY, stated precisely because the first draft
1196
+ * overclaimed it: no turn budget is transferred. Each attempt gets its own
1197
+ * `maxTurns` either way, so a fresh attempt is not made longer by an earlier
1198
+ * one ending sooner — the epic's TOTAL exploration shrinks. What is saved is
1199
+ * wall clock, on turns whose gate score is provably not moving.
1200
+ */
1201
+ export function epicFlatTurnOption(retriesRemaining, escalationLadderReach = 0) {
1202
+ if (!((retriesRemaining ?? 0) > 0))
1203
+ return {};
1204
+ const limit = epicFlatTurnYield();
1205
+ if (limit === undefined)
1206
+ return {};
1207
+ // NEVER yield while this attempt still has an unplayed escalation tier — the
1208
+ // ladder is precisely "what this attempt has left to try", and cutting it is
1209
+ // not reclaiming waste, it is skipping the rescue. Raising the threshold to
1210
+ // the ladder's reach is self-correcting: when the ladder needs the whole turn
1211
+ // budget (a stronger model on a 5-turn attempt), the resulting limit exceeds
1212
+ // the budget and the rail simply never fires.
1213
+ return { abortOnFlatTurns: Math.max(limit, escalationLadderReach) };
1214
+ }
1130
1215
  async function runDeliver(instruction, options) {
1131
1216
  const projectRoot = resolve(options.projectRoot ?? process.cwd());
1132
1217
  // P1 (plan D1): --pending replays gate-recorded edit intents exactly, then
@@ -2053,6 +2138,32 @@ async function runDeliver(instruction, options) {
2053
2138
  onEscalate: (tier, turn) => console.log(chalk.magenta(` ↑ turn ${turn}: ${tier.label}`)),
2054
2139
  })
2055
2140
  : undefined;
2141
+ /**
2142
+ * The turn on which the LAST escalation tier issues its directive.
2143
+ *
2144
+ * An epic attempt may end early on a plateau, and that must never cut the
2145
+ * ladder short: a tier decided on turn N is consumed by turn N+1, so yielding
2146
+ * at or before the last tier's turn means the tier never runs. Measured
2147
+ * against the real ladder — with a stronger model configured, an attempt that
2148
+ * delivers on turn 6 was abandoned on turn 4 and the stronger model was never
2149
+ * called once.
2150
+ *
2151
+ * 0 when no ladder is active, which is the configuration the plateau
2152
+ * measurement was taken in (those logs show `enable critic` and nothing
2153
+ * above it — no stronger model was configured).
2154
+ */
2155
+ const escalationLadderReach = (() => {
2156
+ if (!options.escalate)
2157
+ return 0;
2158
+ const tiers = defaultEscalationLadder({
2159
+ includeExploration: !agentic,
2160
+ candidates,
2161
+ maxTurns: maxTurns ?? 5,
2162
+ escalateExecutor,
2163
+ escalateModelName,
2164
+ }).length;
2165
+ return tiers > 0 ? DEFAULT_STAGNATION_TURNS * tiers + 1 : 0;
2166
+ })();
2056
2167
  // Phase 4: learned best-practice cards for similar tasks. Retrieval is
2057
2168
  // semantic (embeddings) by default — better recall than keyword overlap —
2058
2169
  // and falls back to keyword matching automatically when no embedding
@@ -3086,8 +3197,14 @@ async function runDeliver(instruction, options) {
3086
3197
  saveRunState(runState);
3087
3198
  },
3088
3199
  runOrchestrated: (missionText, plan, parentTaskId) => runOrchestratedMissionCore(buildOrchestratedDeps(missionText, plan, epicParallelTasks, parentTaskId)),
3089
- runEpicLoop: async (scoped) => {
3090
- const loop = new ConvergenceLoop({ ...loopConfig, baselineCheck: false, resumeFrom: undefined, onIteration: makeIterationHook() }, executor, seams);
3200
+ runEpicLoop: async (scoped, opts) => {
3201
+ const loop = new ConvergenceLoop({
3202
+ ...loopConfig,
3203
+ baselineCheck: false,
3204
+ resumeFrom: undefined,
3205
+ onIteration: makeIterationHook(),
3206
+ ...epicFlatTurnOption(opts?.retriesRemaining, escalationLadderReach),
3207
+ }, executor, seams);
3091
3208
  return loop.deliver(scoped);
3092
3209
  },
3093
3210
  setEpicSpec: (spec) => specs.setShared(spec), // fresh epic — breaker needs fresh diff evidence