@quikit/quikpilot-runner 9.3.0-rc.61 → 9.3.0-rc.63

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
@@ -167,8 +167,12 @@ wrong (a field that arrives from a database row or a request), so it only warns
167
167
  **9.3.0-rc.59 - a throwaway test, run once, its output shown (QUIKTR-1702, contract section 44 `codegen-loop-9`).** Before it writes an expected value the AI sometimes needs to SEE what the code really returns. `call_function` could show it, but only for a plain .js file, one function and plain data, on our own repositories: nothing for a Go, Python or Java project. The new tool `run_scratch {path, content}` has the AI name a NEW test file (named the way the project names its tests, in a folder that exists, never a file that exists) and give its text. The runner writes it next to the AI's changes, runs the space's own "Test one file" command on it once (`commands.testFile`, the path quoted, the same environment allow-list, credential scrub and process-group kill as `run_tests`, 60 seconds), puts the checkout back exactly, and answers with ONE string: `exit N`, then the END of what the run printed (stdout and stderr together, colour codes removed, credentials scrubbed, at most 2,000 characters in all). The AI supplies a file and its text, never what runs it: no command, no interpreter, no flag. The scratch file goes to disk through the overlay window as one extra file and never through the loop's overlay, so the syntax guard, the hunk and scope checks, `show_changes`, the proof run and the proposal never see it, and a scratch answer is never evidence that a test fails. It shares the eight `functionCalls` with `call_function`, and a repeat of the same file on the same change is answered as a duplicate and spends nothing. Offered only when fix first is on (loop-9 is loop-8 plus the tool), the space has a one-file command, and the repository is ours (`deathvadeR-afk`, section 28.2 unchanged) or the workflow sets `QUIKPILOT_RUN_SCRATCH=on` (a trial space); `QUIKPILOT_RUN_SCRATCH=off` closes it everywhere. Needs the AI Runtime of QUIKTR-1702 (`codegen-loop-9`, its own flag); an AI Runtime that refuses it is asked again as `codegen-loop-8`, then `codegen-loop-7`. Logs and the run record carry counts and closed words only (`codegen.run_scratch`: status, reason, exit code, seconds, length), never the path, the text or the output. Also in rc.59: everything in rc.58. Nothing else changes.
168
168
 
169
169
  **9.3.0-rc.60 - credential files of every language stay away from the AI (QUIKTR-1703).** QuikPilot hid the npm credential file (`.npmrc`) and a few other secret-shaped files, but a Python, Java, Rust, PHP, Ruby or .NET project's own login files were open to the AI, and the last-line scrubber knew only JavaScript-style secrets. (1) Files that hold nothing but logins or keys are never read, listed, searched, edited or created, whatever the project's Protected paths say: `.pypirc`, `pip.conf`, `.netrc`, `.yarnrc(.yml)`, `.cargo/credentials`, `.gem/credentials`, `.bundle/config`, Maven `settings-security.xml` and a `settings.xml` at the root or under `.mvn`/`.m2`, Composer `auth.json` at the root, `.aws/credentials`, `.docker/config.json`, `.kube/config`, Terraform state, `.htpasswd`, private keys and key stores. The names are exact and anchored, so `locales/en/auth.json` stays readable. Nothing under `.git` can be written. (2) The edit, write, show and revert tools use the read list as well: a file the AI may not see is not one it can probe through an edit answer (`ambiguous` quoted the line before each match; `no_match` against `ok` told a guess from a hit). A credential file or a file it may not read is no target and no context file either. (3) The file listing sent to the AI service leaves out every file the AI may not read (it was the raw list); the runner keeps the whole list for its own checks. (4) The scrubber has a `config` mode for configuration files (properties, ini, cfg, conf, toml, yaml, xml, `.env*`, `appsettings*.json`): `repoPassword=x`, `password = x`, `<password>x</password>`, `Password=x;` inside a connection string, a NuGet `ClearTextPassword` are redacted and the name stays; translation files and code are read as before. It also hides npm, PyPI, GitLab and Docker Hub token shapes in every mode. The recorded words do not change. (5) The command environment passes a few more settings with no secret in them (`GOPRIVATE`, `VIRTUAL_ENV`, `PYTHONPATH`, `NODE_ENV`, `RUSTFLAGS`, `CARGO_TARGET_DIR`, `NUGET_PACKAGES` and kin); `GOPROXY`, `PIP_INDEX_URL`, `UV_INDEX_URL`, `MAVEN_OPTS`, `JAVA_TOOL_OPTIONS`, `GRADLE_OPTS` and `RUSTFLAGS` pass only when their value carries no login; and npm's base64 login (`NPM_CONFIG__AUTH`) no longer slips through the allowed `NPM_CONFIG_` family. Never a wildcard: `BUNDLE_*`, `COMPOSER_AUTH` and the registry token variables stay withheld. No change to the contract with the AI service.
170
-
171
- **9.3.0-rc.61 - the AI sees why its own test failed in every language, and is told when what still fails was already failing (QUIKTR-1950, QUIKTR-1962).** (1) `run_tests` and the final test check show the first line (the whole failure under the harness version) of a failing test THIS run wrote. Until now that worked only where the report names a test by its file path (JavaScript); a pytest module, a Java class, a C# namespace and a Go package are not paths, so the AI saw only the test's name and guessed (the sqlparse trial logged `messages: 0` on every run). Such a test now counts as the run's own when its module or package lines up with a file the run changed (the rule that links a declared test to its report entry) AND the test, with any row suffix cut off, is defined in that file's text as a whole word. With no file text nothing is added; a JUnit 5 display name is never linked; an existing test that now fails stays names-only. (2) When no test that passed before fails now and no test that is new in this run fails, but tests are still red, the answer says that every failing test was already failing before the change, and the "same as last run" wording and the `no_progress` stop no longer apply to it (a clean change on a repository with old failures could never reach `tests_passed`). The status stays `tests_failed`; the final gate and the regression check are unchanged. The `codegen.run_tests` log event gains `own` (how many failing tests were shown to be the run's own) and `clean` (a flag), counts only. No change to the contract with the AI service.
170
+
171
+ **9.3.0-rc.61 - the AI sees why its own test failed in every language, and is told when what still fails was already failing (QUIKTR-1950, QUIKTR-1962).** (1) `run_tests` and the final test check show the first line (the whole failure under the harness version) of a failing test THIS run wrote. Until now that worked only where the report names a test by its file path (JavaScript); a pytest module, a Java class, a C# namespace and a Go package are not paths, so the AI saw only the test's name and guessed (the sqlparse trial logged `messages: 0` on every run). Such a test now counts as the run's own when its module or package lines up with a file the run changed (the rule that links a declared test to its report entry) AND the test, with any row suffix cut off, is defined in that file's text as a whole word. With no file text nothing is added; a JUnit 5 display name is never linked; an existing test that now fails stays names-only. (2) When no test that passed before fails now and no test that is new in this run fails, but tests are still red, the answer says that every failing test was already failing before the change, and the "same as last run" wording and the `no_progress` stop no longer apply to it (a clean change on a repository with old failures could never reach `tests_passed`). The status stays `tests_failed`; the final gate and the regression check are unchanged. The `codegen.run_tests` log event gains `own` (how many failing tests were shown to be the run's own) and `clean` (a flag), counts only. No change to the contract with the AI service.
172
+
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
+
175
+ **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.
172
176
 
173
177
  **9.3.0-rc.58 - write the fix first, then ask once about every existing test it breaks, with proof (QUIKTR-1851, absorbing QUIKTR-1850; release 1).** Until now, when an existing test expected the bug, the run stopped BEFORE any code was written and a person approved a change to that test with nothing to show it could ever pass, and the tests were found one at a time: QTRIA-23 approved a change that moved the status line off 401 and left `expect(body).toEqual({ ..., error: "Unauthorized" })`, which no fix can satisfy, and spent all three stops. Now, when the project switches it on (`packet.fixFirst`; `QUIKPILOT_FIX_FIRST=off` turns it off without a rebuild) the run speaks `codegen-loop-8`: a `report_test_conflict` is a PROPOSAL that does not end the run, the AI writes the tests and the fix and reports every existing test its fix breaks, and at its DONE the runner proves the proposals (`proofCheck.ts`): it runs the project's WHOLE suite (the related-tests planner off, a fresh tool, outside the AI's run allowance) with the fix and every proposed change written over the old code. A proposal whose test still fails is sent back with its name ("change EVERY expectation of it"), and an existing test the fix broke that no proposal covers is sent back by name (never a failure message: QUIKTR-1474), at most twice; one that still fails after that is not offered to a person. Then ONE stop, as before, whose proposals carry `oldCodeChecked` (fails on the old code with the change alone), `newCode` (`passes` / `fails` / `not_checked`) and `newEndLine` (where the changed test now ends, for showing the whole test); no time, no answer or a list of failures cut to fit is `not_checked`, never proven. The tests phase hands its proposals to the code phase. An AI Runtime that refuses `codegen-loop-8` is asked again as loop-7 (nothing else changes), a fix turn stays loop-7, and a project that did not switch it on sends and receives exactly what it did. Release 2 (keeping the fix across the stop) is not in this version: the next job still writes the code again. Also in rc.58: everything in rc.57.
174
178
 
package/dist/index.js CHANGED
@@ -37718,6 +37718,7 @@ function titlesHint(tests) {
37718
37718
  const shown = tests.slice(0, 12).map((t) => `"${t.title.length > 60 ? `${t.title.slice(0, 59)}\u2026` : t.title}"`);
37719
37719
  return shown.length === 0 ? "none" : `${shown.join(", ")}${tests.length > 12 ? ", ..." : ""}`;
37720
37720
  }
37721
+ var APPROVED_AGAIN_HINT = "A person approved a change to that test and it is already in the file. If another row of it still expects the old behaviour, finish your code first: if rows of that test still fail in the final test run, the fix step can report it once more.";
37721
37722
  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.";
37722
37723
  var RECORDED_MESSAGE_FIX_FIRST = "Recorded as a proposal; nothing was changed. Carry on: write the tests and the fix, run the project's tests, and report every other existing test your fix breaks that expects what a case calls wrong. When your change is complete, answer DONE: QuikPilot then checks each proposal against your code and a person decides about them together.";
37723
37724
  var BOUNDS = { find: 8e3, replace: 2e4, title: 300, reason: 300, caseText: 1e3, value: 120, why: 300 };
@@ -37913,7 +37914,11 @@ var TestConflictTool = class {
37913
37914
  const d = this.deps;
37914
37915
  const key = `${r.path}\0${r.testTitle}`;
37915
37916
  const revision = d.revisable?.find((x) => sameFile2(x.path, r.path) && x.title === r.testTitle);
37916
- if (!revision && d.decided.some((x) => sameFile2(x.path, r.path) && x.title === r.testTitle)) return this.reject("already_decided");
37917
+ if (!revision && d.decided.some((x) => sameFile2(x.path, r.path) && x.title === r.testTitle)) {
37918
+ const approved = d.approvedChanges?.some((a) => sameFile2(a.path, r.path) && (a.title === r.testTitle || a.diskTitle === r.testTitle)) === true;
37919
+ if (approved) d.log?.({ event: "codegen.conflict_refused_approved", phase: d.phase ?? null });
37920
+ return this.reject("already_decided", approved ? APPROVED_AGAIN_HINT : void 0);
37921
+ }
37917
37922
  if (!this.byTest.has(key) && this.byTest.size >= this.max) return this.reject("too_many_conflicts");
37918
37923
  const path = normaliseToolPath(r.path);
37919
37924
  if (!path.ok || !d.existingTests.has(path.path) || !insideWriteRoot(path.path, d.writeRoot) || matchesDeniedPath(path.path, d.deniedPaths) !== null) {
@@ -46702,6 +46707,7 @@ function missingImportSentence(m) {
46702
46707
 
46703
46708
  // src/turnRecovery.ts
46704
46709
  var RECOVERY_RULE = "length";
46710
+ var MALFORMED_REPLY_CODE = "SCHEMA_MISMATCH";
46705
46711
  var COMMON = "Take a smaller step: fewer files and fewer edits in one turn, and make each edit a small find-and-replace change.";
46706
46712
  var SENTENCES = {
46707
46713
  cut_off: {
@@ -46711,8 +46717,13 @@ var SENTENCES = {
46711
46717
  slow: {
46712
46718
  violation: "Your last step took too long, so none of it was run.",
46713
46719
  message: `Your last step took too long, so none of it was run. ${COMMON}`
46720
+ },
46721
+ malformed: {
46722
+ violation: "Your last answer could not be read as the required format, so none of it was run.",
46723
+ message: `Your last answer was not in the required format, so none of it was run. Answer again with exactly one reply in the required format and nothing else. ${COMMON}`
46714
46724
  }
46715
46725
  };
46726
+ var IN_WORDS = { cut_off: "cut off", slow: "too slow", malformed: "unreadable" };
46716
46727
  function turnRecoveryOff(env2 = process.env) {
46717
46728
  return env2.QUIKPILOT_TURN_RECOVERY === "off";
46718
46729
  }
@@ -46724,9 +46735,7 @@ function recoveryAnswer(kind) {
46724
46735
  return { rules: [RECOVERY_RULE], violations: [s.violation], message: s.message };
46725
46736
  }
46726
46737
  function repeatedLossDetail(kind, first) {
46727
- const now = kind === "cut_off" ? "cut off" : "too slow";
46728
- const before = first === "cut_off" ? "cut off" : "too slow";
46729
- return `a turn was ${before}, and the next one, after the AI was asked for a smaller step, was ${now} too`;
46738
+ return `a turn was ${IN_WORDS[first]}, and the next one, after the AI was asked for a smaller step, was ${IN_WORDS[kind]} too`;
46730
46739
  }
46731
46740
 
46732
46741
  // src/conflictVerify.ts
@@ -46941,6 +46950,7 @@ async function runTargetingLoop(args2, deps) {
46941
46950
  const usedIds = /* @__PURE__ */ new Set();
46942
46951
  const refusedTurns = [];
46943
46952
  let refusedStreak = 0;
46953
+ let unreadableStreak = 0;
46944
46954
  let peakRequestTokens = 0;
46945
46955
  const usage = new TurnUsage();
46946
46956
  let turns = 0;
@@ -47023,6 +47033,13 @@ async function runTargetingLoop(args2, deps) {
47023
47033
  const fallbackText = `pilot.targeting failed: ${runtimeCode}`;
47024
47034
  throw new SafetyRefusalError(inner?.message ?? fallbackText, inner?.summary ?? fallbackText);
47025
47035
  }
47036
+ if (runtimeCode === MALFORMED_REPLY_CODE && shouldRecover({ isFinal, consecutive: unreadableStreak })) {
47037
+ unreadableStreak += 1;
47038
+ refusedTurns.push({ turn, rules: [RECOVERY_RULE] });
47039
+ transcript.push({ turn, toolCalls: [], refused: recoveryAnswer("malformed") });
47040
+ log({ event: "targeting.loop_recovered", turn, reason: "schema_mismatch", runtimeCode, elapsedMs: now() - turnStarted });
47041
+ continue;
47042
+ }
47026
47043
  throw new LoopFailure(runtimeCode && OUTPUT_TOO_LARGE_CODES.has(runtimeCode) ? "output_too_large" : "runtime_failed", runtimeCode);
47027
47044
  }
47028
47045
  let body2;
@@ -47031,6 +47048,7 @@ async function runTargetingLoop(args2, deps) {
47031
47048
  } catch (err2) {
47032
47049
  throw new LoopFailure("bad_reply", void 0, err2);
47033
47050
  }
47051
+ unreadableStreak = 0;
47034
47052
  if (body2.outcome === REFUSED_OUTCOME) {
47035
47053
  const answer = readRefusedAnswer(body2);
47036
47054
  if (!answer) throw new LoopFailure("bad_reply");
@@ -47337,6 +47355,8 @@ async function runCodegenLoop(args2, deps) {
47337
47355
  writeRoot: args2.writeRoot ?? "",
47338
47356
  caseIds: args2.requiredAutomationIds,
47339
47357
  decided: args2.conflicts.titles,
47358
+ // QUIKTR-1951: the tests a person approved changing, so a report of one of them is refused with what to do instead.
47359
+ ...args2.conflicts.approvedTests && args2.conflicts.approvedTests.length > 0 ? { approvedChanges: args2.conflicts.approvedTests } : {},
47340
47360
  // QUIKTR-1844: a test whose approved change does not fit may be reported once more, against its approved text.
47341
47361
  ...args2.conflicts.revisable && args2.conflicts.revisable.length > 0 ? { revisable: withApprovedText(args2.conflicts.revisable, args2.approved ?? []) } : {},
47342
47362
  // The checkout as it is on disk: a report is made against the file as it was before the run, never against this attempt's overlay.
@@ -47587,7 +47607,7 @@ async function runCodegenLoop(args2, deps) {
47587
47607
  };
47588
47608
  log({ event: "codegen.loop_start", maxTurns: limits.maxTurns, maxToolCalls: limits.maxToolCalls, listingFiles: args2.listing.length });
47589
47609
  const loseTurn = (turn, kind, isFinalTurn, runtimeCode, elapsedMs) => {
47590
- const reason = kind === "cut_off" ? "output_too_large" : "turn_timeout";
47610
+ const reason = kind === "cut_off" ? "output_too_large" : kind === "slow" ? "turn_timeout" : "runtime_failed";
47591
47611
  if (!shouldRecover({ isFinal: isFinalTurn, consecutive: lostStreak })) {
47592
47612
  const again = lostLast !== null && lostStreak > 0;
47593
47613
  const failure = new CodegenLoopFailure(reason, runtimeCode, void 0, again ? repeatedLossDetail(kind, lostLast) : void 0);
@@ -47598,7 +47618,7 @@ async function runCodegenLoop(args2, deps) {
47598
47618
  lostLast = kind;
47599
47619
  refusedTurns.push({ turn, rules: [RECOVERY_RULE] });
47600
47620
  transcript.push({ turn, toolCalls: [], refused: recoveryAnswer(kind) });
47601
- log({ event: "codegen.loop_recovered", turn, reason, ...runtimeCode ? { runtimeCode } : {}, elapsedMs });
47621
+ log({ event: "codegen.loop_recovered", turn, reason: kind === "malformed" ? "schema_mismatch" : reason, ...runtimeCode ? { runtimeCode } : {}, elapsedMs });
47602
47622
  forced = settleNextTurn(turn, forced);
47603
47623
  return true;
47604
47624
  };
@@ -47655,6 +47675,11 @@ async function runCodegenLoop(args2, deps) {
47655
47675
  if (handled === true) continue;
47656
47676
  throw handled;
47657
47677
  }
47678
+ if (runtimeCode === MALFORMED_REPLY_CODE) {
47679
+ const handled = loseTurn(turn, "malformed", isFinal, runtimeCode, now() - turnStarted);
47680
+ if (handled === true) continue;
47681
+ throw handled;
47682
+ }
47658
47683
  throw new CodegenLoopFailure("runtime_failed", runtimeCode);
47659
47684
  }
47660
47685
  let body2;
@@ -51441,7 +51466,7 @@ var FAILURE_ARTIFACT_DIR = "quikpilot-failure";
51441
51466
  var REPORT_COPY = "final-test-report.xml";
51442
51467
  var MAX_REPORT_BYTES = 5 * 1024 * 1024;
51443
51468
  var MAX_FILES = 200;
51444
- var RUNNER_VERSION = true ? "9.3.0-rc.61" : "dev";
51469
+ var RUNNER_VERSION = true ? "9.3.0-rc.63" : "dev";
51445
51470
  function safeDestination(base, repoPath) {
51446
51471
  if (!repoPath || (0, import_node_path26.isAbsolute)(repoPath)) return null;
51447
51472
  const destination = (0, import_node_path26.resolve)(base, repoPath);