@quikit/quikpilot-runner 9.3.0-rc.91 → 9.3.0-rc.93

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,10 @@ 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.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.
198
+
199
+ **9.3.0-rc.92 - each loop version's fixed prompt part counted honestly (QUIKTR-2709, RT-01).** A loop turn was sized as 5,000 for the fixed part (instruction, forms, user turn) plus its context, against 90,000; the fixed part is really 7,000 to 23,500 depending on the contract version, so the ceiling allowed ~104,000. The 90,000 is now the whole request: the fixed part comes from one table per version (`PROMPT_OVERHEAD_BY_VERSION`, the AI Runtime's values word for word), and an unknown version is charged the largest. Long runs drop old file contents a little sooner. Release this runner BEFORE the runtime half: it trims sooner, which today's runtime accepts.
200
+
197
201
  **9.3.0-rc.91 - the rest of the leftover exam findings (QUIKTR-2708, batches B and C).** A branch name git would read as an option or a forced push ("+name") stops the run before any git call, and the push names its exact target; git.ts holds no raw control character any more, so its diffs show in review (RN-15, RN-11). A readiness check whose result never reached QuikProjects fails the job and reports a path inside the repository (RN-14). A targeted run with nothing to commit fails with a plain reason instead of "completed" (RN-18). A quoted "{file}" in the one-file test command works (RN-16). Every network call has its own limit (one minute for tokens, the packet, uploads and reports; five for a single model call), and a reply over 32 MB is refused (RN-22, RN-21). The test-report search walks the checkout once and never follows a link (RN-08); the packet is checked for shape when it arrives (RN-20); the fix record never shows more fixes made than allowed (RN-17). Code clean-up with no change to what a run does: the tool loops share one copy of their helpers, files are put back one way, the contract steps back as one table, and a long request is measured once while it is trimmed (RN-09, RN-19, RN-21).
198
202
 
199
203
  **9.3.0-rc.90 - the leftover exam findings that change what a run does or can leak (QUIKTR-2708, batch A).** Links in a repository are never followed when the runner reads files for the AI, writes its change or runs the baseline check (`repoPath.ts`), and a NEW_FILE path is cleaned first so an existing file is never overwritten unread (RN-04). A run that fails while the baseline test run is still going stops it and reports at once, instead of waiting up to 25 minutes (RN-05). A CRLF file is no longer refused as a truncated rewrite on the whole-file path and keeps its line endings (RN-07). A review fix that does not pass keeps the earlier pass without running the checks again (RN-10). Every string sent back to QuikProjects is scrubbed of the run, AI Runtime and push tokens (RN-12/13). The push no longer blocks the runner, and each try has a 3-minute limit, so the deadline timer can always fire (RN-22).
package/dist/index.js CHANGED
@@ -37060,6 +37060,7 @@ var TargetingHttpError = class extends Error {
37060
37060
  };
37061
37061
 
37062
37062
  // src/loopShared.ts
37063
+ var LOOP_TURN_TOO_LARGE_CODE = "LOOP_TURN_TOO_LARGE";
37063
37064
  var MAX_ID_CHARS = 64;
37064
37065
  var MAX_CALLS_IN_A_REPLY = 50;
37065
37066
  var MAX_ARGS_JSON_CHARS = 1e3;
@@ -38504,9 +38505,10 @@ var DEFAULT_LIMITS = {
38504
38505
  // The per-run read cap stops the COST; the per-turn ceiling below stops the FAILURE. Different jobs.
38505
38506
  readCharsTotal: 6e4,
38506
38507
  resultCharsTotal: 8e4,
38507
- // 131,072 (the smallest 128k-class window) - 8,192 reserved output - a 3,741-token real request leaves
38508
- // ~116,000; 90,000 keeps ~26,000 for a repository whose listing is thousands of paths, and stays well
38509
- // clear of the per-minute quota, which binds before the window does. Set by the AI Runtime owner.
38508
+ // The WHOLE request: its version's fixed part (`tokenEstimate.PROMPT_OVERHEAD_BY_VERSION`, QUIKTR-2709) plus
38509
+ // the rendered context. First sized for a 131,072 window (8,192 reserved output); the runtime's model now
38510
+ // has 1,000,000, so 90,000 is the per-turn cost and per-minute quota budget. The AI Runtime enforces the
38511
+ // same number (`pilot_*_max_request_tokens`).
38510
38512
  maxRequestTokens: 9e4,
38511
38513
  grepMaxMatches: 40,
38512
38514
  grepLineChars: 200,
@@ -42625,7 +42627,32 @@ var TOKENS_PER_DIGIT_CHAR = 0.18;
42625
42627
  var TOKENS_PER_SPACE_CHAR = 0.05;
42626
42628
  var TOKENS_PER_PUNCTUATION_CHAR = 1.05;
42627
42629
  var TOKENS_PER_NON_ASCII_CHAR = 1;
42628
- var PROMPT_OVERHEAD_TOKENS = 5e3;
42630
+ var PROMPT_OVERHEAD_BY_VERSION = Object.freeze({
42631
+ "codegen-loop-1": 7e3,
42632
+ "codegen-loop-2": 9e3,
42633
+ "codegen-loop-3": 11500,
42634
+ "codegen-loop-4": 12e3,
42635
+ "codegen-loop-5": 13e3,
42636
+ "codegen-loop-6": 16500,
42637
+ "codegen-loop-7": 22e3,
42638
+ "codegen-loop-8": 22e3,
42639
+ "codegen-loop-9": 23500,
42640
+ "targeting-loop-1": 10500,
42641
+ "targeting-loop-2": 10500,
42642
+ "targeting-loop-3": 11e3,
42643
+ "targeting-loop-4": 12500,
42644
+ "investigate-loop-1": 7e3
42645
+ });
42646
+ var LARGEST_OVERHEAD = Math.max(...Object.values(PROMPT_OVERHEAD_BY_VERSION));
42647
+ function promptOverheadTokens(version2) {
42648
+ if (typeof version2 === "string" && Object.prototype.hasOwnProperty.call(PROMPT_OVERHEAD_BY_VERSION, version2)) {
42649
+ return PROMPT_OVERHEAD_BY_VERSION[version2];
42650
+ }
42651
+ return LARGEST_OVERHEAD;
42652
+ }
42653
+ function versionOf(contextData) {
42654
+ return typeof contextData === "object" && contextData !== null ? contextData.contractVersion : void 0;
42655
+ }
42629
42656
  function estimateTokens(text3) {
42630
42657
  return tokensFrom(classCounts(text3));
42631
42658
  }
@@ -42651,7 +42678,7 @@ function tokensFrom(c) {
42651
42678
  );
42652
42679
  }
42653
42680
  function estimateRequestTokens(contextData) {
42654
- return PROMPT_OVERHEAD_TOKENS + estimateTokens(JSON.stringify(contextData ?? {}, null, 2));
42681
+ return promptOverheadTokens(versionOf(contextData)) + estimateTokens(JSON.stringify(contextData ?? {}, null, 2));
42655
42682
  }
42656
42683
 
42657
42684
  // src/turnUsage.ts
@@ -42674,7 +42701,7 @@ function usageOf(envelope) {
42674
42701
  var sizeOf = (value) => value === void 0 ? 0 : estimateTokens(JSON.stringify(value, null, 2));
42675
42702
  var RESULT_KEYS = /* @__PURE__ */ new Set(["transcript", "toolResults", "previousAttempt"]);
42676
42703
  function requestParts(contextData) {
42677
- const parts2 = { fixed: PROMPT_OVERHEAD_TOKENS, map: 0, cases: 0, task: 0, results: 0, notes: 0, other: 0 };
42704
+ const parts2 = { fixed: promptOverheadTokens(versionOf(contextData)), map: 0, cases: 0, task: 0, results: 0, notes: 0, other: 0 };
42678
42705
  for (const [key, value] of Object.entries(contextData)) {
42679
42706
  if (key === "repoMap" || key === "workspaceListing") parts2.map += sizeOf(value);
42680
42707
  else if (key === "requiredTests") parts2.cases += sizeOf(value);
@@ -49237,6 +49264,10 @@ async function runTargetingLoop(args2, deps) {
49237
49264
  log({ event: "targeting.loop_recovered", turn, reason: "schema_mismatch", runtimeCode, elapsedMs: now() - turnStarted });
49238
49265
  continue;
49239
49266
  }
49267
+ if (runtimeCode === LOOP_TURN_TOO_LARGE_CODE) {
49268
+ log({ event: "targeting.turn_too_large", turn, requestTokens });
49269
+ throw new LoopFailure("token_ceiling", runtimeCode);
49270
+ }
49240
49271
  throw new LoopFailure(runtimeCode && OUTPUT_TOO_LARGE_CODES.has(runtimeCode) ? "output_too_large" : "runtime_failed", runtimeCode);
49241
49272
  }
49242
49273
  let body2;
@@ -50542,6 +50573,7 @@ async function runCodegenLoop(args2, deps) {
50542
50573
  const makeRoom = (nextTurn, nextFinal, finalReason) => {
50543
50574
  const whole4 = () => classCounts(JSON.stringify(buildContext(nextTurn, nextFinal, finalReason) ?? {}, null, 2));
50544
50575
  let counts = whole4();
50576
+ const fixed2 = promptOverheadTokens(versionOf(buildContext(nextTurn, nextFinal, finalReason)));
50545
50577
  const replaced = (before, after) => {
50546
50578
  const b = JSON.stringify(before, null, 2);
50547
50579
  const a = JSON.stringify(after, null, 2);
@@ -50561,7 +50593,7 @@ async function runCodegenLoop(args2, deps) {
50561
50593
  const full = whole4();
50562
50594
  if (JSON.stringify(full) !== JSON.stringify(counts)) throw new Error(`makeRoom's running count drifted: ${JSON.stringify(counts)} vs ${JSON.stringify(full)}`);
50563
50595
  }
50564
- return PROMPT_OVERHEAD_TOKENS + tokensFrom(counts) <= limit;
50596
+ return fixed2 + tokensFrom(counts) <= limit;
50565
50597
  };
50566
50598
  const fits = () => under(limits.maxRequestTokens);
50567
50599
  const soft = args2.readRoots ? mapSoftTarget(firstRequestTokens, limits.maxRequestTokens) : limits.maxRequestTokens;
@@ -50798,6 +50830,11 @@ async function runCodegenLoop(args2, deps) {
50798
50830
  if (handled === true) continue;
50799
50831
  throw handled;
50800
50832
  }
50833
+ if (runtimeCode === LOOP_TURN_TOO_LARGE_CODE) {
50834
+ const version2 = contextData.contractVersion;
50835
+ log({ event: "codegen.turn_too_large", turn, ...typeof version2 === "string" ? { version: version2 } : {}, requestTokens });
50836
+ throw new CodegenLoopFailure("token_ceiling", runtimeCode);
50837
+ }
50801
50838
  throw new CodegenLoopFailure("runtime_failed", runtimeCode);
50802
50839
  }
50803
50840
  let body2;
@@ -54881,7 +54918,7 @@ var FAILURE_ARTIFACT_DIR = "quikpilot-failure";
54881
54918
  var REPORT_COPY = "final-test-report.xml";
54882
54919
  var MAX_REPORT_BYTES = 5 * 1024 * 1024;
54883
54920
  var MAX_FILES = 200;
54884
- var RUNNER_VERSION = true ? "9.3.0-rc.91" : "dev";
54921
+ var RUNNER_VERSION = true ? "9.3.0-rc.93" : "dev";
54885
54922
  function safeDestination(base, repoPath) {
54886
54923
  if (!repoPath || (0, import_node_path27.isAbsolute)(repoPath)) return null;
54887
54924
  const destination = (0, import_node_path27.resolve)(base, repoPath);
@@ -56795,6 +56832,7 @@ function classifyEnvelope(envelope) {
56795
56832
  if (code === "RUN_BUDGET_EXCEEDED") return new InvestigateFailure("budget_exceeded");
56796
56833
  if (code === "RUN_CREDENTIAL_SCOPE") return new InvestigateFailure("credential_scope");
56797
56834
  if (code === "SEMANTIC_MISMATCH") return new InvestigateFailure("semantic_mismatch");
56835
+ if (code === LOOP_TURN_TOO_LARGE_CODE) return new InvestigateFailure("token_ceiling");
56798
56836
  if (code === "CONTRACT_REJECTED") {
56799
56837
  const text3 = `${typeof e?.error === "string" ? e.error : ""} ${typeof e?.normalizedText === "string" ? e.normalizedText : ""}`;
56800
56838
  return new InvestigateFailure(text3.includes(SWITCH_OFF_SENTENCE) ? "switch_off" : "contract_rejected");