@quikit/quikpilot-runner 9.3.0-rc.40 → 9.3.0-rc.41

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
@@ -156,6 +156,8 @@ wrong (a field that arrives from a database row or a request), so it only warns
156
156
 
157
157
  **9.3.0-rc.38 — a loop turn waits as long as its own clock says (QUIKTR-1582, S7).** Node's built-in `fetch` gives up on any reply whose headers take longer than 300 seconds, whatever limit the caller passes ("fetch failed", cause `UND_ERR_HEADERS_TIMEOUT`; measured on Node 20 and 24). So the 420 seconds a loop's first turn was given (9.3.0-rc.34) never happened: when the AI service's first answer of the day took more than 300 seconds, the call failed as "transport", and in map mode that ended the run (S7 trial QTRIA-8). Now every AI call that brings its own clock (each turn of the targeting, code-writing and early-look loops) goes through Node's own `http`/`https` client, which has no such limit, with TCP keep-alive as `fetch` sets it; the clock is the only thing that ends it, and a timed-out turn still reads as `turn_timeout`. Calls without a clock (the single targeting and code-writing calls) keep `fetch` exactly as before, 300 seconds included, and the retry rules are unchanged. No new dependency.
158
158
 
159
+ **9.3.0-rc.41 — a test written once for many rows is said plainly, and the run stops (QUIKTR-1823).** Live run QTRIA-12: after a person approved one test change, the fix broke `still rejects an unauthenticated request`, ONE test inside `describe.each` that runs for 11 routes. The AI reported it four times and was told `title_not_found` each time, because tests inside `describe.each` / `it.each` are left out of the title search on purpose (their names are made at run time); the AI had copied the title right, guessed the shape of its report was wrong, and gave up, and the run said only that the AI could not make the change. Now such a report is turned away with its own word, `generated_test`, whose message tells the AI to answer CANNOT_COMPLETE and name the test. However the loop then ends, it ends `test_conflict_unreportable`: no change is kept for the checks and no second attempt is made (it would meet the same test), and the run says where the test is and which case it contradicts (file, line, case id; never a title) and that a person must change that test or correct the case. If a report of another test stands, the run stops for a decision as before and warns about the generated test. A title in no test of the file is still `title_not_found`. Also in rc.41 (QUIKTR-1824): an answer the AI Service cut off at the output limit (`CODEGEN_OUTPUT_TOO_LARGE`, `OUTPUT_TRUNCATED`) ends the attempt `output_too_large`, "the AI's answer was too long and was cut off", in the code-writing and the targeting loops, instead of `runtime_failed`, "the AI service failed" (live run QTRIA-12: a turn wrote to the limit for 193 s). Every failed attempt keeps the AI Service's own error code in the run's record (`runtimeCode`, a closed word; `other` when it is not shaped like a code), and the run's message names it. Nothing else changes.
160
+
159
161
  **9.3.0-rc.40 — the early look is allowed to finish.** The look's first AI call now waits up to 420 seconds (it was 150) and the whole look up to 10 minutes (it was 210 seconds), the same first-call allowance every other loop already has. Measured 22 Oct: a cold first look call took 219 seconds, so the look was cut off whenever the AI service was cold, the service never kept the response format, and the next run started cold again; a specification written without the code carried a wrong criterion far more often (9 of 24 benchmark samples, against 1 of 24 with the code). QuikProjects now keeps findings that arrive after its own wait ran out, so the later steps of the run read the code. Nothing else changes.
160
162
 
161
163
  **9.3.0-rc.39 — an existing test that asserts the bug is reported, and a person decides (QUIKTR-1717, contract section 38).** QuikPilot never changes an existing test to make new code pass. Until now, when the test itself was what asserted the bug, the run could only fail (S7 trial QTRIA-9: `returns 401 when there's no bearer token at all, without falling back to a session cookie` expected exactly the wrong answer). Now, when QuikProjects says it can ask a person (the work packet carries `testConflicts`), the AI may report such a test with a new tool, `report_test_conflict` (the loop speaks `codegen-loop-7`, the notes version plus the tool; an AI service that refuses it is asked again as `codegen-loop-6`). The runner checks every report itself: the file is an existing test file the parser reads, the title is found once, `find` is inside that test, only expected values (and the title) differ, and the test PASSED on the code before the run. When at least one report stands, the run stops before delivering any code: the project's tests are run once on the old code with only the proposed test change written over it (the changed test must FAIL there), and ONE commit with that change is pushed to its own branch, `quikpilot/<KEY>-test-change-<job>`, made without touching the checkout (the work branch is never made). The commit message carries the investigation for a person reading it on GitHub: which test, which approved case it contradicts, how the AI read it, and when and in which change the test was added (`git log`, renames followed). The job reports `blocked` with `testConflicts` (paths, line numbers, shas, closed words and the corrected case text; never a test title, code, a reason or a commit subject) and uploads no test report. After a decision the packet carries `testConflicts.changes`: for each decision, the proposal branch, the commit that was shown and the choice. `TEST_CHANGED` applies exactly that commit's change (re-checked: the commit is the one shown, it changes only the files its message names, each file is still as it was, only expected values differ; two decisions on one file are merged with `git merge-file`), and the approved text is locked like any old test while new tests may still be added. `TEST_RIGHT` changes no test and tells the AI, through the request key `decidedTests`, which tests were judged right. A pull request that applied an approval says so (`approvedTestsApplied`). Fix attempts never stop to ask. Kill switch: `QUIKPILOT_NOTES=off` also turns the flow off. Without `testConflicts` in the packet the runner behaves exactly as rc.38.
package/dist/index.js CHANGED
@@ -30626,6 +30626,18 @@ function locateTests(path, text2) {
30626
30626
  const parsed = parseProgram(path, text2);
30627
30627
  if (!parsed) return null;
30628
30628
  const tests = [];
30629
+ const generated = [];
30630
+ const located = (call, title, describes, skipped) => ({
30631
+ title: title.text,
30632
+ describes,
30633
+ startLine: lineAt(parsed.code, call.start),
30634
+ endLine: lineAt(parsed.code, Math.max(call.start, call.end - 1)),
30635
+ start: call.start,
30636
+ end: call.end,
30637
+ titleStart: title.start,
30638
+ titleEnd: title.end,
30639
+ skipped
30640
+ });
30629
30641
  const visit = (node, describes, dynamic = false) => {
30630
30642
  let inner = describes;
30631
30643
  let innerDynamic = dynamic;
@@ -30633,22 +30645,20 @@ function locateTests(path, text2) {
30633
30645
  const call = node;
30634
30646
  const chain = chainOf(call.callee);
30635
30647
  const title = chain ? titleOf(call) : null;
30636
- if (call.callee.type === "CallExpression" && chainOf(call.callee.callee)) innerDynamic = true;
30648
+ const each = call.callee.type === "CallExpression" ? chainOf(call.callee.callee) : null;
30649
+ if (each) {
30650
+ innerDynamic = true;
30651
+ const eachTitle = titleOf(call);
30652
+ if (eachTitle && DESCRIBE_ROOTS.has(each.root)) inner = [...describes, eachTitle.text];
30653
+ else if (eachTitle) generated.push(located(call, eachTitle, describes, each.skipped));
30654
+ }
30637
30655
  if (chain && title) {
30638
30656
  if (DESCRIBE_ROOTS.has(chain.root)) {
30639
30657
  inner = [...describes, title.text];
30640
30658
  } else if (!dynamic) {
30641
- tests.push({
30642
- title: title.text,
30643
- describes,
30644
- startLine: lineAt(parsed.code, call.start),
30645
- endLine: lineAt(parsed.code, Math.max(call.start, call.end - 1)),
30646
- start: call.start,
30647
- end: call.end,
30648
- titleStart: title.start,
30649
- titleEnd: title.end,
30650
- skipped: chain.skipped
30651
- });
30659
+ tests.push(located(call, title, describes, chain.skipped));
30660
+ } else {
30661
+ generated.push(located(call, title, describes, chain.skipped));
30652
30662
  }
30653
30663
  }
30654
30664
  }
@@ -30662,7 +30672,7 @@ function locateTests(path, text2) {
30662
30672
  }
30663
30673
  };
30664
30674
  visit(parsed.ast, []);
30665
- return { code: parsed.code, tests };
30675
+ return { code: parsed.code, tests, generated };
30666
30676
  }
30667
30677
  function stripComments(text2) {
30668
30678
  let out = "";
@@ -32495,7 +32505,8 @@ var REJECT_MESSAGES = {
32495
32505
  baseline_unknown: "It could not be checked whether that test passes on the code before this run, so it cannot be reported.",
32496
32506
  still_passes_old_code: "With your replacement that test still passes on the code before this run, so it would not show the bug.",
32497
32507
  already_decided: "A person has already decided about that test. Do not report it again.",
32498
- too_many_conflicts: "Too many tests have been reported already. Finish with what you have."
32508
+ too_many_conflicts: "Too many tests have been reported already. Finish with what you have.",
32509
+ generated_test: "That test is written once and run for each row of a table (describe.each or it.each), so a report cannot propose a change to it. Do not report it again: answer CANNOT_COMPLETE, and in your summary name the test and the case it contradicts. A person will change it."
32499
32510
  };
32500
32511
  var RECORDED_MESSAGE = "Recorded. This run will now stop before any code is delivered, and a person will decide about this test. Finish your answer; there is nothing more to do for this test.";
32501
32512
  var BOUNDS = { find: 8e3, replace: 2e4, title: 300, reason: 300, caseText: 1e3, value: 120, why: 300 };
@@ -32522,6 +32533,9 @@ function nameIsTitle(name, title, describes = []) {
32522
32533
  const full = [...describes, title];
32523
32534
  return name === title || name === full.join(" > ") || name === full.join(" ") || name === full.join(" \u203A ");
32524
32535
  }
32536
+ function isRowsTitle(sent, title) {
32537
+ return sent === title || [" > ", " \u203A ", " "].some((sep) => sent.endsWith(`${sep}${title}`) && sent.length > sep.length + title.length);
32538
+ }
32525
32539
  function splitTestId(id) {
32526
32540
  const at2 = id.indexOf("::");
32527
32541
  return at2 === -1 ? { file: null, name: id } : { file: id.slice(0, at2), name: id.slice(at2 + 2) };
@@ -32573,6 +32587,8 @@ var TestConflictStop = class extends Error {
32573
32587
  conflicts;
32574
32588
  /** The failure the loop would have ended with, kept for when no report survives the check at the stop. */
32575
32589
  fallback;
32590
+ /** QUIKTR-1823: tests the AI reported that could not be (written once for many rows), for the person to look at before approving. */
32591
+ unreportable = [];
32576
32592
  /** What the loop did before it stopped (turns, tool calls, the test runs), for the run's record. Set by the loop. */
32577
32593
  summary;
32578
32594
  constructor(conflicts, fallback) {
@@ -32602,11 +32618,16 @@ var TestConflictTool = class {
32602
32618
  byTest = /* @__PURE__ */ new Map();
32603
32619
  counts = { calls: 0, recorded: 0, rejected: 0 };
32604
32620
  rejectedBy = {};
32621
+ generated = /* @__PURE__ */ new Map();
32605
32622
  max;
32606
32623
  /** The reports that stand, one per test, in the order they were first made. */
32607
32624
  recorded() {
32608
32625
  return [...this.byTest.values()];
32609
32626
  }
32627
+ /** QUIKTR-1823: the tests reported that are written once for many rows, one entry per test, in the order they were first reported. */
32628
+ unreportable() {
32629
+ return [...this.generated.values()];
32630
+ }
32610
32631
  /** Counts and closed words only, for the run's log. */
32611
32632
  record() {
32612
32633
  return { ...this.counts, rejectedBy: { ...this.rejectedBy } };
@@ -32660,7 +32681,13 @@ var TestConflictTool = class {
32660
32681
  const located = locateTests(path.path, loaded.lf);
32661
32682
  if (!located) return this.reject("unsupported_language");
32662
32683
  const matches = located.tests.map((t, index2) => ({ t, index: index2 })).filter(({ t }) => t.title === r.testTitle);
32663
- if (matches.length === 0) return this.reject("title_not_found");
32684
+ if (matches.length === 0) {
32685
+ const rows = located.generated.find((t) => isRowsTitle(r.testTitle, t.title));
32686
+ if (!rows) return this.reject("title_not_found");
32687
+ const rowsKey = `${path.path}\0${rows.startLine}`;
32688
+ if (!this.generated.has(rowsKey)) this.generated.set(rowsKey, { path: path.path, line: rows.startLine, caseId: r.caseId });
32689
+ return this.reject("generated_test");
32690
+ }
32664
32691
  if (matches.length > 1) return this.reject("title_not_unique");
32665
32692
  const { t: test, index } = matches[0];
32666
32693
  const applied = applyEdits(loaded.lf, [{ find: r.find, replace: r.replace }]);
@@ -36327,6 +36354,10 @@ var MAX_PREVIOUS_NAME_CHARS = 200;
36327
36354
  var MAX_PREVIOUS_WHOLE_MESSAGE_CHARS = 1e3;
36328
36355
  var MAX_PREVIOUS_MESSAGES_TOTAL_CHARS = 4e3;
36329
36356
  var MAX_PREVIOUS_COUNT = 1e5;
36357
+ var RUNTIME_CODE_SHAPE = /^[A-Z][A-Z0-9_]{0,39}$/;
36358
+ function runtimeCodeWord(code) {
36359
+ return RUNTIME_CODE_SHAPE.test(code) ? code : "other";
36360
+ }
36330
36361
  var COVERAGE_PREFIX = "Required test cases not written: ";
36331
36362
  function coverageSentence(ids) {
36332
36363
  const total = ids.length;
@@ -36422,7 +36453,9 @@ var REASON_WORDS = {
36422
36453
  transport: "the AI service could not be reached",
36423
36454
  turn_timeout: "one step took too long",
36424
36455
  loop_deadline: "the whole change took too long",
36425
- runtime_failed: "the AI service failed",
36456
+ runtime_failed: "the AI service returned an error",
36457
+ // QUIKTR-1824: the AI Service's CODEGEN_OUTPUT_TOO_LARGE / OUTPUT_TRUNCATED; told apart from a failing service (live run QTRIA-12).
36458
+ output_too_large: "the AI's answer was too long and was cut off",
36426
36459
  bad_reply: "the AI service sent a reply that could not be used",
36427
36460
  duplicate_call_ids: "the AI service repeated a request",
36428
36461
  final_not_produced: "it never reached an answer",
@@ -36434,36 +36467,59 @@ var REASON_WORDS = {
36434
36467
  coverage_missing: "it said it was finished but had not written a test for every case",
36435
36468
  truncation_guard: "a file it rewrote looked cut short",
36436
36469
  syntax_error: "a file it changed would not run (a syntax error, or a name that is used but never defined or imported)",
36437
- out_of_time: "the time allowed for writing the change ran out"
36470
+ out_of_time: "the time allowed for writing the change ran out",
36471
+ test_conflict_unreportable: "an existing test expects what an approved case calls wrong, and it is written once for many rows, so no change to it could be proposed"
36438
36472
  };
36439
36473
  function reasonInWords(reason) {
36440
36474
  return REASON_WORDS[reason] ?? reason;
36441
36475
  }
36442
- function exhaustedMessage(attempts, stop) {
36476
+ function failedAttemptRecord(n, failure) {
36477
+ return {
36478
+ n,
36479
+ outcome: "failed",
36480
+ reason: failure.reason,
36481
+ ...failure.runtimeCode ? { runtimeCode: runtimeCodeWord(failure.runtimeCode) } : {},
36482
+ turns: failure.summary?.turns ?? 0,
36483
+ toolCalls: failure.summary?.toolCalls ?? 0
36484
+ };
36485
+ }
36486
+ function attemptInWords(a, fallback) {
36487
+ const words = reasonInWords(a?.reason ?? fallback);
36488
+ return a?.runtimeCode && a.runtimeCode !== "other" ? `${words} (error code ${a.runtimeCode})` : words;
36489
+ }
36490
+ function exhaustedMessage(attempts, stop, unreportable) {
36443
36491
  const first = attempts[0];
36444
36492
  const second = attempts[1];
36445
- const firstWords = reasonInWords(first?.reason ?? "internal_error");
36493
+ const firstWords = attemptInWords(first, "internal_error");
36494
+ const blocking = unreportable[0];
36495
+ if (blocking) {
36496
+ const more = unreportable.length > 1 ? `, and ${unreportable.length - 1} more like it` : "";
36497
+ 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.`;
36498
+ }
36446
36499
  if (stop === "failed" && attempts.length === 1 && first?.reason === "test_case_disagree") {
36447
36500
  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.";
36448
36501
  }
36449
36502
  if (stop === "failed") {
36450
- return `QuikPilot could not write the change: neither attempt reached a result. The first attempt ended because ${firstWords}. The second attempt ended because ${reasonInWords(second?.reason ?? "internal_error")}. Nothing was written.`;
36503
+ return `QuikPilot could not write the change: neither attempt reached a result. The first attempt ended because ${firstWords}. The second attempt ended because ${attemptInWords(second, "internal_error")}. Nothing was written.`;
36451
36504
  }
36452
36505
  const head = "QuikPilot could not write the change in the time allowed. ";
36453
36506
  if (second?.outcome === "not_started") {
36454
36507
  return first?.reason === "out_of_time" ? `${head}The first attempt ended because ${firstWords}, so there was no time for a second attempt. Nothing was written.` : `${head}The first attempt ended because ${firstWords}, and there was not enough time left for a second attempt. Nothing was written.`;
36455
36508
  }
36456
- return `${head}The first attempt ended because ${firstWords}. The second attempt ended because ${reasonInWords(second?.reason ?? "out_of_time")}. Nothing was written.`;
36509
+ return `${head}The first attempt ended because ${firstWords}. The second attempt ended because ${attemptInWords(second, "out_of_time")}. Nothing was written.`;
36457
36510
  }
36458
36511
  var CodegenAttemptsExhausted = class extends Error {
36459
36512
  attempts;
36460
36513
  /** `out_of_time` when the shared clock decided the end, `failed` when both attempts ended without a result for any other reason. */
36461
36514
  stopReason;
36462
- constructor(attempts, stopReason) {
36463
- super(exhaustedMessage(attempts, stopReason));
36515
+ /** QUIKTR-1823: existing tests written once for many rows that stood in the way (path, line, case), when that is why the step ended. */
36516
+ unreportable;
36517
+ constructor(attempts, stopReason, unreportable = []) {
36518
+ super(exhaustedMessage(attempts, stopReason, unreportable));
36464
36519
  this.name = "CodegenAttemptsExhausted";
36465
36520
  this.attempts = attempts;
36466
36521
  this.stopReason = stopReason;
36522
+ this.unreportable = [...unreportable];
36467
36523
  }
36468
36524
  };
36469
36525
  var RULE_SHAPE = /^[a-z][a-z0-9_]{0,39}$/;
@@ -40463,6 +40519,7 @@ var SafetyRefusalError = class extends RuntimeReplyError {
40463
40519
  }
40464
40520
  };
40465
40521
  var NO_FALLBACK_CODES = /* @__PURE__ */ new Set(["RUN_BUDGET_EXCEEDED", "RUN_CREDENTIAL_SCOPE"]);
40522
+ var OUTPUT_TOO_LARGE_CODES = /* @__PURE__ */ new Set(["CODEGEN_OUTPUT_TOO_LARGE", "OUTPUT_TRUNCATED"]);
40466
40523
  var TOOL_NAMES = /* @__PURE__ */ new Set(["list_files", "read_file", "grep", "find_definition"]);
40467
40524
  var MAX_ID_CHARS = 64;
40468
40525
  var MAX_CALLS_IN_A_REPLY = 50;
@@ -40605,7 +40662,7 @@ async function runTargetingLoop(args, deps) {
40605
40662
  const fallbackText = `pilot.targeting failed: ${runtimeCode}`;
40606
40663
  throw new SafetyRefusalError(inner?.message ?? fallbackText, inner?.summary ?? fallbackText);
40607
40664
  }
40608
- throw new LoopFailure("runtime_failed", runtimeCode);
40665
+ throw new LoopFailure(runtimeCode && OUTPUT_TOO_LARGE_CODES.has(runtimeCode) ? "output_too_large" : "runtime_failed", runtimeCode);
40609
40666
  }
40610
40667
  let body;
40611
40668
  try {
@@ -40771,6 +40828,8 @@ var CodegenLoopFailure = class extends Error {
40771
40828
  /** QUIKTR-1607: what this attempt did, step by step, for the next one (§32). Wire only: never logged, never recorded. */
40772
40829
  steps;
40773
40830
  summary;
40831
+ /** QUIKTR-1823 (`test_conflict_unreportable` only): where each such test is and which case it contradicts. Never a title. */
40832
+ unreportable;
40774
40833
  constructor(reason, runtimeCode, cause, detail, told) {
40775
40834
  super(`pilot.codegen loop failed: ${reason}${runtimeCode ? ` (${runtimeCode})` : ""}`);
40776
40835
  this.name = "CodegenLoopFailure";
@@ -40781,6 +40840,24 @@ var CodegenLoopFailure = class extends Error {
40781
40840
  if (cause !== void 0) this.cause = cause;
40782
40841
  }
40783
40842
  };
40843
+ var MAX_UNREPORTABLE_DETAIL_CHARS = 300;
40844
+ function unreportableFailure(tests, cause) {
40845
+ const detail = tests.map((t) => `${t.path} line ${t.line} (case ${t.caseId})`).join("; ").slice(0, MAX_UNREPORTABLE_DETAIL_CHARS);
40846
+ const failure = new CodegenLoopFailure("test_conflict_unreportable", void 0, cause, detail);
40847
+ failure.unreportable = [...tests];
40848
+ if (cause.summary) failure.summary = cause.summary;
40849
+ if (cause.lastTestAnswer) failure.lastTestAnswer = cause.lastTestAnswer;
40850
+ if (cause.steps) failure.steps = cause.steps;
40851
+ return failure;
40852
+ }
40853
+ function withUnreportable(stop, tests) {
40854
+ if (tests.length === 0) return stop;
40855
+ const fallback = stop.fallback instanceof CodegenLoopFailure ? stop.fallback : new CodegenLoopFailure("cannot_complete");
40856
+ const carried = new TestConflictStop(stop.conflicts, fallback.reason === "test_conflict_unreportable" ? fallback : unreportableFailure(tests, fallback));
40857
+ carried.unreportable = [...tests];
40858
+ if (stop.summary) carried.summary = stop.summary;
40859
+ return carried;
40860
+ }
40784
40861
  function samePlace2(a, b) {
40785
40862
  const x = a.replace(/\\/g, "/").replace(/^(\.\/)+/, "");
40786
40863
  const y = b.replace(/\\/g, "/").replace(/^(\.\/)+/, "");
@@ -41137,7 +41214,7 @@ async function runCodegenLoop(args, deps) {
41137
41214
  const fallbackText = `pilot.codegen failed: ${runtimeCode}`;
41138
41215
  throw new SafetyRefusalError(inner?.message ?? fallbackText, inner?.summary ?? fallbackText);
41139
41216
  }
41140
- throw new CodegenLoopFailure("runtime_failed", runtimeCode);
41217
+ throw new CodegenLoopFailure(runtimeCode && OUTPUT_TOO_LARGE_CODES.has(runtimeCode) ? "output_too_large" : "runtime_failed", runtimeCode);
41141
41218
  }
41142
41219
  let body;
41143
41220
  try {
@@ -41164,6 +41241,9 @@ async function runCodegenLoop(args, deps) {
41164
41241
  if (conflictTool && conflictTool.recorded().length > 0) {
41165
41242
  throw new TestConflictStop(conflictTool.recorded(), new CodegenLoopFailure("cannot_complete", void 0, void 0, said, said));
41166
41243
  }
41244
+ if (conflictTool && conflictTool.unreportable().length > 0) {
41245
+ throw unreportableFailure(conflictTool.unreportable(), new CodegenLoopFailure("cannot_complete", void 0, void 0, said, said));
41246
+ }
41167
41247
  const last = lastTestAnswer;
41168
41248
  const redLeft = harness && args.phase === "tests" ? redProblem() : null;
41169
41249
  if (harness && args.phase === "tests" && currentRedRuns().some((r) => r.failing.length > 0) && handOverRefusal(turn, true) === null && (redLeft === null || redLeft.kind === "passing")) {
@@ -41355,19 +41435,21 @@ async function runCodegenLoop(args, deps) {
41355
41435
  } catch (err) {
41356
41436
  if (err instanceof SafetyRefusalError) throw err;
41357
41437
  if (err instanceof TreeNotRestoredError) throw err;
41438
+ const unreportable = conflictTool?.unreportable() ?? [];
41358
41439
  if (err instanceof TestConflictStop) {
41359
41440
  err.summary ??= snapshot("test_conflict");
41360
- throw err;
41441
+ throw withUnreportable(err, unreportable);
41361
41442
  }
41362
- const failure = err instanceof CodegenLoopFailure ? err : new CodegenLoopFailure("internal_error", void 0, err);
41443
+ let failure = err instanceof CodegenLoopFailure ? err : new CodegenLoopFailure("internal_error", void 0, err);
41363
41444
  if (conflictTool && conflictTool.recorded().length > 0) {
41364
41445
  const stop = new TestConflictStop(conflictTool.recorded(), failure);
41365
41446
  stop.summary = failure.summary ?? snapshot("test_conflict");
41366
- throw stop;
41447
+ throw withUnreportable(stop, unreportable);
41367
41448
  }
41368
41449
  failure.summary ??= snapshot("fallback");
41369
41450
  if (lastTestAnswer) failure.lastTestAnswer ??= lastTestAnswer;
41370
41451
  failure.steps ??= sentSteps();
41452
+ if (unreportable.length > 0 && failure.reason !== "test_conflict_unreportable") failure = unreportableFailure(unreportable, failure);
41371
41453
  throw failure;
41372
41454
  }
41373
41455
  }
@@ -41767,6 +41849,8 @@ function buildCodegenLoopRecord(loop) {
41767
41849
  n: a.n,
41768
41850
  outcome: a.outcome.slice(0, MAX_STATUS_KEY_CHARS),
41769
41851
  ...reason.length > 0 ? { reason } : {},
41852
+ // QUIKTR-1824: the AI Service's own code, as a closed word (its shape), never a sentence.
41853
+ ...typeof a.runtimeCode === "string" ? { runtimeCode: runtimeCodeWord(a.runtimeCode) } : {},
41770
41854
  turns: small(a.turns),
41771
41855
  toolCalls: small(a.toolCalls),
41772
41856
  ...a.startedBy && STARTED_BY.has(a.startedBy) ? { startedBy: a.startedBy } : {},
@@ -42215,12 +42299,10 @@ function keptAttempt(n, summary) {
42215
42299
  return { n, outcome: "kept", reason: "cannot_complete", turns: summary.turns, toolCalls: summary.toolCalls };
42216
42300
  }
42217
42301
  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.`;
42218
- function failedAttempt(n, failure) {
42219
- return { n, outcome: "failed", reason: failure.reason, turns: failure.summary?.turns ?? 0, toolCalls: failure.summary?.toolCalls ?? 0 };
42220
- }
42221
- function lose(p, summary, attempts, stop) {
42302
+ var failedAttempt = failedAttemptRecord;
42303
+ function lose(p, summary, attempts, stop, unreportable) {
42222
42304
  p.out.loop = buildCodegenLoopRecord({ ...summary ?? NO_SUMMARY, stopReason: stop, attempts });
42223
- return new CodegenAttemptsExhausted(attempts, stop);
42305
+ return new CodegenAttemptsExhausted(attempts, stop, unreportable);
42224
42306
  }
42225
42307
  function oldCodeRunner(args, log, now) {
42226
42308
  return async (files) => {
@@ -42312,7 +42394,12 @@ async function runCodegenStep(p) {
42312
42394
  if (err instanceof TreeNotRestoredError) throw err;
42313
42395
  if (err instanceof TestConflictStop) {
42314
42396
  const settled = await settleStop(err);
42315
- if (settled) throw settled;
42397
+ if (settled) {
42398
+ for (const t of err.unreportable) {
42399
+ warn(p, `Another existing test, in ${t.path} line ${t.line}, also expects what case ${t.caseId} calls wrong. It is written once for many rows, so no change to it was proposed: look at it before you approve.`);
42400
+ }
42401
+ throw settled;
42402
+ }
42316
42403
  return { failure: err.fallback instanceof CodegenLoopFailure ? err.fallback : new CodegenLoopFailure("cannot_complete") };
42317
42404
  }
42318
42405
  return { failure: err instanceof CodegenLoopFailure ? err : new CodegenLoopFailure("internal_error", void 0, err) };
@@ -42399,6 +42486,7 @@ async function runCodegenStep(p) {
42399
42486
  await guardTree();
42400
42487
  const firstRecord = failedAttempt(1, f1);
42401
42488
  if ("final" in first && first.final) throw lose(p, f1.summary, [firstRecord], "failed");
42489
+ if (f1.reason === "test_conflict_unreportable") throw lose(p, f1.summary, [firstRecord], "failed", f1.unreportable);
42402
42490
  const testLimit = p.mode === "loop-tests" && p.tests ? await oneTestRunMs(p.tests) : null;
42403
42491
  const left = hardStopAtMs - now();
42404
42492
  const needed = secondAttemptFloorMs({ firstAttemptMs: firstMs, testLimitMs: testLimit });
@@ -42430,7 +42518,7 @@ async function runCodegenStep(p) {
42430
42518
  }
42431
42519
  const f2 = second.failure;
42432
42520
  log({ event: "codegen.attempt_end", attempt: 2, outcome: "failed", reason: f2.reason, turns: f2.summary?.turns ?? 0, toolCalls: f2.summary?.toolCalls ?? 0, durationMs: secondMs });
42433
- throw lose(p, f2.summary, [firstRecord, failedAttempt(2, f2)], f2.reason === "out_of_time" ? "out_of_time" : "failed");
42521
+ throw lose(p, f2.summary, [firstRecord, failedAttempt(2, f2)], f2.reason === "out_of_time" ? "out_of_time" : "failed", f2.unreportable);
42434
42522
  }
42435
42523
 
42436
42524
  // src/codegenHeal.ts
@@ -44223,7 +44311,7 @@ var FAILURE_ARTIFACT_DIR = "quikpilot-failure";
44223
44311
  var REPORT_COPY = "final-test-report.xml";
44224
44312
  var MAX_REPORT_BYTES = 5 * 1024 * 1024;
44225
44313
  var MAX_FILES = 200;
44226
- var RUNNER_VERSION = true ? "9.3.0-rc.40" : "dev";
44314
+ var RUNNER_VERSION = true ? "9.3.0-rc.41" : "dev";
44227
44315
  function safeDestination(base, repoPath) {
44228
44316
  if (!repoPath || (0, import_node_path23.isAbsolute)(repoPath)) return null;
44229
44317
  const destination = (0, import_node_path23.resolve)(base, repoPath);