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

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,8 @@ 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.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
+
197
199
  **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
200
 
199
201
  **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
  }
@@ -49429,6 +49436,13 @@ async function runTargetingLoop(args2, deps) {
49429
49436
  }
49430
49437
  }
49431
49438
 
49439
+ // src/noProgress.ts
49440
+ var NOTHING_NEW = /* @__PURE__ */ new Set(["duplicate", "no_effect", "no_change_since_last_run", "no_match", "ambiguous", "conflict_rejected"]);
49441
+ var HARNESS_NO_PROGRESS_TURNS = 3;
49442
+ function turnAddsNothing(results, addedNothing) {
49443
+ return results.every((r) => NOTHING_NEW.has(r.status) || addedNothing.has(r.id));
49444
+ }
49445
+
49432
49446
  // src/workingFiles.ts
49433
49447
  var KEEP_WORKING_FILES_ENV = "QUIKPILOT_KEEP_WORKING_FILES";
49434
49448
  var MAX_WORKING_PATHS = 3;
@@ -49445,6 +49459,17 @@ function rangeOf(args2) {
49445
49459
  if (typeof a.endLine === "number" && Number.isInteger(a.endLine)) out2.endLine = a.endLine;
49446
49460
  return out2;
49447
49461
  }
49462
+ function servedOf(range, output) {
49463
+ if (range.mode === "outline" || typeof output !== "object" || output === null) return {};
49464
+ const o = output;
49465
+ if (typeof o.startLine === "number" && Number.isInteger(o.startLine) && typeof o.endLine === "number" && Number.isInteger(o.endLine)) {
49466
+ return { servedStart: o.startLine, servedEnd: o.endLine };
49467
+ }
49468
+ return {};
49469
+ }
49470
+ function spanOf(r) {
49471
+ return { start: r.servedStart ?? r.startLine ?? 1, end: r.servedEnd ?? r.endLine ?? Number.POSITIVE_INFINITY };
49472
+ }
49448
49473
  function overlapOf(a, b) {
49449
49474
  if (a.mode === "outline" || b.mode === "outline") return a.mode === b.mode ? "same" : "disjoint";
49450
49475
  const aStart = a.startLine ?? 1;
@@ -49486,6 +49511,30 @@ var ReadTracker = class {
49486
49511
  for (const w of this.writes) if (w.path === path) last = w.seq;
49487
49512
  return last;
49488
49513
  }
49514
+ /**
49515
+ * 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
49516
+ * 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
49517
+ * 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
49518
+ * 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
49519
+ * first read of a file. `outputOf(id)` answers what an earlier answer is now.
49520
+ */
49521
+ addsNothing(entry, outputOf, dropNotes) {
49522
+ const after = this.lastWriteSeq(entry.path);
49523
+ const held = this.reads.filter((r) => r.path === entry.path && r.seq > after && stateOf(outputOf(r.id), false, dropNotes) === "whole");
49524
+ if (entry.mode === "outline") return held.some((r) => r.mode === "outline");
49525
+ const spans = held.filter((r) => r.mode !== "outline").map(spanOf);
49526
+ const want = spanOf(entry);
49527
+ if (want.end < want.start) return spans.length > 0;
49528
+ spans.sort((a, b) => a.start - b.start);
49529
+ let cursor = want.start;
49530
+ for (const s of spans) {
49531
+ if (s.end < cursor) continue;
49532
+ if (s.start > cursor) return false;
49533
+ cursor = s.end + 1;
49534
+ if (cursor > want.end) return true;
49535
+ }
49536
+ return false;
49537
+ }
49489
49538
  /**
49490
49539
  * 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
49540
  * earlier answer is now; `duplicate` is whether this read was answered as a repeat.
@@ -50252,8 +50301,6 @@ function withUnreportable(stop2, tests) {
50252
50301
  return carried;
50253
50302
  }
50254
50303
  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;
50257
50304
  var MAX_SUMMARY_CHARS = 300;
50258
50305
  var READ_TOOLS = /* @__PURE__ */ new Set(["list_files", "read_file", "grep", "find_definition", "show_changes"]);
50259
50306
  var WRITE_TOOLS = /* @__PURE__ */ new Set(["edit_file", "write_file"]);
@@ -50408,8 +50455,9 @@ async function runCodegenLoop(args2, deps) {
50408
50455
  const usage = new TurnUsage();
50409
50456
  let notes = "";
50410
50457
  let stubbed = 0;
50458
+ let shrinkOn = false;
50411
50459
  const tracker = new ReadTracker();
50412
- const rereadCounts = { rereads: 0, rereadsAfterStub: 0, rereadsAfterDrop: 0 };
50460
+ const rereadCounts = { rereads: 0, rereadsAfterStub: 0, rereadsAfterDrop: 0, repeatsOfSameRange: 0 };
50413
50461
  let keptMax = 0;
50414
50462
  let rereadsLogged = false;
50415
50463
  const logRereads = () => {
@@ -50714,8 +50762,8 @@ async function runCodegenLoop(args2, deps) {
50714
50762
  return null;
50715
50763
  }
50716
50764
  };
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);
50765
+ const servedOf2 = (c) => ({ title: c.served.title, describes: c.served.describes, ...c.served.table ? { table: true } : {} });
50766
+ const regressedIn = (answer, c) => failsIn(answer, c.served.path, servedOf2(c), answer?.regressions ?? 0);
50719
50767
  const fresh = freshTestAnswer() ?? null;
50720
50768
  let changeAnswer = fresh;
50721
50769
  let ranChange = false;
@@ -50735,7 +50783,7 @@ async function runCodegenLoop(args2, deps) {
50735
50783
  const regressed = regressedIn(changeAnswer, c) === true;
50736
50784
  const file = files.find((f) => f.path === c.path);
50737
50785
  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";
50786
+ const suite = !whole4 ? "not_checked" : suiteAnswer.regressions === 0 && failsIn(suiteAnswer, c.served.path, { ...servedOf2(c), title }) === false ? "passes" : "fails";
50739
50787
  const fixes = regressed && suite === "passes" && changeAnswer ? fixesOf(c, changeAnswer) : [];
50740
50788
  if (regressed) counts.regressed += 1;
50741
50789
  counts[suite === "passes" ? "passes" : suite === "fails" ? "fails" : "notChecked"] += 1;
@@ -51170,6 +51218,7 @@ async function runCodegenLoop(args2, deps) {
51170
51218
  const calls = parsed.calls;
51171
51219
  for (const c of calls) usedIds.add(c.id);
51172
51220
  const results = [];
51221
+ const addedNothing = /* @__PURE__ */ new Set();
51173
51222
  const logged = [];
51174
51223
  for (const [index, call] of calls.entries()) {
51175
51224
  let result;
@@ -51234,10 +51283,13 @@ async function runCodegenLoop(args2, deps) {
51234
51283
  }
51235
51284
  results.push(result);
51236
51285
  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) };
51286
+ const range = rangeOf(call.args);
51287
+ const entry = { id: call.id, turn, path: call.args.path, ...range, ...servedOf(range, result.output) };
51288
+ if (harness && tracker.addsNothing(entry, (id) => results.find((x) => x.id === id)?.output ?? outputOf(id), DROP_NOTES)) addedNothing.add(call.id);
51238
51289
  const again = tracker.reread(entry, result.status === "duplicate", (id) => results.find((x) => x.id === id)?.output ?? outputOf(id), DROP_NOTES);
51239
51290
  if (again) {
51240
51291
  rereadCounts.rereads += 1;
51292
+ if (again.overlap === "same") rereadCounts.repeatsOfSameRange += 1;
51241
51293
  if (again.prevState === "stubbed") rereadCounts.rereadsAfterStub += 1;
51242
51294
  else if (again.prevState === "dropped") rereadCounts.rereadsAfterDrop += 1;
51243
51295
  log({ event: "codegen.reread", ...again });
@@ -51281,7 +51333,8 @@ async function runCodegenLoop(args2, deps) {
51281
51333
  notes = keepNotes(notes, body2.notes, scrub);
51282
51334
  const kept = keepOn ? tracker.keep(outputOf) : null;
51283
51335
  if (kept) keptMax = Math.max(keptMax, kept.size);
51284
- stubbed += stubOldLooks({
51336
+ if (peakRequestTokens > (limits.shrinkAfterTokens ?? mapSoftTarget(firstRequestTokens, limits.maxRequestTokens))) shrinkOn = true;
51337
+ if (shrinkOn) stubbed += stubOldLooks({
51285
51338
  results: toolResults,
51286
51339
  turnOf: (id) => turnOfId.get(id),
51287
51340
  callOf: (id) => callOfId.get(id),
@@ -51290,7 +51343,13 @@ async function runCodegenLoop(args2, deps) {
51290
51343
  ...kept ? { keep: (id) => kept.has(id), repeats: true } : {}
51291
51344
  });
51292
51345
  }
51293
- noProgressStreak = harness ? results.every((r) => NOTHING_NEW.has(r.status)) ? noProgressStreak + 1 : 0 : results.every((r) => r.status === "duplicate") ? noProgressStreak + 1 : 0;
51346
+ noProgressStreak = harness ? turnAddsNothing(results, addedNothing) ? noProgressStreak + 1 : 0 : results.every((r) => r.status === "duplicate") ? noProgressStreak + 1 : 0;
51347
+ if (harness) {
51348
+ const nothingNew = results.filter((r) => NOTHING_NEW.has(r.status) || addedNothing.has(r.id)).length;
51349
+ if (nothingNew > 0) {
51350
+ 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 });
51351
+ }
51352
+ }
51294
51353
  if (noProgressStreak >= (harness ? HARNESS_NO_PROGRESS_TURNS : 2)) forced = "no_progress";
51295
51354
  else if (ledger.toolCalls >= limits.maxToolCalls) forced = "tool_budget";
51296
51355
  else if (ledger.writeChars >= limits.writeCharsTotal) forced = "write_budget";
@@ -54950,7 +55009,7 @@ var FAILURE_ARTIFACT_DIR = "quikpilot-failure";
54950
55009
  var REPORT_COPY = "final-test-report.xml";
54951
55010
  var MAX_REPORT_BYTES = 5 * 1024 * 1024;
54952
55011
  var MAX_FILES = 200;
54953
- var RUNNER_VERSION = true ? "9.3.0-rc.94" : "dev";
55012
+ var RUNNER_VERSION = true ? "9.3.0-rc.95" : "dev";
54954
55013
  function safeDestination(base, repoPath) {
54955
55014
  if (!repoPath || (0, import_node_path27.isAbsolute)(repoPath)) return null;
54956
55015
  const destination = (0, import_node_path27.resolve)(base, repoPath);