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

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,16 @@ 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.98 - the tests the run wrote reach the pull request even when the repository ignores test files (QUIKTR-2851).** A repository that lists its test files in .gitignore (`*.test.ts`; QuikProjects' own repository does) got pull requests without the tests QuikPilot wrote and ran: the change was staged with `git add -A`, which skips ignored files, and nothing said so.
198
+ - **What is committed now.** The files the run itself created (through its one write of the change to disk) are staged with `git add -f`, inside the run's folder when it has one. A file created by an attempt that was undone is gone from disk, so it is not staged.
199
+ - **What is still left out.** Every other ignored file: a build output, a file a command wrote, and a file that was there before the run, even if the AI edited it. The denied paths are checked on everything staged, as before.
200
+ - **The final-change listing** (the parts check and the database-change check) counts the created files too, so both see what the pull request holds.
201
+
202
+ **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.
203
+ - **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.
204
+ - **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).
205
+ - **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.
206
+
197
207
  **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
208
  - the AI was told its tests pass and still gave up (or the attempt before ended so);
199
209
  - 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);
package/dist/index.js CHANGED
@@ -29091,14 +29091,19 @@ function checkoutTargetBranch(targetBranch) {
29091
29091
  }
29092
29092
  var LIST_MAX_BUFFER_BYTES = 64 * 1024 * 1024;
29093
29093
  var RUNNER_OWN_FOLDER = ".quikpilot";
29094
- function addAll(scope) {
29094
+ var FORCE_ADD_CHUNK = 200;
29095
+ function addAll(scope, created = []) {
29095
29096
  if (!scope) {
29096
29097
  git(["add", "-A"]);
29097
- return;
29098
- }
29099
- for (const path of [scope, RUNNER_OWN_FOLDER]) {
29100
- if ((0, import_node_fs.existsSync)(path)) git(["add", "-A", "--", path]);
29098
+ } else {
29099
+ for (const path of [scope, RUNNER_OWN_FOLDER]) {
29100
+ if ((0, import_node_fs.existsSync)(path)) git(["add", "-A", "--", path]);
29101
+ }
29101
29102
  }
29103
+ const prefix = scope ? scope.endsWith("/") ? scope : `${scope}/` : "";
29104
+ const inScope = scope ? created.filter((p) => p === scope || p.startsWith(prefix)) : [...created];
29105
+ const forced = inScope.filter((p) => (0, import_node_fs.existsSync)(p));
29106
+ for (let i3 = 0; i3 < forced.length; i3 += FORCE_ADD_CHUNK) git(["add", "-f", "--", ...forced.slice(i3, i3 + FORCE_ADD_CHUNK)]);
29102
29107
  }
29103
29108
  function changedOutside(scope) {
29104
29109
  const out2 = (0, import_node_child_process.execFileSync)("git", [...NO_HOOKS_ARGS, "status", "--porcelain", "-z", "--untracked-files=all", "--no-renames"], {
@@ -42022,6 +42027,23 @@ function safeRepoTarget(rel, root = process.cwd()) {
42022
42027
  }
42023
42028
  }
42024
42029
  }
42030
+ var createdByRun = /* @__PURE__ */ new Map();
42031
+ function filesCreatedByRun(root = process.cwd()) {
42032
+ let rootReal;
42033
+ try {
42034
+ rootReal = (0, import_node_fs10.realpathSync)(root);
42035
+ } catch {
42036
+ return [];
42037
+ }
42038
+ const isFile = (path) => {
42039
+ try {
42040
+ return (0, import_node_fs10.statSync)((0, import_node_path13.join)(rootReal, path)).isFile();
42041
+ } catch {
42042
+ return false;
42043
+ }
42044
+ };
42045
+ return [...createdByRun.get(rootReal) ?? []].filter(isFile).sort();
42046
+ }
42025
42047
  function writeRepoFile(rel, content, root = process.cwd()) {
42026
42048
  const path = canonicalPath(rel);
42027
42049
  if (path === null) throw new DiskWriteRefused("bad_path");
@@ -42049,13 +42071,20 @@ function writeRepoFile(rel, content, root = process.cwd()) {
42049
42071
  (0, import_node_fs10.mkdirSync)(d);
42050
42072
  if ((0, import_node_fs10.lstatSync)(d).isSymbolicLink()) throw new DiskWriteRefused("outside_checkout");
42051
42073
  }
42074
+ let created = false;
42052
42075
  try {
42053
42076
  const stat = (0, import_node_fs10.lstatSync)(abs);
42054
42077
  if (stat.isSymbolicLink() || !stat.isFile()) throw new DiskWriteRefused("not_a_file");
42055
42078
  } catch (err2) {
42056
42079
  if (err2 instanceof DiskWriteRefused) throw err2;
42080
+ created = true;
42057
42081
  }
42058
42082
  (0, import_node_fs10.writeFileSync)(abs, content);
42083
+ if (created) {
42084
+ const set2 = createdByRun.get(rootReal) ?? /* @__PURE__ */ new Set();
42085
+ set2.add(path);
42086
+ createdByRun.set(rootReal, set2);
42087
+ }
42059
42088
  }
42060
42089
 
42061
42090
  // src/baselineCheck.ts
@@ -42684,7 +42713,9 @@ var PROMPT_OVERHEAD_BY_VERSION = Object.freeze({
42684
42713
  "targeting-loop-2": 10500,
42685
42714
  "targeting-loop-3": 11e3,
42686
42715
  "targeting-loop-4": 12500,
42687
- "investigate-loop-1": 7e3
42716
+ "investigate-loop-1": 7e3,
42717
+ // QUIKTR-2821: the AI Runtime's value for loop-2 (measured worst case 6,088).
42718
+ "investigate-loop-2": 7e3
42688
42719
  });
42689
42720
  var LARGEST_OVERHEAD = Math.max(...Object.values(PROMPT_OVERHEAD_BY_VERSION));
42690
42721
  function promptOverheadTokens(version2) {
@@ -54457,7 +54488,7 @@ async function verifyChange(ctx, results, undoable) {
54457
54488
  // src/guardrail.ts
54458
54489
  var MAX_LEFT_OUT_NAMES2 = 10;
54459
54490
  function checkGuardrail(deniedPaths, writeRoot = "") {
54460
- addAll(writeRoot || void 0);
54491
+ addAll(writeRoot || void 0, filesCreatedByRun());
54461
54492
  const deleted = stagedDeletions();
54462
54493
  unstage(deleted);
54463
54494
  const deletionsLeftOut = { count: deleted.length, names: deleted.filter((p) => matchesDeniedPath(p, readDenied(deniedPaths)) === null).slice(0, MAX_LEFT_OUT_NAMES2) };
@@ -55118,7 +55149,7 @@ var FAILURE_ARTIFACT_DIR = "quikpilot-failure";
55118
55149
  var REPORT_COPY = "final-test-report.xml";
55119
55150
  var MAX_REPORT_BYTES = 5 * 1024 * 1024;
55120
55151
  var MAX_FILES = 200;
55121
- var RUNNER_VERSION = true ? "9.3.0-rc.96" : "dev";
55152
+ var RUNNER_VERSION = true ? "9.3.0-rc.98" : "dev";
55122
55153
  function safeDestination(base, repoPath) {
55123
55154
  if (!repoPath || (0, import_node_path27.isAbsolute)(repoPath)) return null;
55124
55155
  const destination = (0, import_node_path27.resolve)(base, repoPath);
@@ -55210,9 +55241,10 @@ function statusPaths(root) {
55210
55241
  encoding: "utf8",
55211
55242
  maxBuffer: 64 * 1024 * 1024
55212
55243
  });
55213
- return new Set(
55214
- status.split("\0").filter((entry) => entry.length > 3).map((entry) => entry.slice(3))
55215
- );
55244
+ return /* @__PURE__ */ new Set([
55245
+ ...status.split("\0").filter((entry) => entry.length > 3).map((entry) => entry.slice(3)),
55246
+ ...filesCreatedByRun(root)
55247
+ ]);
55216
55248
  }
55217
55249
  var isFileOnDisk = (root, path) => {
55218
55250
  try {
@@ -56846,7 +56878,7 @@ async function runReadinessCheck(env2) {
56846
56878
  }
56847
56879
 
56848
56880
  // src/investigateFindings.ts
56849
- var VERDICTS = ["PRESENT", "NOT_PRESENT", "CANNOT_TELL", "NEW_BEHAVIOUR"];
56881
+ var VERDICTS = ["PRESENT", "NOT_PRESENT", "CANNOT_TELL", "NEW_BEHAVIOUR", "ALREADY_WORKS"];
56850
56882
  var ROLES = ["entry_point", "faulty_function", "caller", "helper", "test", "other"];
56851
56883
  var MAX_FILES3 = 12;
56852
56884
  var MAX_CALL_PATH = 10;
@@ -57003,7 +57035,7 @@ function verifyFindings(raw, ledger, ctx) {
57003
57035
  }
57004
57036
  let verdict = VERDICTS.includes(raw.verdict) ? raw.verdict : "CANNOT_TELL";
57005
57037
  let downgraded = false;
57006
- const supported = verdict === "PRESENT" ? evidence.length > 0 : verdict === "NOT_PRESENT" ? searches.length > 0 : verdict === "NEW_BEHAVIOUR" ? files.length > 0 || evidence.length > 0 : true;
57038
+ 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;
57007
57039
  if (!supported) {
57008
57040
  verdict = "CANNOT_TELL";
57009
57041
  downgraded = true;
@@ -57012,7 +57044,8 @@ function verifyFindings(raw, ledger, ctx) {
57012
57044
  }
57013
57045
 
57014
57046
  // src/investigateLoop.ts
57015
- var INVESTIGATE_CONTRACT_VERSION = "investigate-loop-1";
57047
+ var INVESTIGATE_CONTRACT_VERSION = "investigate-loop-2";
57048
+ var INVESTIGATE_FALLBACK_VERSION = "investigate-loop-1";
57016
57049
  var INVESTIGATE_LIMITS = {
57017
57050
  ...DEFAULT_LIMITS,
57018
57051
  maxTurns: 8,
@@ -57110,8 +57143,9 @@ async function runInvestigateLoop(args2, deps) {
57110
57143
  let noProgressStreak = 0;
57111
57144
  let forced = null;
57112
57145
  const started = now();
57146
+ let version2 = INVESTIGATE_CONTRACT_VERSION;
57113
57147
  const buildContext = (turn, isFinal, finalReason) => ({
57114
- contractVersion: INVESTIGATE_CONTRACT_VERSION,
57148
+ contractVersion: version2,
57115
57149
  report: args2.report,
57116
57150
  deniedPaths: args2.deniedPaths,
57117
57151
  fileCount: args2.listing.length,
@@ -57160,6 +57194,12 @@ async function runInvestigateLoop(args2, deps) {
57160
57194
  throw classifyTransport3(err2);
57161
57195
  }
57162
57196
  const failed = classifyEnvelope(envelope);
57197
+ if (failed?.reason === "contract_rejected" && turn === 1 && version2 === INVESTIGATE_CONTRACT_VERSION) {
57198
+ log({ event: "investigate.version_fallback", from: INVESTIGATE_CONTRACT_VERSION, to: INVESTIGATE_FALLBACK_VERSION });
57199
+ version2 = INVESTIGATE_FALLBACK_VERSION;
57200
+ turn -= 1;
57201
+ continue;
57202
+ }
57163
57203
  if (failed) throw failed;
57164
57204
  const body2 = envelope?.structuredJson;
57165
57205
  if (!isPlainObject(body2)) throw new InvestigateFailure("bad_reply");