@quikit/quikpilot-runner 9.3.0-rc.64 → 9.3.0-rc.65

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
@@ -172,6 +172,8 @@ wrong (a field that arrives from a database row or a request), so it only warns
172
172
 
173
173
  **9.3.0-rc.62 - an approved test that is reported again is refused with what to do (QUIKTR-1951).** When a person has approved a change to an existing test and the AI reports that test again before the final test run (a second row of a table test that still expects the old behaviour), the answer was only `already_decided`: "Do not report it again". It now also says what the AI can do: finish the code first, and if rows of that test still fail in the final test run, the fix step that follows may report the test once more (QUIKTR-1844). Nothing about WHEN a test can be reported changes, so a person is still asked only when there is evidence; a test a person judged right, or reported in another file, keeps the bare refusal exactly. A new log event `codegen.conflict_refused_approved` (phase only) counts how often it happens. No change to the contract with the AI service. The AI Runtime's QUIKTR-1952 (a hung OpenRouter call is cut at 150 s for QuikPilot calls, so the backup model answers inside the runner's turn limit) ships with this version and needs no runner setting.
174
174
 
175
+ **9.3.0-rc.65 - the one correction of QuikPilot's own test now works on Python and Go (QUIKTR-2000).** When the code phase gives up because exactly one of the tests QuikPilot wrote itself still fails, it gets one chance to correct that test's expected value (QUIKTR-1608). Until now the runner recognised the failing test only by its file path, but pytest names a test by its module (`tests.test_grouping`) and gotestsum by its package, so on those languages the correction never ran: sqlparse run QTPY-15 (2 Nov) logged `frozenFailing: 0, amendFiles: 0` with exactly one of its own tests failing, and failed with no PR. Both places that match failing tests to the run's frozen tests (the amendment and the hand-over of a DONE whose own test still fails) now use the rule QUIKTR-1950 uses for the same names (`idPlaceMatches`); a path name is matched exactly as before. When several frozen files share the test's place (a Go or Java package), the one whose text defines the test is chosen, and when that is not exactly one file nothing is amended. The give-up log line also says how many failing tests the last run listed (`failingSeen`). Nothing changes on the AI Runtime or in QuikProjects; `QUIKPILOT_ROW_NAMES=js` gives back the old path-only matching. Also in rc.65: everything in rc.64.
176
+
175
177
  **9.3.0-rc.64 - every re-read of a file says why it happened, and (switched off by default) the files the AI is working in are no longer shrunk while it works on them (QUIKTR-1963).** In QuikIT bug 3 (31 Oct) the AI read the same 429-line test file 28 times in 40 turns and gave up. On the notes versions an answer older than the latest three turns is shrunk to a one-line stub on every turn, whatever the request's size, with no exception for the file being worked on; but some re-reads came one turn later, so paging through the file or indecision may be part of it. (1) Always on, log only: each `read_file` on the turn line now carries its line range, and a read of a file already read in the loop logs `codegen.reread` with the earlier read's turn and range, how the two ranges meet (`same`, `overlapping`, `disjoint`), what had become of the earlier answer (`whole`, `stubbed`, `dropped`, `after_write`) and whether it was answered as a repeat; `codegen.reread_summary` counts them at the loop's end. Paths and line numbers only, never file text. (2) `QUIKPILOT_KEEP_WORKING_FILES=on` (off by default; the workflow can set it): the newest answer per range of the files the AI is working in (a file it changed, or read in two different turns; at most three files and 40,000 characters, newest first) stays whole instead of shrinking, and only answers made after the file's latest change count, so a stale read is never kept; a repeat's copy of an earlier answer can then shrink like the answer itself. The hard ceiling's last-resort drop still drops anything, so a request never exceeds today's limit. With the switch off every request the AI Runtime receives is what it was. Nothing changes on the AI Runtime or in QuikProjects. Also in rc.64: everything in rc.63.
176
178
 
177
179
  **9.3.0-rc.63 - a reply the AI service could not read is asked again once instead of ending the attempt (QUIKTR-1953).** On 30 Oct 3% of the AI calls of a run (8 of 267) came back as `SCHEMA_MISMATCH`: the AI service could not read the AI's reply in the required format, even after its own repair and one retry. Each one ended the whole attempt, and with two attempts per job two of them ended a job with nothing written (QTRIA-28 lost its file search to one). The runner lost nothing with such a turn, so the request is now made again, once, in the way a cut-off or a slow turn already is (QUIKTR-1853): one fixed sentence in the AI's transcript says its last answer could not be read in the required format and asks for exactly one reply in that format and a smaller step; the turn is recorded like the other recovered turns and is never counted as a refusal. It applies to the code-writing loop and to the file-search loop (where only this code is recovered: a cut-off or a slow turn there still falls back to the single call, as before). A second unreadable reply straight after the first, the final turn, and `QUIKPILOT_TURN_RECOVERY=off` end the attempt exactly as before; when it is the second in a row the failure message says so. New log event `targeting.loop_recovered` (the code-writing loop's `codegen.loop_recovered` now also carries `reason: schema_mismatch`). Nothing is deployed on the AI service, and nothing about the reply that failed is shown to the AI or logged.
package/dist/index.js CHANGED
@@ -29193,6 +29193,12 @@ function rowBase(name2) {
29193
29193
  if (paren > 0 && base.endsWith(")")) base = base.slice(0, paren);
29194
29194
  return base;
29195
29195
  }
29196
+ function definesTest(text3, name2) {
29197
+ const base = rowBase(name2);
29198
+ if (base === "" || base === PARAMETERIZED_ROWS) return false;
29199
+ if (!/^[A-Za-z0-9_]+$/.test(base)) return text3.includes(base);
29200
+ return new RegExp(`(^|[^A-Za-z0-9_])${base}([^A-Za-z0-9_]|$)`).test(text3);
29201
+ }
29196
29202
  function rowNamesOf(names) {
29197
29203
  return names.filter((n) => !names.some((o) => o.startsWith(`${n}/`)));
29198
29204
  }
@@ -41370,12 +41376,6 @@ function samePlace(a, b) {
41370
41376
  const y = normalisePath2(b);
41371
41377
  return x === y || x.endsWith(`/${y}`) || y.endsWith(`/${x}`);
41372
41378
  }
41373
- function definesTest(text3, name2) {
41374
- const base = rowBase(name2);
41375
- if (base === "" || base === PARAMETERIZED_ROWS) return false;
41376
- if (!/^[A-Za-z0-9_]+$/.test(base)) return text3.includes(base);
41377
- return new RegExp(`(^|[^A-Za-z0-9_])${base}([^A-Za-z0-9_]|$)`).test(text3);
41378
- }
41379
41379
  function ownFailureIds(newFailures, changedPaths, requiredIds, changedText) {
41380
41380
  const own = /* @__PURE__ */ new Set();
41381
41381
  for (const id of newFailures) {
@@ -47369,11 +47369,6 @@ function withUnreportable(stop2, tests) {
47369
47369
  if (stop2.summary) carried.summary = stop2.summary;
47370
47370
  return carried;
47371
47371
  }
47372
- function samePlace2(a, b) {
47373
- const x = a.replace(/\\/g, "/").replace(/^(\.\/)+/, "");
47374
- const y = b.replace(/\\/g, "/").replace(/^(\.\/)+/, "");
47375
- return x === y || x.endsWith(`/${y}`) || y.endsWith(`/${x}`);
47376
- }
47377
47372
  var MAX_ID_CHARS2 = 64;
47378
47373
  var MAX_RED_REFUSALS = 1;
47379
47374
  var NOTHING_NEW = /* @__PURE__ */ new Set(["duplicate", "no_effect", "no_change_since_last_run", "no_match", "ambiguous", "conflict_rejected"]);
@@ -47980,7 +47975,7 @@ async function runCodegenLoop(args2, deps) {
47980
47975
  const doneSummary = typeof body2.summary === "string" ? body2.summary.slice(0, MAX_SUMMARY_CHARS) : "";
47981
47976
  const lane = args2.lane;
47982
47977
  if (harness && args2.phase === "code" && lane?.kind === "code" && !lane.amend && args2.keepOnGiveUp === true) {
47983
- const red2 = currentRedRuns().filter((r) => r.failing.some((name2) => lane.frozen.some((p) => samePlace2(name2.split("::")[0] ?? "", p)))).at(-1);
47978
+ const red2 = currentRedRuns().filter((r) => r.failing.some((name2) => lane.frozen.some((p) => idPlaceMatches(name2.split("::")[0] ?? "", p)))).at(-1);
47984
47979
  if (red2?.answer) {
47985
47980
  log({ event: "codegen.loop_kept", files: overlay.changedPaths().length, regressions: red2.answer.regressions, newFailures: red2.answer.newFailures, after: "done" });
47986
47981
  return { results: overlay.results(), summary: snapshot("gave_up_kept"), doneSummary, gaveUp: true, steps: sentSteps(), lastTestAnswer: red2.answer };
@@ -48157,6 +48152,22 @@ async function runCodegenLoop(args2, deps) {
48157
48152
 
48158
48153
  // src/codegenPhases.ts
48159
48154
  var QP_TOKEN = /\[QP-[^\]\s]+\]/;
48155
+ function frozenFailingTarget(failingTests, frozen, textOf) {
48156
+ const fileOf = (name3) => name3.split("::")[0] ?? "";
48157
+ const failing = failingTests.filter((name3) => {
48158
+ const file2 = fileOf(name3);
48159
+ return file2 !== "" && frozen.some((path) => idPlaceMatches(file2, path));
48160
+ });
48161
+ if (failing.length !== 1 || !QP_TOKEN.test(failing[0])) return { failing, amend: null };
48162
+ const name2 = failing[0];
48163
+ const file = fileOf(name2);
48164
+ const candidates = frozen.filter((path) => idPlaceMatches(file, path));
48165
+ if (candidates.length === 1) return { failing, amend: candidates[0] };
48166
+ const sep = name2.indexOf("::");
48167
+ const testName = (sep >= 0 ? name2.slice(sep + 2) : name2).replace(QP_TOKEN, "").trim();
48168
+ const owners = candidates.filter((path) => definesTest(textOf(path) ?? "", testName));
48169
+ return { failing, amend: owners.length === 1 ? owners[0] : null };
48170
+ }
48160
48171
  function testBlock(text3, token) {
48161
48172
  const lines = text3.split("\n");
48162
48173
  const at2 = lines.flatMap((line, n) => line.includes(token) ? [n] : []);
@@ -48291,15 +48302,13 @@ async function runPhases(i3) {
48291
48302
  i3.log({ event: "codegen.phase_end", attempt: i3.attempt, phase: "code", outcome: "finished" });
48292
48303
  return { done: d2, tests, phases, summaries };
48293
48304
  }
48294
- const frozenFailing = (d2.lastTestAnswer?.failingTests ?? []).filter((name2) => {
48295
- const file2 = name2.split("::")[0] ?? "";
48296
- return file2 !== "" && tests.frozen.some((path2) => samePlace2(file2, path2));
48297
- });
48298
- const token = frozenFailing.length === 1 && d2.lastTestAnswer?.truncated !== true ? QP_TOKEN.exec(frozenFailing[0])?.[0] : void 0;
48299
- const file = token ? frozenFailing[0].split("::")[0] ?? "" : "";
48300
- const amend = token ? tests.frozen.filter((path2) => samePlace2(file, path2)).slice(0, 1) : [];
48305
+ const failingSeen = d2.lastTestAnswer?.failingTests ?? [];
48306
+ const target = frozenFailingTarget(failingSeen, tests.frozen, (path2) => tests.results.find((r) => r.targetPath === path2)?.newContent);
48307
+ const frozenFailing = target.failing;
48308
+ const token = target.amend !== null && d2.lastTestAnswer?.truncated !== true ? QP_TOKEN.exec(frozenFailing[0])?.[0] : void 0;
48309
+ const amend = token && target.amend !== null ? [target.amend] : [];
48301
48310
  phases.push(record("code", "gave_up", d2.summary));
48302
- i3.log({ event: "codegen.phase_end", attempt: i3.attempt, phase: "code", outcome: "gave_up", amendFiles: amend.length, frozenFailing: frozenFailing.length });
48311
+ i3.log({ event: "codegen.phase_end", attempt: i3.attempt, phase: "code", outcome: "gave_up", amendFiles: amend.length, frozenFailing: frozenFailing.length, failingSeen: failingSeen.length });
48303
48312
  if (amend.length === 0 || !token) return { done: d2, tests, phases, summaries };
48304
48313
  i3.log({ event: "codegen.phase_start", attempt: i3.attempt, phase: "amend", files: amend.length });
48305
48314
  let d3;
@@ -49705,13 +49714,13 @@ function healReviewPreviousAttempt(attempt2, blocks, answer) {
49705
49714
  }
49706
49715
 
49707
49716
  // src/codegenHeal.ts
49708
- var samePlace3 = (a, b) => {
49717
+ var samePlace2 = (a, b) => {
49709
49718
  const x = a.replace(/\\/g, "/").replace(/^(\.\/)+/, "");
49710
49719
  const y = b.replace(/\\/g, "/").replace(/^(\.\/)+/, "");
49711
49720
  return x === y || x.endsWith(`/${y}`) || y.endsWith(`/${x}`);
49712
49721
  };
49713
49722
  function withMisfits(conflicts, misfits) {
49714
- const misfitOf = (path, title) => misfits.find((m) => samePlace3(m.path, path) && m.testTitle === title);
49723
+ const misfitOf = (path, title) => misfits.find((m) => samePlace2(m.path, path) && m.testTitle === title);
49715
49724
  const decided = conflicts.decided.map((d) => d.decision === "TEST_CHANGED" && misfitOf(d.path, d.testTitle) ? { ...d, stillFailing: true } : d);
49716
49725
  const revisable = (conflicts.approvedTests ?? []).flatMap((t) => {
49717
49726
  const m = misfitOf(t.path, t.title);
@@ -51624,7 +51633,7 @@ var FAILURE_ARTIFACT_DIR = "quikpilot-failure";
51624
51633
  var REPORT_COPY = "final-test-report.xml";
51625
51634
  var MAX_REPORT_BYTES = 5 * 1024 * 1024;
51626
51635
  var MAX_FILES = 200;
51627
- var RUNNER_VERSION = true ? "9.3.0-rc.64" : "dev";
51636
+ var RUNNER_VERSION = true ? "9.3.0-rc.65" : "dev";
51628
51637
  function safeDestination(base, repoPath) {
51629
51638
  if (!repoPath || (0, import_node_path26.isAbsolute)(repoPath)) return null;
51630
51639
  const destination = (0, import_node_path26.resolve)(base, repoPath);