@quikit/quikpilot-runner 9.3.0-rc.95 → 9.3.0-rc.97

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,20 @@ 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.97 - the early look can say the reported behaviour already works (QUIKTR-2821).** On UAT (17 Nov) the look read an already-fixed bug's fix and had no word for it: the model answered NOT_PRESENT, its searches had found code, and the runner turned that into CANNOT_TELL, so the run went through both gates and a build first.
198
+ - **The new verdict.** The look now speaks the AI Runtime's `investigate-loop-2`, which adds a fifth verdict, **ALREADY_WORKS**: the code the report points at exists and already behaves as the report says it should. It stands only on a citation the runner checked (the rule PRESENT has), otherwise CANNOT_TELL, and a trimmed record keeps a citation for it.
199
+ - **Older AI Runtimes.** An AI Runtime that predates loop-2 refuses it on the first turn: that turn is asked once more on `investigate-loop-1` (`investigate.version_fallback`) and the look carries on there. A switched-off look and any later refusal end the look as before. The fixed part of a loop-2 request is 7,000 tokens (the AI Runtime's value).
200
+ - **Order.** QuikProjects must accept the word (its callback is strict) before this version is pinned. QuikProjects shows it next to the questions, with a choice to stop.
201
+
202
+ **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:
203
+ - the AI was told its tests pass and still gave up (or the attempt before ended so);
204
+ - 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);
205
+ - only real test files changed;
206
+ - not the last turn;
207
+ - not a feature request (`notReproducedOn`: a missing request kind counts as a bug, as before).
208
+
209
+ 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).
210
+
197
211
  **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.
198
212
 
199
213
  **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.
package/dist/index.js CHANGED
@@ -40712,6 +40712,8 @@ var REASON_WORDS = {
40712
40712
  contract_rejected: "the AI service did not accept the request (it may be switched off)",
40713
40713
  test_case_disagree: "its code and its own test for an approved case still disagreed after one correction of the test",
40714
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",
40715
40717
  semantic_mismatch: "the AI service and the runner disagreed about the request",
40716
40718
  http_error: "the AI service returned an error",
40717
40719
  transport: "the AI service could not be reached",
@@ -40758,6 +40760,7 @@ function attemptInWords(a, fallback) {
40758
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);
40759
40761
  return a?.runtimeCode && a.runtimeCode !== "other" ? `${words2} (error code ${a.runtimeCode})` : words2;
40760
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.";
40761
40764
  function exhaustedMessage(attempts, stop2, unreportable) {
40762
40765
  const first = attempts[0];
40763
40766
  const second = attempts[1];
@@ -40767,6 +40770,7 @@ function exhaustedMessage(attempts, stop2, unreportable) {
40767
40770
  const more = unreportable.length > 1 ? `, and ${unreportable.length - 1} more like it` : "";
40768
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.`;
40769
40772
  }
40773
+ if (stop2 === "not_reproduced") return NOT_REPRODUCED_MESSAGE;
40770
40774
  if (stop2 === "failed" && attempts.length === 1 && first?.reason === "test_case_disagree") {
40771
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.";
40772
40776
  }
@@ -42680,7 +42684,9 @@ var PROMPT_OVERHEAD_BY_VERSION = Object.freeze({
42680
42684
  "targeting-loop-2": 10500,
42681
42685
  "targeting-loop-3": 11e3,
42682
42686
  "targeting-loop-4": 12500,
42683
- "investigate-loop-1": 7e3
42687
+ "investigate-loop-1": 7e3,
42688
+ // QUIKTR-2821: the AI Runtime's value for loop-2 (measured worst case 6,088).
42689
+ "investigate-loop-2": 7e3
42684
42690
  });
42685
42691
  var LARGEST_OVERHEAD = Math.max(...Object.values(PROMPT_OVERHEAD_BY_VERSION));
42686
42692
  function promptOverheadTokens(version2) {
@@ -43339,6 +43345,7 @@ var MIN_TEST_LIMIT_MS = 12e4;
43339
43345
  var MAX_TEST_LIMIT_MS = 6e5;
43340
43346
  var DEFAULT_TEST_LIMIT_MS = 3e5;
43341
43347
  var MAX_LISTED_TESTS = 20;
43348
+ var MAX_NEW_PASSING = 200;
43342
43349
  var MAX_TEST_NAME_CHARS = 200;
43343
43350
  var MAX_MESSAGE_CHARS = 120;
43344
43351
  var MAX_WHOLE_MESSAGE_CHARS = 1e3;
@@ -43524,6 +43531,11 @@ var RunTestsTool = class {
43524
43531
  /** QUIKTR-1604: the overlay version each file was last run on, so the same file on the same change is not run twice. */
43525
43532
  lastFileVersion = /* @__PURE__ */ new Map();
43526
43533
  entries = [];
43534
+ /**
43535
+ * QUIKTR-2794: per call, the ids (`classname::name`) of the tests the report shows PASSING that the baseline did not have: tests this attempt
43536
+ * 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).
43537
+ */
43538
+ newPassing = /* @__PURE__ */ new Map();
43527
43539
  maxRuns;
43528
43540
  maxFileRuns;
43529
43541
  /**
@@ -43555,6 +43567,10 @@ var RunTestsTool = class {
43555
43567
  record() {
43556
43568
  return this.entries.map((e) => ({ ...e }));
43557
43569
  }
43570
+ /** QUIKTR-2794: the new tests a call's run saw passing (see `newPassing`); undefined for a call that gave no report. Runner only. */
43571
+ newPassingOf(callId) {
43572
+ return this.newPassing.get(callId);
43573
+ }
43558
43574
  answer(id, status, parts2 = {}) {
43559
43575
  const harness = this.deps.harness === true;
43560
43576
  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;
@@ -43748,6 +43764,11 @@ var RunTestsTool = class {
43748
43764
  }
43749
43765
  });
43750
43766
  const { failingKey, messageCount, comparable } = answer;
43767
+ const before = baseline?.snapshot.results;
43768
+ this.newPassing.set(
43769
+ callId,
43770
+ before ? [...ran.snapshot.results.entries()].filter(([id, passedNow]) => passedNow && !before.has(id)).map(([id]) => id).slice(0, MAX_NEW_PASSING) : []
43771
+ );
43751
43772
  const output = scope ? { ...answer.output, scope } : answer.output;
43752
43773
  const { passed, failed } = output;
43753
43774
  const cleanOld = comparable && output.regressions === 0 && output.newFailures === 0 && output.alreadyFailing > 0 && failed > 0;
@@ -49443,6 +49464,20 @@ function turnAddsNothing(results, addedNothing) {
49443
49464
  return results.every((r) => NOTHING_NEW.has(r.status) || addedNothing.has(r.id));
49444
49465
  }
49445
49466
 
49467
+ // src/notReproduced.ts
49468
+ function notReproducedOn(env2, requestKind) {
49469
+ if (env2.QUIKPILOT_NOT_REPRODUCED?.trim().toLowerCase() === "off") return false;
49470
+ return !isFeatureKind(requestKind);
49471
+ }
49472
+ var MAX_TOLD_CHARS = 300;
49473
+ function notReproducedSentence(e) {
49474
+ const named2 = e.automationIds.slice(0, 4).map((id) => `[${id}]`).join(", ");
49475
+ const more = e.automationIds.length > 4 ? ` and ${e.automationIds.length - 4} more` : "";
49476
+ const one = e.automationIds.length === 1;
49477
+ const counts = e.failed > 0 ? `${e.passed} passed, ${e.failed} already failing before` : `${e.passed} passed`;
49478
+ 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);
49479
+ }
49480
+
49446
49481
  // src/workingFiles.ts
49447
49482
  var KEEP_WORKING_FILES_ENV = "QUIKPILOT_KEEP_WORKING_FILES";
49448
49483
  var MAX_WORKING_PATHS = 3;
@@ -50271,6 +50306,15 @@ var CodegenLoopFailure = class extends Error {
50271
50306
  criteriaKey;
50272
50307
  /** QUIKTR-2468: the refusal came on a later turn, not the loop's first request: about that request, never the version. */
50273
50308
  late;
50309
+ /** QUIKTR-2794 (`not_reproduced` only): the attempt's evidence, without the commit (the step adds it). Counts, ids and paths only. */
50310
+ notReproduced;
50311
+ /** QUIKTR-2794: the phase the loop was in when it ended (set by the loop's catch). */
50312
+ phase;
50313
+ /**
50314
+ * 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
50315
+ * failed run of one file): evidence AGAINST "it does not reproduce". Set by the loop's catch.
50316
+ */
50317
+ sawNewFailure;
50274
50318
  constructor(reason, runtimeCode, cause, detail, told) {
50275
50319
  super(`pilot.codegen loop failed: ${reason}${runtimeCode ? ` (${runtimeCode})` : ""}`);
50276
50320
  this.name = "CodegenLoopFailure";
@@ -50301,6 +50345,7 @@ function withUnreportable(stop2, tests) {
50301
50345
  return carried;
50302
50346
  }
50303
50347
  var MAX_RED_REFUSALS = 1;
50348
+ var MAX_NOT_REPRODUCED_FILES = 20;
50304
50349
  var MAX_SUMMARY_CHARS = 300;
50305
50350
  var READ_TOOLS = /* @__PURE__ */ new Set(["list_files", "read_file", "grep", "find_definition", "show_changes"]);
50306
50351
  var WRITE_TOOLS = /* @__PURE__ */ new Set(["edit_file", "write_file"]);
@@ -50745,6 +50790,23 @@ async function runCodegenLoop(args2, deps) {
50745
50790
  }
50746
50791
  return null;
50747
50792
  };
50793
+ const isRealTest = (path) => looksLikeTest(path) || args2.protectedTestPaths.includes(path);
50794
+ const notReproducedEvidence = (turn, isFinal) => {
50795
+ if (args2.notReproduced !== true || !harness || args2.phase !== "tests" || isFinal) return null;
50796
+ const ids = args2.redCheckIds ?? [];
50797
+ if (ids.length === 0) return null;
50798
+ if (redRefusals < 1 && args2.previousAttempt?.endedWith !== "not_reproduced") return null;
50799
+ if (handOverRefusal(turn, true) !== null) return null;
50800
+ const changed = overlay.changedPaths();
50801
+ if (!changed.every(isRealTest)) return null;
50802
+ const answer = freshTestAnswer();
50803
+ if (!answer || answer.timedOut || answer.total <= 0 || answer.regressions > 0 || answer.newFailures > 0) return null;
50804
+ const run3 = currentRedRuns().filter((r) => r.file === void 0 && r.answer === answer).at(-1);
50805
+ const seen = run3?.newPassing;
50806
+ if (!seen || !ids.every((id) => seen.some((name2) => idCoversCase(name2, id)))) return null;
50807
+ if (anyOwnTestFails()) return null;
50808
+ return { automationIds: [...ids], passed: answer.passed, failed: answer.failed, testFiles: changed.slice(0, MAX_NOT_REPRODUCED_FILES) };
50809
+ };
50748
50810
  const featureEvidence = async (reuse) => {
50749
50811
  if (!featureOn || !conflictTool) return;
50750
50812
  const all = conflictTool.recorded();
@@ -50963,6 +51025,14 @@ async function runCodegenLoop(args2, deps) {
50963
51025
  continue;
50964
51026
  }
50965
51027
  if (unexplained.length > 0) log({ event: "codegen.give_up_check", turn, outcome: "gave_up_again", tests: unexplained.length });
51028
+ const notShown = notReproducedEvidence(turn, isFinal);
51029
+ if (notShown) {
51030
+ log({ event: "codegen.red_check", turn, outcome: "not_reproduced", cases: notShown.automationIds.length, files: notShown.testFiles.length });
51031
+ const sentence = notReproducedSentence(notShown);
51032
+ const failure = new CodegenLoopFailure("not_reproduced", void 0, void 0, sentence, sentence);
51033
+ failure.notReproduced = notShown;
51034
+ throw failure;
51035
+ }
50966
51036
  const last = lastTestAnswer;
50967
51037
  const redLeft = harness && args2.phase === "tests" ? redProblem() : null;
50968
51038
  if (harness && args2.phase === "tests" && currentRedRuns().some((r) => r.failing.length > 0) && handOverRefusal(turn, true) === null && (redLeft === null || redLeft.kind === "passing")) {
@@ -51305,7 +51375,15 @@ async function runCodegenLoop(args2, deps) {
51305
51375
  }
51306
51376
  if (call.name === RUN_TESTS_TOOL && isTestAnswer(result.output) && result.status !== "duplicate") {
51307
51377
  const file = result.output.scope === "file" && isPlainObject(call.args) && typeof call.args.file === "string" ? call.args.file : void 0;
51308
- redRuns.push({ version: versionOfFiles(filesOnDisk()), ...file ? { file } : {}, failing: result.output.failingTests, truncated: result.output.truncated, answer: result.output });
51378
+ const newPassing = tests?.newPassingOf(call.id);
51379
+ redRuns.push({
51380
+ version: versionOfFiles(filesOnDisk()),
51381
+ ...file ? { file } : {},
51382
+ failing: result.output.failingTests,
51383
+ truncated: result.output.truncated,
51384
+ answer: result.output,
51385
+ ...newPassing ? { newPassing } : {}
51386
+ });
51309
51387
  } else if (call.name === RUN_TESTS_TOOL && result.status === "no_report" && result.reason === "test_command_failed" && isPlainObject(call.args) && typeof call.args.file === "string") {
51310
51388
  redRuns.push({ version: versionOfFiles(filesOnDisk()), file: call.args.file, failing: [], truncated: false, fileFailed: true });
51311
51389
  }
@@ -51379,6 +51457,8 @@ async function runCodegenLoop(args2, deps) {
51379
51457
  if (lastTestAnswer) failure.lastTestAnswer ??= lastTestAnswer;
51380
51458
  failure.steps ??= sentSteps();
51381
51459
  if (unreportable.length > 0 && failure.reason !== "test_conflict_unreportable") failure = unreportableFailure(unreportable, failure);
51460
+ if (args2.phase) failure.phase ??= args2.phase;
51461
+ failure.sawNewFailure ??= redRuns.some((r) => r.fileFailed === true || r.answer !== void 0 && !r.answer.timedOut && (r.answer.newFailures > 0 || r.answer.regressions > 0));
51382
51462
  throw failure;
51383
51463
  }
51384
51464
  }
@@ -51714,6 +51794,23 @@ function gateOf(g) {
51714
51794
  alreadyFailing: gateCount(x.alreadyFailing)
51715
51795
  };
51716
51796
  }
51797
+ var MAX_NOT_REPRODUCED_IDS = 200;
51798
+ var MAX_NOT_REPRODUCED_FILES2 = 20;
51799
+ var COMMIT_SHAPE = /^(?:[0-9a-f]{40}|[0-9a-f]{64})$/;
51800
+ var ID_SHAPE = /^[A-Za-z0-9][A-Za-z0-9._-]{0,59}$/;
51801
+ function clampNotReproduced(x) {
51802
+ if (!x) return void 0;
51803
+ const automationIds = [...new Set(x.automationIds.filter((id) => typeof id === "string" && ID_SHAPE.test(id)))].slice(0, MAX_NOT_REPRODUCED_IDS);
51804
+ if (automationIds.length === 0) return void 0;
51805
+ const testFiles = x.testFiles.filter((p) => typeof p === "string" && p.length > 0 && p.length <= 300).slice(0, MAX_NOT_REPRODUCED_FILES2);
51806
+ return {
51807
+ ...typeof x.commit === "string" && COMMIT_SHAPE.test(x.commit) ? { commit: x.commit } : {},
51808
+ automationIds,
51809
+ passed: whole3(x.passed),
51810
+ failed: whole3(x.failed),
51811
+ testFiles
51812
+ };
51813
+ }
51717
51814
  function whole3(n) {
51718
51815
  return typeof n === "number" && Number.isInteger(n) && n >= 0 ? n : 0;
51719
51816
  }
@@ -51860,6 +51957,7 @@ function buildCodegenLoopRecord(loop) {
51860
51957
  ...attempts.length > 0 ? { attempts } : {},
51861
51958
  ...phases.length > 0 ? { phases } : {},
51862
51959
  ...healed ? { heal: healed } : {},
51960
+ ...clampNotReproduced(loop.notReproduced) ? { notReproduced: clampNotReproduced(loop.notReproduced) } : {},
51863
51961
  reasoning,
51864
51962
  ...cut2 ? { truncated: true } : {}
51865
51963
  };
@@ -52635,9 +52733,17 @@ function buildCodegenLoopArgs(p, context = collectLoopContext({
52635
52733
  // QUIKTR-2445: the harness only (the loop decides where the key is in effect).
52636
52734
  ...p.mode === "loop-tests" && p.tests && p.harness !== false && p.databaseChange && p.databaseChange.length > 0 ? { databaseChange: { parts: p.databaseChange, ...p.databaseNames ? { names: p.databaseNames } : {} } } : {},
52637
52735
  // An approved test change stands whatever version the AI Runtime speaks: a person decided it.
52638
- ...p.approved && p.approved.length > 0 ? { approved: p.approved.map((r) => ({ targetPath: r.targetPath, newContent: r.newContent })) } : {}
52736
+ ...p.approved && p.approved.length > 0 ? { approved: p.approved.map((r) => ({ targetPath: r.targetPath, newContent: r.newContent })) } : {},
52737
+ // QUIKTR-2794: the harness only (the loop asks it in the tests phase alone). Never on the wire.
52738
+ ...p.mode === "loop-tests" && p.tests && p.harness !== false && p.notReproduced === true ? { notReproduced: true } : {}
52639
52739
  };
52640
52740
  }
52741
+ function notReproducedRun(f1, f2) {
52742
+ if (f1.reason !== "not_reproduced" || !f1.notReproduced) return null;
52743
+ if (f2.reason === "not_reproduced" && f2.notReproduced) return f2.notReproduced;
52744
+ const quiet = f2.phase === "tests" && (f2.reason === "cannot_complete" || f2.reason === "no_test_shows_bug") && f2.sawNewFailure !== true;
52745
+ return quiet ? f1.notReproduced : null;
52746
+ }
52641
52747
  var NO_SUMMARY = {
52642
52748
  turns: 0,
52643
52749
  toolCalls: 0,
@@ -52677,8 +52783,9 @@ function keptAttempt(n, summary) {
52677
52783
  }
52678
52784
  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.`;
52679
52785
  var failedAttempt = failedAttemptRecord;
52680
- function lose(p, summary, attempts, stop2, unreportable, failures = []) {
52681
- p.out.loop = buildCodegenLoopRecord({ ...summary ?? NO_SUMMARY, stopReason: stop2, attempts });
52786
+ function lose(p, summary, attempts, stop2, unreportable, failures = [], notReproduced) {
52787
+ const evidence = notReproduced ? { notReproduced: { ...p.baseCommit ? { commit: p.baseCommit } : {}, ...notReproduced } } : {};
52788
+ p.out.loop = buildCodegenLoopRecord({ ...summary ?? NO_SUMMARY, stopReason: stop2, attempts, ...evidence });
52682
52789
  const partsMissing = [...failures].reverse().find((f) => f.reason === "part_missing")?.detail;
52683
52790
  return new CodegenAttemptsExhausted(attempts, stop2, unreportable, partsMissing);
52684
52791
  }
@@ -52944,6 +53051,8 @@ async function runCodegenStep(p) {
52944
53051
  }
52945
53052
  const f2 = second.failure;
52946
53053
  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 });
53054
+ const notShown = notReproducedRun(f1, f2);
53055
+ if (notShown) throw lose(p, f2.summary, [firstRecord, failedAttempt(2, f2)], "not_reproduced", void 0, [f1, f2], notShown);
52947
53056
  throw lose(p, f2.summary, [firstRecord, failedAttempt(2, f2)], f2.reason === "out_of_time" ? "out_of_time" : "failed", f2.unreportable, [f1, f2]);
52948
53057
  }
52949
53058
 
@@ -54973,6 +55082,8 @@ var RUNNER_SWITCHES = {
54973
55082
  QUIKPILOT_RELATED_TESTS: ["off"],
54974
55083
  QUIKPILOT_MAP: ["off"],
54975
55084
  QUIKPILOT_TOOLS2: ["off"],
55085
+ // QUIKTR-2794: a tests-phase give-up whose tests all passed on the untouched code ends `not_reproduced` (QuikProjects: `not_reproduced`).
55086
+ QUIKPILOT_NOT_REPRODUCED: ["off"],
54976
55087
  QUIKPILOT_TEST_RULES: ["js"],
54977
55088
  QUIKPILOT_TEST_LOCATE: ["js"],
54978
55089
  QUIKPILOT_ROW_NAMES: ["js"],
@@ -55009,7 +55120,7 @@ var FAILURE_ARTIFACT_DIR = "quikpilot-failure";
55009
55120
  var REPORT_COPY = "final-test-report.xml";
55010
55121
  var MAX_REPORT_BYTES = 5 * 1024 * 1024;
55011
55122
  var MAX_FILES = 200;
55012
- var RUNNER_VERSION = true ? "9.3.0-rc.95" : "dev";
55123
+ var RUNNER_VERSION = true ? "9.3.0-rc.97" : "dev";
55013
55124
  function safeDestination(base, repoPath) {
55014
55125
  if (!repoPath || (0, import_node_path27.isAbsolute)(repoPath)) return null;
55015
55126
  const destination = (0, import_node_path27.resolve)(base, repoPath);
@@ -55996,6 +56107,7 @@ async function runUnderGuard(env2, guard) {
55996
56107
  let conflictStop;
55997
56108
  let testConflicts;
55998
56109
  let approvedApplied;
56110
+ let baseCommit;
55999
56111
  let databaseChange;
56000
56112
  const contextLog = [];
56001
56113
  const codegenOut = {};
@@ -56063,6 +56175,12 @@ async function runUnderGuard(env2, guard) {
56063
56175
  if (why) throw new Error(`QuikProjects sent a ${label} name git cannot use safely (${why}), so QuikPilot did not start. Nothing was changed.`);
56064
56176
  }
56065
56177
  checkoutTargetBranch(packet.targetBranch);
56178
+ try {
56179
+ const head = headCommit().trim();
56180
+ if (/^(?:[0-9a-f]{40}|[0-9a-f]{64})$/.test(head)) baseCommit = head;
56181
+ } catch {
56182
+ baseCommit = void 0;
56183
+ }
56066
56184
  const writeRoot = normaliseWorkspaceRoot(packet.workspaceRoot);
56067
56185
  scopeRoot = writeRoot;
56068
56186
  const workspaceListing = listWorkspaceFiles(writeRoot === "" ? null : writeRoot);
@@ -56304,6 +56422,10 @@ async function runUnderGuard(env2, guard) {
56304
56422
  ...conflictsOn && packet.fixFirst === true && process.env.QUIKPILOT_FIX_FIRST?.trim().toLowerCase() !== "off" ? { fixFirst: true } : {},
56305
56423
  // QUIKTR-2442: a feature run may propose add-only set-up for an existing test its change breaks.
56306
56424
  ...featureUpdates ? { featureTestUpdates: true } : {},
56425
+ // QUIKTR-2794: a bug whose tests pass on the untouched code ends `not_reproduced`; `QUIKPILOT_NOT_REPRODUCED=off` (QuikProjects: `not_reproduced`
56426
+ // in QUIKPILOT_RUNNER_OFF) switches it off, no release.
56427
+ ...notReproducedOn(process.env, packet.requestKind) ? { notReproduced: true } : {},
56428
+ ...baseCommit ? { baseCommit } : {},
56307
56429
  // QUIKTR-2509: the approved criteria in the person's words, when QuikProjects sent them (its switch QUIKPILOT_TICKET_HINTS).
56308
56430
  ...criteriaWording ? { criteriaWording } : {},
56309
56431
  ...approved && approved.files.length > 0 ? { approved: approved.files } : {},
@@ -56726,7 +56848,7 @@ async function runReadinessCheck(env2) {
56726
56848
  }
56727
56849
 
56728
56850
  // src/investigateFindings.ts
56729
- var VERDICTS = ["PRESENT", "NOT_PRESENT", "CANNOT_TELL", "NEW_BEHAVIOUR"];
56851
+ var VERDICTS = ["PRESENT", "NOT_PRESENT", "CANNOT_TELL", "NEW_BEHAVIOUR", "ALREADY_WORKS"];
56730
56852
  var ROLES = ["entry_point", "faulty_function", "caller", "helper", "test", "other"];
56731
56853
  var MAX_FILES3 = 12;
56732
56854
  var MAX_CALL_PATH = 10;
@@ -56883,7 +57005,7 @@ function verifyFindings(raw, ledger, ctx) {
56883
57005
  }
56884
57006
  let verdict = VERDICTS.includes(raw.verdict) ? raw.verdict : "CANNOT_TELL";
56885
57007
  let downgraded = false;
56886
- const supported = verdict === "PRESENT" ? evidence.length > 0 : verdict === "NOT_PRESENT" ? searches.length > 0 : verdict === "NEW_BEHAVIOUR" ? files.length > 0 || evidence.length > 0 : true;
57008
+ const supported = verdict === "PRESENT" || verdict === "ALREADY_WORKS" ? evidence.length > 0 : verdict === "NOT_PRESENT" ? searches.length > 0 : verdict === "NEW_BEHAVIOUR" ? files.length > 0 || evidence.length > 0 : true;
56887
57009
  if (!supported) {
56888
57010
  verdict = "CANNOT_TELL";
56889
57011
  downgraded = true;
@@ -56892,7 +57014,8 @@ function verifyFindings(raw, ledger, ctx) {
56892
57014
  }
56893
57015
 
56894
57016
  // src/investigateLoop.ts
56895
- var INVESTIGATE_CONTRACT_VERSION = "investigate-loop-1";
57017
+ var INVESTIGATE_CONTRACT_VERSION = "investigate-loop-2";
57018
+ var INVESTIGATE_FALLBACK_VERSION = "investigate-loop-1";
56896
57019
  var INVESTIGATE_LIMITS = {
56897
57020
  ...DEFAULT_LIMITS,
56898
57021
  maxTurns: 8,
@@ -56990,8 +57113,9 @@ async function runInvestigateLoop(args2, deps) {
56990
57113
  let noProgressStreak = 0;
56991
57114
  let forced = null;
56992
57115
  const started = now();
57116
+ let version2 = INVESTIGATE_CONTRACT_VERSION;
56993
57117
  const buildContext = (turn, isFinal, finalReason) => ({
56994
- contractVersion: INVESTIGATE_CONTRACT_VERSION,
57118
+ contractVersion: version2,
56995
57119
  report: args2.report,
56996
57120
  deniedPaths: args2.deniedPaths,
56997
57121
  fileCount: args2.listing.length,
@@ -57040,6 +57164,12 @@ async function runInvestigateLoop(args2, deps) {
57040
57164
  throw classifyTransport3(err2);
57041
57165
  }
57042
57166
  const failed = classifyEnvelope(envelope);
57167
+ if (failed?.reason === "contract_rejected" && turn === 1 && version2 === INVESTIGATE_CONTRACT_VERSION) {
57168
+ log({ event: "investigate.version_fallback", from: INVESTIGATE_CONTRACT_VERSION, to: INVESTIGATE_FALLBACK_VERSION });
57169
+ version2 = INVESTIGATE_FALLBACK_VERSION;
57170
+ turn -= 1;
57171
+ continue;
57172
+ }
57043
57173
  if (failed) throw failed;
57044
57174
  const body2 = envelope?.structuredJson;
57045
57175
  if (!isPlainObject(body2)) throw new InvestigateFailure("bad_reply");