@quikit/quikpilot-runner 9.3.0-rc.94 → 9.3.0-rc.96

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/README.md CHANGED
@@ -194,6 +194,17 @@ wrong (a field that arrives from a database row or a request), so it only warns
194
194
 
195
195
  **9.3.0-rc.81 (also) - pytest and go test reports place their tests on files (QUIKTR-2465 item 3).** The Python and Go trial repositories' reports placed no test on a file, so the test-file list was empty and the AI Runtime's early check was off. pytest tests are placed by the longest dotted prefix that is a `.py` file of the listing; Go tests by go.mod's module and the one `_test.go` file of the package's folder that declares the function. Real reports: sqlparse 454 tests on 9 files, decimal 145 tests on 3 files, 0 unmapped each. A report that places none of its tests says so in the run's notes. JavaScript reports are unchanged.
196
196
 
197
+ **9.3.0-rc.96 - a bug that does not reproduce on the code before any change ends as its own outcome, not a generic failure (QUIKTR-2794).** On UAT (17 Nov) a bug whose fix was already merged was given to QuikPilot again. In the tests phase both case tests passed on the untouched code (75/75), the red check sent the DONE back, and the AI gave up. The run ended as a generic `cannot_complete`, and the run page had no advice. A tests-phase give-up now ends `not_reproduced` only on the runner's own evidence, never the AI's words. All of these must hold:
198
+ - the AI was told its tests pass and still gave up (or the attempt before ended so);
199
+ - each bug case's test sits in a changed file the hand-over check accepts and was seen PASSING BY NAME among the tests the baseline did not have, in a whole run that finished and shows nothing new failing (tests already failing before are ignored);
200
+ - only real test files changed;
201
+ - not the last turn;
202
+ - not a feature request (`notReproducedOn`: a missing request kind counts as a bug, as before).
203
+
204
+ The new check is asked before "gave up but red", which takes any failing test as the bug shown. The second attempt still runs, told a fixed runner sentence. The step ends `not_reproduced` when it ends the same way, or as a plain tests-phase give-up whose runs saw nothing new fail. The record then carries `notReproduced: { commit, automationIds, passed, failed, testFiles }`: ids, counts and paths, never a test name; `commit` is read once after checkout. The reason starts "QuikPilot could not reproduce the problem:". The callback status stays `failed` and the exit code stays 1: QuikProjects gives the run its own status from the record, and an older QuikProjects strips the field and shows a failed run. `QUIKPILOT_NOT_REPRODUCED=off` (QuikProjects: `not_reproduced` in QUIKPILOT_RUNNER_OFF) switches it off. New: `src/notReproduced.ts`; `RunTestsTool.newPassingOf` (runner only, never sent).
205
+
206
+ **9.3.0-rc.95 - the code-writing loop stops asking for the same lines again and again (QUIKTR-2791).** On UAT (17 Nov) a run asked for the same 12 lines of one test file ten times in twelve turns, in both attempts, used all 20 turns of its tests phase twice and wrote nothing; the same request had passed minutes earlier. Counted range by range from the job log (the runner's own re-read counter misses a re-read after a different window), 58 reads: 18 first sight, 17 repeats of text still whole in front of the AI, 23 re-reads of text the three-turn rule had already shrunk away, with no request above 37,587 of 90,000 tokens. The "no progress" guard (three turns in a row of nothing new, then the next turn is the last) counted none of the 40 turns because every turn also held one read of another window, so "every result is a repeat" was never true. Three changes, harness version only. (1) A read that adds no line the AI cannot already see (its lines are all still whole in the conversation, after the file's last edit; an outline covers no lines) counts as nothing new, so a turn that pairs a repeat with such a read counts for the guard. (2) From the second repeat of the same look (read_file, grep, list_files, find_definition, show_changes) the answer keeps its earlier text and status `duplicate` and says plainly to use it, edit, or finish with cannot_complete; the first repeat reads as before. (3) Old looks are no longer shrunk by age while every request stays under the soft target (40,000 tokens, or the first request plus 20,000); once one passes it, shrinking is on as before. New log lines: `codegen.no_new_info` per turn and `repeatsOfSameRange` in `codegen.reread_summary`. Replaying the recorded calls, the guard fires after turn 12 of the failed run's first attempt (it never fires on the passing run); the second attempt's repeats are spread out, so there only (2) and (3) change what the AI sees. Not measured live yet. New: `src/noProgress.ts`; `limits.shrinkAfterTokens` is for tests.
207
+
197
208
  **9.3.0-rc.94 - the two reports back to QuikProjects are tried again after any connection failure that brought no answer, and a lost report names its cause (QUIKTR-2790).** On UAT (17 Nov) the early look finished its work and its one report failed with a connection error that was not ECONNRESET or ETIMEDOUT (about 10.5 s later: most likely a connect timeout); it was not tried again, the log said only `report_failed`, and the run went on without the look. The look's report and the run's final report now try again after any fetch that threw with no HTTP answer (a connect timeout, a closed socket, DNS, a refused connection), with the same waits and the same bytes each time; a refusal (4xx), an invalid URL, a certificate problem and the runner's own 60 s limit for a try stay final. Every lost look now logs `report_failed` with the cause: the last HTTP status, or a closed word (an error code or an error name; never the message, the URL, the token or the body). The AI calls keep their old two-code retry on purpose: a repeated AI call that reached the AI service is paid twice. No change to the work packet, the contract or the site.
198
209
 
199
210
  **9.3.0-rc.93 - a turn the AI service calls too big is not mistaken for a switch that is off (QUIKTR-2712, RT-05).** The AI service refused a loop turn over its per-turn size limit with the same code (`CONTRACT_REJECTED`) it uses for "switch off", "unknown version" and "malformed request", which the run answers by stepping down a version, dropping a key or writing the files one at a time (on a first request it could even end the run as "needs a database change"). The service now sends its own code, `LOOP_TURN_TOO_LARGE`, for that one refusal, and the three loops (code writing, the file search and the early look) end the attempt as `token_ceiling` ("the request grew too large for one step") with the service's code kept in the record: no step down, no key dropped, no per-file fallback. A runner of this version against the older service behaves as before. Release this runner BEFORE the service half.
package/dist/index.js CHANGED
@@ -38538,6 +38538,10 @@ function createNodeToolFs(rootDir = process.cwd()) {
38538
38538
  }
38539
38539
  };
38540
38540
  }
38541
+ var STEERED_LOOKS = /* @__PURE__ */ new Set(["list_files", "read_file", "grep", "find_definition", "show_changes"]);
38542
+ function repeatedLookMessage(earlier) {
38543
+ return `Same call as ${earlier}: this is its answer again (nothing was run or changed again). You already have it above: use it now, make the change with edit_file or write_file, or finish with cannot_complete and say what is missing.`;
38544
+ }
38541
38545
  function newLedger() {
38542
38546
  return { toolCalls: 0, readChars: 0, resultChars: 0, refused: 0, seen: /* @__PURE__ */ new Map() };
38543
38547
  }
@@ -38854,10 +38858,13 @@ function executeToolCall(call, env2, ledger) {
38854
38858
  if (earlier !== void 0) {
38855
38859
  if (env2.serveRepeats === true) {
38856
38860
  const before = ledger.answers?.get(earlier);
38861
+ const repeats = ledger.repeats ?? (ledger.repeats = /* @__PURE__ */ new Map());
38862
+ const times = (repeats.get(earlier) ?? 0) + 1;
38863
+ repeats.set(earlier, times);
38857
38864
  return finish({
38858
38865
  status: "duplicate",
38859
38866
  reason: earlier,
38860
- message: `Same call as ${earlier}: this is its answer again; nothing was run or changed again.`,
38867
+ message: times >= 2 && STEERED_LOOKS.has(call.name) ? repeatedLookMessage(earlier) : `Same call as ${earlier}: this is its answer again; nothing was run or changed again.`,
38861
38868
  ...before?.output !== void 0 ? { output: before.output } : {}
38862
38869
  });
38863
38870
  }
@@ -40705,6 +40712,8 @@ var REASON_WORDS = {
40705
40712
  contract_rejected: "the AI service did not accept the request (it may be switched off)",
40706
40713
  test_case_disagree: "its code and its own test for an approved case still disagreed after one correction of the test",
40707
40714
  no_test_shows_bug: "none of its tests failed on the code before the change, so none of them showed the bug",
40715
+ // QUIKTR-2794: the tests for every bug case passed on the code before any change, and the runner saw them pass.
40716
+ not_reproduced: "the tests it wrote for every case passed on the code before any change, so the problem did not show",
40708
40717
  semantic_mismatch: "the AI service and the runner disagreed about the request",
40709
40718
  http_error: "the AI service returned an error",
40710
40719
  transport: "the AI service could not be reached",
@@ -40751,6 +40760,7 @@ function attemptInWords(a, fallback) {
40751
40760
  const words2 = a?.afterRecovery ? `${reasonInWords(a?.reason ?? fallback)}, a second time in a row, even after the AI was asked to take a smaller step` : reasonInWords(a?.reason ?? fallback);
40752
40761
  return a?.runtimeCode && a.runtimeCode !== "other" ? `${words2} (error code ${a.runtimeCode})` : words2;
40753
40762
  }
40763
+ var NOT_REPRODUCED_MESSAGE = "QuikPilot could not reproduce the problem: the tests it wrote for the approved cases pass on the code before any change, so there was nothing to fix. Nothing was written. If the problem still happens, start a new run and add an example that fails: the exact inputs, what you saw and what you expected.";
40754
40764
  function exhaustedMessage(attempts, stop2, unreportable) {
40755
40765
  const first = attempts[0];
40756
40766
  const second = attempts[1];
@@ -40760,6 +40770,7 @@ function exhaustedMessage(attempts, stop2, unreportable) {
40760
40770
  const more = unreportable.length > 1 ? `, and ${unreportable.length - 1} more like it` : "";
40761
40771
  return `QuikPilot could not write the change: an existing test in ${blocking.path} (line ${blocking.line}) expects what approved case ${blocking.caseId} calls wrong${more}. It is written once and run for many rows, so QuikPilot cannot propose a change to it for you to approve. Change that test by hand, or correct the case if the test is right, then run QuikPilot again. Nothing was written.`;
40762
40772
  }
40773
+ if (stop2 === "not_reproduced") return NOT_REPRODUCED_MESSAGE;
40763
40774
  if (stop2 === "failed" && attempts.length === 1 && first?.reason === "test_case_disagree") {
40764
40775
  return "QuikPilot could not write the change: its code and its own test for an approved case still disagreed after one correction of the test, so no pull request was opened. Look at that case's expected result: it may be unclear, or conflict with what the code already does.";
40765
40776
  }
@@ -43332,6 +43343,7 @@ var MIN_TEST_LIMIT_MS = 12e4;
43332
43343
  var MAX_TEST_LIMIT_MS = 6e5;
43333
43344
  var DEFAULT_TEST_LIMIT_MS = 3e5;
43334
43345
  var MAX_LISTED_TESTS = 20;
43346
+ var MAX_NEW_PASSING = 200;
43335
43347
  var MAX_TEST_NAME_CHARS = 200;
43336
43348
  var MAX_MESSAGE_CHARS = 120;
43337
43349
  var MAX_WHOLE_MESSAGE_CHARS = 1e3;
@@ -43517,6 +43529,11 @@ var RunTestsTool = class {
43517
43529
  /** QUIKTR-1604: the overlay version each file was last run on, so the same file on the same change is not run twice. */
43518
43530
  lastFileVersion = /* @__PURE__ */ new Map();
43519
43531
  entries = [];
43532
+ /**
43533
+ * QUIKTR-2794: per call, the ids (`classname::name`) of the tests the report shows PASSING that the baseline did not have: tests this attempt
43534
+ * wrote. RUNNER ONLY: never in the answer, so never sent to the AI Runtime nor recorded. Empty without a baseline (nothing to tell them apart by).
43535
+ */
43536
+ newPassing = /* @__PURE__ */ new Map();
43520
43537
  maxRuns;
43521
43538
  maxFileRuns;
43522
43539
  /**
@@ -43548,6 +43565,10 @@ var RunTestsTool = class {
43548
43565
  record() {
43549
43566
  return this.entries.map((e) => ({ ...e }));
43550
43567
  }
43568
+ /** QUIKTR-2794: the new tests a call's run saw passing (see `newPassing`); undefined for a call that gave no report. Runner only. */
43569
+ newPassingOf(callId) {
43570
+ return this.newPassing.get(callId);
43571
+ }
43551
43572
  answer(id, status, parts2 = {}) {
43552
43573
  const harness = this.deps.harness === true;
43553
43574
  const failedSentence = parts2.ownOnly === true ? harness ? HARNESS_TESTS_FAILED_NO_OLD_TEST_BROKE : TESTS_FAILED_NO_OLD_TEST_BROKE : parts2.clean === true ? TESTS_FAILED_ONLY_OLD : null;
@@ -43741,6 +43762,11 @@ var RunTestsTool = class {
43741
43762
  }
43742
43763
  });
43743
43764
  const { failingKey, messageCount, comparable } = answer;
43765
+ const before = baseline?.snapshot.results;
43766
+ this.newPassing.set(
43767
+ callId,
43768
+ before ? [...ran.snapshot.results.entries()].filter(([id, passedNow]) => passedNow && !before.has(id)).map(([id]) => id).slice(0, MAX_NEW_PASSING) : []
43769
+ );
43744
43770
  const output = scope ? { ...answer.output, scope } : answer.output;
43745
43771
  const { passed, failed } = output;
43746
43772
  const cleanOld = comparable && output.regressions === 0 && output.newFailures === 0 && output.alreadyFailing > 0 && failed > 0;
@@ -49429,6 +49455,27 @@ async function runTargetingLoop(args2, deps) {
49429
49455
  }
49430
49456
  }
49431
49457
 
49458
+ // src/noProgress.ts
49459
+ var NOTHING_NEW = /* @__PURE__ */ new Set(["duplicate", "no_effect", "no_change_since_last_run", "no_match", "ambiguous", "conflict_rejected"]);
49460
+ var HARNESS_NO_PROGRESS_TURNS = 3;
49461
+ function turnAddsNothing(results, addedNothing) {
49462
+ return results.every((r) => NOTHING_NEW.has(r.status) || addedNothing.has(r.id));
49463
+ }
49464
+
49465
+ // src/notReproduced.ts
49466
+ function notReproducedOn(env2, requestKind) {
49467
+ if (env2.QUIKPILOT_NOT_REPRODUCED?.trim().toLowerCase() === "off") return false;
49468
+ return !isFeatureKind(requestKind);
49469
+ }
49470
+ var MAX_TOLD_CHARS = 300;
49471
+ function notReproducedSentence(e) {
49472
+ const named2 = e.automationIds.slice(0, 4).map((id) => `[${id}]`).join(", ");
49473
+ const more = e.automationIds.length > 4 ? ` and ${e.automationIds.length - 4} more` : "";
49474
+ const one = e.automationIds.length === 1;
49475
+ const counts = e.failed > 0 ? `${e.passed} passed, ${e.failed} already failing before` : `${e.passed} passed`;
49476
+ return `The tests you wrote for ${named2}${more} ${one ? "passes" : "pass"} on the code before any change (${counts}), so the problem did not show. If a case describes the problem, make its test fail for the reason the case gives; if it still passes, keep the case id in its name and say so.`.slice(0, MAX_TOLD_CHARS);
49477
+ }
49478
+
49432
49479
  // src/workingFiles.ts
49433
49480
  var KEEP_WORKING_FILES_ENV = "QUIKPILOT_KEEP_WORKING_FILES";
49434
49481
  var MAX_WORKING_PATHS = 3;
@@ -49445,6 +49492,17 @@ function rangeOf(args2) {
49445
49492
  if (typeof a.endLine === "number" && Number.isInteger(a.endLine)) out2.endLine = a.endLine;
49446
49493
  return out2;
49447
49494
  }
49495
+ function servedOf(range, output) {
49496
+ if (range.mode === "outline" || typeof output !== "object" || output === null) return {};
49497
+ const o = output;
49498
+ if (typeof o.startLine === "number" && Number.isInteger(o.startLine) && typeof o.endLine === "number" && Number.isInteger(o.endLine)) {
49499
+ return { servedStart: o.startLine, servedEnd: o.endLine };
49500
+ }
49501
+ return {};
49502
+ }
49503
+ function spanOf(r) {
49504
+ return { start: r.servedStart ?? r.startLine ?? 1, end: r.servedEnd ?? r.endLine ?? Number.POSITIVE_INFINITY };
49505
+ }
49448
49506
  function overlapOf(a, b) {
49449
49507
  if (a.mode === "outline" || b.mode === "outline") return a.mode === b.mode ? "same" : "disjoint";
49450
49508
  const aStart = a.startLine ?? 1;
@@ -49486,6 +49544,30 @@ var ReadTracker = class {
49486
49544
  for (const w of this.writes) if (w.path === path) last = w.seq;
49487
49545
  return last;
49488
49546
  }
49547
+ /**
49548
+ * QUIKTR-2791 - whether reading `entry` would add NOTHING the AI cannot already see, called BEFORE it is noted. True when every line it serves is
49549
+ * held by earlier reads of the same file that are still WHOLE in the conversation (not shrunk to a stub, not dropped to make room) and were made
49550
+ * after the AI last changed the file; an outline is held only by an earlier outline, and lines are never held by an outline. A read of lines whose
49551
+ * earlier copy was shrunk adds something (the AI no longer has them), so the rule stays right under the three-turn shrinking. Never true for the
49552
+ * first read of a file. `outputOf(id)` answers what an earlier answer is now.
49553
+ */
49554
+ addsNothing(entry, outputOf, dropNotes) {
49555
+ const after = this.lastWriteSeq(entry.path);
49556
+ const held = this.reads.filter((r) => r.path === entry.path && r.seq > after && stateOf(outputOf(r.id), false, dropNotes) === "whole");
49557
+ if (entry.mode === "outline") return held.some((r) => r.mode === "outline");
49558
+ const spans = held.filter((r) => r.mode !== "outline").map(spanOf);
49559
+ const want = spanOf(entry);
49560
+ if (want.end < want.start) return spans.length > 0;
49561
+ spans.sort((a, b) => a.start - b.start);
49562
+ let cursor = want.start;
49563
+ for (const s of spans) {
49564
+ if (s.end < cursor) continue;
49565
+ if (s.start > cursor) return false;
49566
+ cursor = s.end + 1;
49567
+ if (cursor > want.end) return true;
49568
+ }
49569
+ return false;
49570
+ }
49489
49571
  /**
49490
49572
  * The re-read report for `entry`, called BEFORE it is noted: null for a path not read before in this loop. `outputOf(id)` answers what the
49491
49573
  * earlier answer is now; `duplicate` is whether this read was answered as a repeat.
@@ -50222,6 +50304,15 @@ var CodegenLoopFailure = class extends Error {
50222
50304
  criteriaKey;
50223
50305
  /** QUIKTR-2468: the refusal came on a later turn, not the loop's first request: about that request, never the version. */
50224
50306
  late;
50307
+ /** QUIKTR-2794 (`not_reproduced` only): the attempt's evidence, without the commit (the step adds it). Counts, ids and paths only. */
50308
+ notReproduced;
50309
+ /** QUIKTR-2794: the phase the loop was in when it ended (set by the loop's catch). */
50310
+ phase;
50311
+ /**
50312
+ * QUIKTR-2794: some test run of this attempt showed a test failing that had not failed before any change (a new failure, a regression, or a
50313
+ * failed run of one file): evidence AGAINST "it does not reproduce". Set by the loop's catch.
50314
+ */
50315
+ sawNewFailure;
50225
50316
  constructor(reason, runtimeCode, cause, detail, told) {
50226
50317
  super(`pilot.codegen loop failed: ${reason}${runtimeCode ? ` (${runtimeCode})` : ""}`);
50227
50318
  this.name = "CodegenLoopFailure";
@@ -50252,8 +50343,7 @@ function withUnreportable(stop2, tests) {
50252
50343
  return carried;
50253
50344
  }
50254
50345
  var MAX_RED_REFUSALS = 1;
50255
- var NOTHING_NEW = /* @__PURE__ */ new Set(["duplicate", "no_effect", "no_change_since_last_run", "no_match", "ambiguous", "conflict_rejected"]);
50256
- var HARNESS_NO_PROGRESS_TURNS = 3;
50346
+ var MAX_NOT_REPRODUCED_FILES = 20;
50257
50347
  var MAX_SUMMARY_CHARS = 300;
50258
50348
  var READ_TOOLS = /* @__PURE__ */ new Set(["list_files", "read_file", "grep", "find_definition", "show_changes"]);
50259
50349
  var WRITE_TOOLS = /* @__PURE__ */ new Set(["edit_file", "write_file"]);
@@ -50408,8 +50498,9 @@ async function runCodegenLoop(args2, deps) {
50408
50498
  const usage = new TurnUsage();
50409
50499
  let notes = "";
50410
50500
  let stubbed = 0;
50501
+ let shrinkOn = false;
50411
50502
  const tracker = new ReadTracker();
50412
- const rereadCounts = { rereads: 0, rereadsAfterStub: 0, rereadsAfterDrop: 0 };
50503
+ const rereadCounts = { rereads: 0, rereadsAfterStub: 0, rereadsAfterDrop: 0, repeatsOfSameRange: 0 };
50413
50504
  let keptMax = 0;
50414
50505
  let rereadsLogged = false;
50415
50506
  const logRereads = () => {
@@ -50697,6 +50788,23 @@ async function runCodegenLoop(args2, deps) {
50697
50788
  }
50698
50789
  return null;
50699
50790
  };
50791
+ const isRealTest = (path) => looksLikeTest(path) || args2.protectedTestPaths.includes(path);
50792
+ const notReproducedEvidence = (turn, isFinal) => {
50793
+ if (args2.notReproduced !== true || !harness || args2.phase !== "tests" || isFinal) return null;
50794
+ const ids = args2.redCheckIds ?? [];
50795
+ if (ids.length === 0) return null;
50796
+ if (redRefusals < 1 && args2.previousAttempt?.endedWith !== "not_reproduced") return null;
50797
+ if (handOverRefusal(turn, true) !== null) return null;
50798
+ const changed = overlay.changedPaths();
50799
+ if (!changed.every(isRealTest)) return null;
50800
+ const answer = freshTestAnswer();
50801
+ if (!answer || answer.timedOut || answer.total <= 0 || answer.regressions > 0 || answer.newFailures > 0) return null;
50802
+ const run3 = currentRedRuns().filter((r) => r.file === void 0 && r.answer === answer).at(-1);
50803
+ const seen = run3?.newPassing;
50804
+ if (!seen || !ids.every((id) => seen.some((name2) => idCoversCase(name2, id)))) return null;
50805
+ if (anyOwnTestFails()) return null;
50806
+ return { automationIds: [...ids], passed: answer.passed, failed: answer.failed, testFiles: changed.slice(0, MAX_NOT_REPRODUCED_FILES) };
50807
+ };
50700
50808
  const featureEvidence = async (reuse) => {
50701
50809
  if (!featureOn || !conflictTool) return;
50702
50810
  const all = conflictTool.recorded();
@@ -50714,8 +50822,8 @@ async function runCodegenLoop(args2, deps) {
50714
50822
  return null;
50715
50823
  }
50716
50824
  };
50717
- const servedOf = (c) => ({ title: c.served.title, describes: c.served.describes, ...c.served.table ? { table: true } : {} });
50718
- const regressedIn = (answer, c) => failsIn(answer, c.served.path, servedOf(c), answer?.regressions ?? 0);
50825
+ const servedOf2 = (c) => ({ title: c.served.title, describes: c.served.describes, ...c.served.table ? { table: true } : {} });
50826
+ const regressedIn = (answer, c) => failsIn(answer, c.served.path, servedOf2(c), answer?.regressions ?? 0);
50719
50827
  const fresh = freshTestAnswer() ?? null;
50720
50828
  let changeAnswer = fresh;
50721
50829
  let ranChange = false;
@@ -50735,7 +50843,7 @@ async function runCodegenLoop(args2, deps) {
50735
50843
  const regressed = regressedIn(changeAnswer, c) === true;
50736
50844
  const file = files.find((f) => f.path === c.path);
50737
50845
  const title = (c.index >= 0 ? file?.newTitles.get(c.index) : void 0) ?? c.served.title;
50738
- const suite = !whole4 ? "not_checked" : suiteAnswer.regressions === 0 && failsIn(suiteAnswer, c.served.path, { ...servedOf(c), title }) === false ? "passes" : "fails";
50846
+ const suite = !whole4 ? "not_checked" : suiteAnswer.regressions === 0 && failsIn(suiteAnswer, c.served.path, { ...servedOf2(c), title }) === false ? "passes" : "fails";
50739
50847
  const fixes = regressed && suite === "passes" && changeAnswer ? fixesOf(c, changeAnswer) : [];
50740
50848
  if (regressed) counts.regressed += 1;
50741
50849
  counts[suite === "passes" ? "passes" : suite === "fails" ? "fails" : "notChecked"] += 1;
@@ -50915,6 +51023,14 @@ async function runCodegenLoop(args2, deps) {
50915
51023
  continue;
50916
51024
  }
50917
51025
  if (unexplained.length > 0) log({ event: "codegen.give_up_check", turn, outcome: "gave_up_again", tests: unexplained.length });
51026
+ const notShown = notReproducedEvidence(turn, isFinal);
51027
+ if (notShown) {
51028
+ log({ event: "codegen.red_check", turn, outcome: "not_reproduced", cases: notShown.automationIds.length, files: notShown.testFiles.length });
51029
+ const sentence = notReproducedSentence(notShown);
51030
+ const failure = new CodegenLoopFailure("not_reproduced", void 0, void 0, sentence, sentence);
51031
+ failure.notReproduced = notShown;
51032
+ throw failure;
51033
+ }
50918
51034
  const last = lastTestAnswer;
50919
51035
  const redLeft = harness && args2.phase === "tests" ? redProblem() : null;
50920
51036
  if (harness && args2.phase === "tests" && currentRedRuns().some((r) => r.failing.length > 0) && handOverRefusal(turn, true) === null && (redLeft === null || redLeft.kind === "passing")) {
@@ -51170,6 +51286,7 @@ async function runCodegenLoop(args2, deps) {
51170
51286
  const calls = parsed.calls;
51171
51287
  for (const c of calls) usedIds.add(c.id);
51172
51288
  const results = [];
51289
+ const addedNothing = /* @__PURE__ */ new Set();
51173
51290
  const logged = [];
51174
51291
  for (const [index, call] of calls.entries()) {
51175
51292
  let result;
@@ -51234,10 +51351,13 @@ async function runCodegenLoop(args2, deps) {
51234
51351
  }
51235
51352
  results.push(result);
51236
51353
  if (call.name === "read_file" && isPlainObject(call.args) && typeof call.args.path === "string" && (result.status === "ok" || result.status === "duplicate")) {
51237
- const entry = { id: call.id, turn, path: call.args.path, ...rangeOf(call.args) };
51354
+ const range = rangeOf(call.args);
51355
+ const entry = { id: call.id, turn, path: call.args.path, ...range, ...servedOf(range, result.output) };
51356
+ if (harness && tracker.addsNothing(entry, (id) => results.find((x) => x.id === id)?.output ?? outputOf(id), DROP_NOTES)) addedNothing.add(call.id);
51238
51357
  const again = tracker.reread(entry, result.status === "duplicate", (id) => results.find((x) => x.id === id)?.output ?? outputOf(id), DROP_NOTES);
51239
51358
  if (again) {
51240
51359
  rereadCounts.rereads += 1;
51360
+ if (again.overlap === "same") rereadCounts.repeatsOfSameRange += 1;
51241
51361
  if (again.prevState === "stubbed") rereadCounts.rereadsAfterStub += 1;
51242
51362
  else if (again.prevState === "dropped") rereadCounts.rereadsAfterDrop += 1;
51243
51363
  log({ event: "codegen.reread", ...again });
@@ -51253,7 +51373,15 @@ async function runCodegenLoop(args2, deps) {
51253
51373
  }
51254
51374
  if (call.name === RUN_TESTS_TOOL && isTestAnswer(result.output) && result.status !== "duplicate") {
51255
51375
  const file = result.output.scope === "file" && isPlainObject(call.args) && typeof call.args.file === "string" ? call.args.file : void 0;
51256
- redRuns.push({ version: versionOfFiles(filesOnDisk()), ...file ? { file } : {}, failing: result.output.failingTests, truncated: result.output.truncated, answer: result.output });
51376
+ const newPassing = tests?.newPassingOf(call.id);
51377
+ redRuns.push({
51378
+ version: versionOfFiles(filesOnDisk()),
51379
+ ...file ? { file } : {},
51380
+ failing: result.output.failingTests,
51381
+ truncated: result.output.truncated,
51382
+ answer: result.output,
51383
+ ...newPassing ? { newPassing } : {}
51384
+ });
51257
51385
  } else if (call.name === RUN_TESTS_TOOL && result.status === "no_report" && result.reason === "test_command_failed" && isPlainObject(call.args) && typeof call.args.file === "string") {
51258
51386
  redRuns.push({ version: versionOfFiles(filesOnDisk()), file: call.args.file, failing: [], truncated: false, fileFailed: true });
51259
51387
  }
@@ -51281,7 +51409,8 @@ async function runCodegenLoop(args2, deps) {
51281
51409
  notes = keepNotes(notes, body2.notes, scrub);
51282
51410
  const kept = keepOn ? tracker.keep(outputOf) : null;
51283
51411
  if (kept) keptMax = Math.max(keptMax, kept.size);
51284
- stubbed += stubOldLooks({
51412
+ if (peakRequestTokens > (limits.shrinkAfterTokens ?? mapSoftTarget(firstRequestTokens, limits.maxRequestTokens))) shrinkOn = true;
51413
+ if (shrinkOn) stubbed += stubOldLooks({
51285
51414
  results: toolResults,
51286
51415
  turnOf: (id) => turnOfId.get(id),
51287
51416
  callOf: (id) => callOfId.get(id),
@@ -51290,7 +51419,13 @@ async function runCodegenLoop(args2, deps) {
51290
51419
  ...kept ? { keep: (id) => kept.has(id), repeats: true } : {}
51291
51420
  });
51292
51421
  }
51293
- noProgressStreak = harness ? results.every((r) => NOTHING_NEW.has(r.status)) ? noProgressStreak + 1 : 0 : results.every((r) => r.status === "duplicate") ? noProgressStreak + 1 : 0;
51422
+ noProgressStreak = harness ? turnAddsNothing(results, addedNothing) ? noProgressStreak + 1 : 0 : results.every((r) => r.status === "duplicate") ? noProgressStreak + 1 : 0;
51423
+ if (harness) {
51424
+ const nothingNew = results.filter((r) => NOTHING_NEW.has(r.status) || addedNothing.has(r.id)).length;
51425
+ if (nothingNew > 0) {
51426
+ log({ event: "codegen.no_new_info", turn, results: results.length, nothingNew, byCoverage: results.filter((r) => !NOTHING_NEW.has(r.status) && addedNothing.has(r.id)).length, streak: noProgressStreak });
51427
+ }
51428
+ }
51294
51429
  if (noProgressStreak >= (harness ? HARNESS_NO_PROGRESS_TURNS : 2)) forced = "no_progress";
51295
51430
  else if (ledger.toolCalls >= limits.maxToolCalls) forced = "tool_budget";
51296
51431
  else if (ledger.writeChars >= limits.writeCharsTotal) forced = "write_budget";
@@ -51320,6 +51455,8 @@ async function runCodegenLoop(args2, deps) {
51320
51455
  if (lastTestAnswer) failure.lastTestAnswer ??= lastTestAnswer;
51321
51456
  failure.steps ??= sentSteps();
51322
51457
  if (unreportable.length > 0 && failure.reason !== "test_conflict_unreportable") failure = unreportableFailure(unreportable, failure);
51458
+ if (args2.phase) failure.phase ??= args2.phase;
51459
+ failure.sawNewFailure ??= redRuns.some((r) => r.fileFailed === true || r.answer !== void 0 && !r.answer.timedOut && (r.answer.newFailures > 0 || r.answer.regressions > 0));
51323
51460
  throw failure;
51324
51461
  }
51325
51462
  }
@@ -51655,6 +51792,23 @@ function gateOf(g) {
51655
51792
  alreadyFailing: gateCount(x.alreadyFailing)
51656
51793
  };
51657
51794
  }
51795
+ var MAX_NOT_REPRODUCED_IDS = 200;
51796
+ var MAX_NOT_REPRODUCED_FILES2 = 20;
51797
+ var COMMIT_SHAPE = /^(?:[0-9a-f]{40}|[0-9a-f]{64})$/;
51798
+ var ID_SHAPE = /^[A-Za-z0-9][A-Za-z0-9._-]{0,59}$/;
51799
+ function clampNotReproduced(x) {
51800
+ if (!x) return void 0;
51801
+ const automationIds = [...new Set(x.automationIds.filter((id) => typeof id === "string" && ID_SHAPE.test(id)))].slice(0, MAX_NOT_REPRODUCED_IDS);
51802
+ if (automationIds.length === 0) return void 0;
51803
+ const testFiles = x.testFiles.filter((p) => typeof p === "string" && p.length > 0 && p.length <= 300).slice(0, MAX_NOT_REPRODUCED_FILES2);
51804
+ return {
51805
+ ...typeof x.commit === "string" && COMMIT_SHAPE.test(x.commit) ? { commit: x.commit } : {},
51806
+ automationIds,
51807
+ passed: whole3(x.passed),
51808
+ failed: whole3(x.failed),
51809
+ testFiles
51810
+ };
51811
+ }
51658
51812
  function whole3(n) {
51659
51813
  return typeof n === "number" && Number.isInteger(n) && n >= 0 ? n : 0;
51660
51814
  }
@@ -51801,6 +51955,7 @@ function buildCodegenLoopRecord(loop) {
51801
51955
  ...attempts.length > 0 ? { attempts } : {},
51802
51956
  ...phases.length > 0 ? { phases } : {},
51803
51957
  ...healed ? { heal: healed } : {},
51958
+ ...clampNotReproduced(loop.notReproduced) ? { notReproduced: clampNotReproduced(loop.notReproduced) } : {},
51804
51959
  reasoning,
51805
51960
  ...cut2 ? { truncated: true } : {}
51806
51961
  };
@@ -52576,9 +52731,17 @@ function buildCodegenLoopArgs(p, context = collectLoopContext({
52576
52731
  // QUIKTR-2445: the harness only (the loop decides where the key is in effect).
52577
52732
  ...p.mode === "loop-tests" && p.tests && p.harness !== false && p.databaseChange && p.databaseChange.length > 0 ? { databaseChange: { parts: p.databaseChange, ...p.databaseNames ? { names: p.databaseNames } : {} } } : {},
52578
52733
  // An approved test change stands whatever version the AI Runtime speaks: a person decided it.
52579
- ...p.approved && p.approved.length > 0 ? { approved: p.approved.map((r) => ({ targetPath: r.targetPath, newContent: r.newContent })) } : {}
52734
+ ...p.approved && p.approved.length > 0 ? { approved: p.approved.map((r) => ({ targetPath: r.targetPath, newContent: r.newContent })) } : {},
52735
+ // QUIKTR-2794: the harness only (the loop asks it in the tests phase alone). Never on the wire.
52736
+ ...p.mode === "loop-tests" && p.tests && p.harness !== false && p.notReproduced === true ? { notReproduced: true } : {}
52580
52737
  };
52581
52738
  }
52739
+ function notReproducedRun(f1, f2) {
52740
+ if (f1.reason !== "not_reproduced" || !f1.notReproduced) return null;
52741
+ if (f2.reason === "not_reproduced" && f2.notReproduced) return f2.notReproduced;
52742
+ const quiet = f2.phase === "tests" && (f2.reason === "cannot_complete" || f2.reason === "no_test_shows_bug") && f2.sawNewFailure !== true;
52743
+ return quiet ? f1.notReproduced : null;
52744
+ }
52582
52745
  var NO_SUMMARY = {
52583
52746
  turns: 0,
52584
52747
  toolCalls: 0,
@@ -52618,8 +52781,9 @@ function keptAttempt(n, summary) {
52618
52781
  }
52619
52782
  var keptWarning = (n) => `The ${n === 1 ? "first" : "second"} attempt said it could not finish, but its change passed every check the AI is held to apart from the project's tests, so QuikPilot kept it and let the checks decide.`;
52620
52783
  var failedAttempt = failedAttemptRecord;
52621
- function lose(p, summary, attempts, stop2, unreportable, failures = []) {
52622
- p.out.loop = buildCodegenLoopRecord({ ...summary ?? NO_SUMMARY, stopReason: stop2, attempts });
52784
+ function lose(p, summary, attempts, stop2, unreportable, failures = [], notReproduced) {
52785
+ const evidence = notReproduced ? { notReproduced: { ...p.baseCommit ? { commit: p.baseCommit } : {}, ...notReproduced } } : {};
52786
+ p.out.loop = buildCodegenLoopRecord({ ...summary ?? NO_SUMMARY, stopReason: stop2, attempts, ...evidence });
52623
52787
  const partsMissing = [...failures].reverse().find((f) => f.reason === "part_missing")?.detail;
52624
52788
  return new CodegenAttemptsExhausted(attempts, stop2, unreportable, partsMissing);
52625
52789
  }
@@ -52885,6 +53049,8 @@ async function runCodegenStep(p) {
52885
53049
  }
52886
53050
  const f2 = second.failure;
52887
53051
  log({ event: "codegen.attempt_end", attempt: 2, outcome: "failed", reason: f2.reason, ...internalCause(f2), ...f2.afterRecovery ? { afterRecovery: true } : {}, turns: f2.summary?.turns ?? 0, toolCalls: f2.summary?.toolCalls ?? 0, durationMs: secondMs });
53052
+ const notShown = notReproducedRun(f1, f2);
53053
+ if (notShown) throw lose(p, f2.summary, [firstRecord, failedAttempt(2, f2)], "not_reproduced", void 0, [f1, f2], notShown);
52888
53054
  throw lose(p, f2.summary, [firstRecord, failedAttempt(2, f2)], f2.reason === "out_of_time" ? "out_of_time" : "failed", f2.unreportable, [f1, f2]);
52889
53055
  }
52890
53056
 
@@ -54914,6 +55080,8 @@ var RUNNER_SWITCHES = {
54914
55080
  QUIKPILOT_RELATED_TESTS: ["off"],
54915
55081
  QUIKPILOT_MAP: ["off"],
54916
55082
  QUIKPILOT_TOOLS2: ["off"],
55083
+ // QUIKTR-2794: a tests-phase give-up whose tests all passed on the untouched code ends `not_reproduced` (QuikProjects: `not_reproduced`).
55084
+ QUIKPILOT_NOT_REPRODUCED: ["off"],
54917
55085
  QUIKPILOT_TEST_RULES: ["js"],
54918
55086
  QUIKPILOT_TEST_LOCATE: ["js"],
54919
55087
  QUIKPILOT_ROW_NAMES: ["js"],
@@ -54950,7 +55118,7 @@ var FAILURE_ARTIFACT_DIR = "quikpilot-failure";
54950
55118
  var REPORT_COPY = "final-test-report.xml";
54951
55119
  var MAX_REPORT_BYTES = 5 * 1024 * 1024;
54952
55120
  var MAX_FILES = 200;
54953
- var RUNNER_VERSION = true ? "9.3.0-rc.94" : "dev";
55121
+ var RUNNER_VERSION = true ? "9.3.0-rc.96" : "dev";
54954
55122
  function safeDestination(base, repoPath) {
54955
55123
  if (!repoPath || (0, import_node_path27.isAbsolute)(repoPath)) return null;
54956
55124
  const destination = (0, import_node_path27.resolve)(base, repoPath);
@@ -55937,6 +56105,7 @@ async function runUnderGuard(env2, guard) {
55937
56105
  let conflictStop;
55938
56106
  let testConflicts;
55939
56107
  let approvedApplied;
56108
+ let baseCommit;
55940
56109
  let databaseChange;
55941
56110
  const contextLog = [];
55942
56111
  const codegenOut = {};
@@ -56004,6 +56173,12 @@ async function runUnderGuard(env2, guard) {
56004
56173
  if (why) throw new Error(`QuikProjects sent a ${label} name git cannot use safely (${why}), so QuikPilot did not start. Nothing was changed.`);
56005
56174
  }
56006
56175
  checkoutTargetBranch(packet.targetBranch);
56176
+ try {
56177
+ const head = headCommit().trim();
56178
+ if (/^(?:[0-9a-f]{40}|[0-9a-f]{64})$/.test(head)) baseCommit = head;
56179
+ } catch {
56180
+ baseCommit = void 0;
56181
+ }
56007
56182
  const writeRoot = normaliseWorkspaceRoot(packet.workspaceRoot);
56008
56183
  scopeRoot = writeRoot;
56009
56184
  const workspaceListing = listWorkspaceFiles(writeRoot === "" ? null : writeRoot);
@@ -56245,6 +56420,10 @@ async function runUnderGuard(env2, guard) {
56245
56420
  ...conflictsOn && packet.fixFirst === true && process.env.QUIKPILOT_FIX_FIRST?.trim().toLowerCase() !== "off" ? { fixFirst: true } : {},
56246
56421
  // QUIKTR-2442: a feature run may propose add-only set-up for an existing test its change breaks.
56247
56422
  ...featureUpdates ? { featureTestUpdates: true } : {},
56423
+ // QUIKTR-2794: a bug whose tests pass on the untouched code ends `not_reproduced`; `QUIKPILOT_NOT_REPRODUCED=off` (QuikProjects: `not_reproduced`
56424
+ // in QUIKPILOT_RUNNER_OFF) switches it off, no release.
56425
+ ...notReproducedOn(process.env, packet.requestKind) ? { notReproduced: true } : {},
56426
+ ...baseCommit ? { baseCommit } : {},
56248
56427
  // QUIKTR-2509: the approved criteria in the person's words, when QuikProjects sent them (its switch QUIKPILOT_TICKET_HINTS).
56249
56428
  ...criteriaWording ? { criteriaWording } : {},
56250
56429
  ...approved && approved.files.length > 0 ? { approved: approved.files } : {},