@quikit/quikpilot-runner 9.3.0-rc.68 → 9.3.0-rc.69

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.69 - a GitHub server error on push is tried again, and a commit that could not be pushed is kept beside the files (QUIKTR-1963 follow-up, QTRIA-39).** Run QTRIA-39 (4 Nov 2026) wrote and checked its change, then lost it: `git push` got "remote: Internal Server Error" from GitHub during a GitHub incident, the run failed, and there was no branch and no pull request. Now a push answered with a server error (500, Bad Gateway, Service Unavailable, Gateway Timeout) is tried again after 5, 15, 30 and 60 seconds; before, only "Repository not found" was retried, and that retry is unchanged. A failed run's folder (`quikpilot-failure/`, uploaded as the `quikpilot-failed-run` artifact) also holds `quikpilot-change.bundle`: the run's last commit as a git bundle, and the manifest's `bundle` entry says how to restore it (`git fetch quikpilot-change.bundle HEAD:refs/heads/<branch>`). The bundle is written only when the run's branch is checked out and its commit changes a file. With a push that works, the run is the same as in rc.68.
176
+
175
177
  **9.3.0-rc.68 - the switch `QUIKPILOT_KEEP_WORKING_FILES=on` no longer gets a request refused, and a refusal says why in the log (QUIKTR-1963).** The first live run with the switch on (QuikIT bug 4, run QTRIA-37, 4 Nov 2026) was refused by the AI Runtime four times (`CONTRACT_REJECTED`), each time costing the run a contract version (`codegen.version_fallback`) and a restart of the phase. Cause, reproduced by reading requests this runner built with the AI Runtime's own shape check: under the switch a repeat's copy of an earlier answer (status `duplicate`, carrying the earlier text) was shrunk to the stub `{dropped: true, note}` by the three-turn rule and by the make-room drop, and the AI Runtime takes that stub only on an `ok` look result (`check_look_output_3`). Now a repeat's copy is shrunk by leaving its text out (a `duplicate` with no `output` is a shape the AI Runtime already takes), and its message says it was shrunk and to read it again if needed; every other answer is shrunk as before. The re-read report (`codegen.reread`) reads such a copy as `stubbed`. New log line `codegen.contract_rejected` `{turn, version, reason}` on any refused code-writing request, whatever the switch: `reason` is the AI Runtime's one fixed sentence (the job's secrets taken out, one line, at most 300 characters). With the switch off nothing the AI Runtime receives changes. Also in rc.68: everything in rc.67.
176
178
 
177
179
  **9.3.0-rc.67 - before its tests are frozen, the AI is asked once to check WHY each bug test fails on the old code (QUIKTR-2058; off unless `QUIKPILOT_RED_REVIEW=on`).** Phase 1 ends only once each bug case's own test is seen failing on the code before any change (QUIKTR-1608), and any failure counted. In QuikIT run QTRIA-34 (3 Nov) two bug tests failed there with "expected 500 to be 409" because they never set up a mock the code needs, so the code crashed while the old code really answers 200; the check accepted them, the tests were frozen, and the code phase could never make them pass. In QTRIA-35 (same bug) the AI saw this in the failure text by itself and fixed its test. With the switch on, the first phase-1 DONE that gets past the red check (whatever that check found: in QTRIA-34 its one send-back went to a test that must keep working) is sent back once, as a refused turn with rule word `done_rule`, quoting the first line of each bug case's failure on the code as it is (`[id] fails on the code as it is with: ...`, the job's secrets scrubbed, at most 7 cases) and asking the AI to confirm each shows the bug, not a broken test (a missing mock or stub, an error in the test's own set-up, a crash the bug does not cause); a broken one is fixed and run again, otherwise the AI answers DONE again. It is never sent on a final turn, nor when no failure text is there to quote (`no_message`: a one-file run with no report, no baseline run), nor when no test run is left to show a corrected test failing (`no_runs_left`); a give-up with red tests is not reviewed. The red check and its own counter are unchanged. Logs (counts, never text): `codegen.red_check` `review_sent`, `review_skipped` (with `reason`), and `review_answered` (`testsChanged`, `rerun`, `linesChanged`, `linesSame`, `linesGone`) at the next answer; `red_review.on` once per job. Only with two phases; a fix and the review fix never get it. With the switch off every request is byte-for-byte what rc.66 sent. Nothing changes on the AI Runtime (it never reads a refused sentence's text) or in QuikProjects (the run record keeps rule words only). Also in rc.67: everything in rc.66.
package/dist/index.js CHANGED
@@ -28771,12 +28771,16 @@ function clearCheckoutExtraHeader() {
28771
28771
  }
28772
28772
  var PUSH_RETRY_DELAYS_MS = [3e3, 6e3, 12e3];
28773
28773
  var REPOSITORY_NOT_FOUND_RE = /Repository not found/i;
28774
+ var SERVER_ERROR_DELAYS_MS = [5e3, 15e3, 3e4, 6e4];
28775
+ var SERVER_ERROR_RE = /Internal Server Error|Bad Gateway|Service Unavailable|Gateway Timeout|returned error: 5\d\d/i;
28774
28776
  function sleepSync(ms) {
28775
28777
  Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, ms);
28776
28778
  }
28777
28779
  function push(branch, installationToken, sleep = sleepSync) {
28778
28780
  clearCheckoutExtraHeader();
28779
28781
  const basicAuth = Buffer.from(`x-access-token:${installationToken}`).toString("base64");
28782
+ let notFoundRetries = 0;
28783
+ let serverRetries = 0;
28780
28784
  for (let attempt2 = 0; ; attempt2 += 1) {
28781
28785
  try {
28782
28786
  git(["push", "--set-upstream", "origin", branch], {
@@ -28787,10 +28791,22 @@ function push(branch, installationToken, sleep = sleepSync) {
28787
28791
  if (attempt2 > 0) console.log(JSON.stringify({ event: "git.push_retry_ok", attempts: attempt2 + 1 }));
28788
28792
  return;
28789
28793
  } catch (err2) {
28790
- const delay = PUSH_RETRY_DELAYS_MS[attempt2];
28791
28794
  const said = `${err2 instanceof Error ? err2.message : String(err2)} ${String(err2.stderr ?? "")}`;
28792
- if (delay === void 0 || !REPOSITORY_NOT_FOUND_RE.test(said)) throw err2;
28793
- console.log(JSON.stringify({ event: "git.push_retry", attempt: attempt2 + 1, waitMs: delay }));
28795
+ let cause;
28796
+ let delay;
28797
+ if (REPOSITORY_NOT_FOUND_RE.test(said)) {
28798
+ cause = "repository_not_found";
28799
+ delay = PUSH_RETRY_DELAYS_MS[notFoundRetries];
28800
+ if (delay !== void 0) notFoundRetries += 1;
28801
+ } else if (SERVER_ERROR_RE.test(said)) {
28802
+ cause = "server_error";
28803
+ delay = SERVER_ERROR_DELAYS_MS[serverRetries];
28804
+ if (delay !== void 0) serverRetries += 1;
28805
+ } else {
28806
+ throw err2;
28807
+ }
28808
+ if (delay === void 0) throw err2;
28809
+ console.log(JSON.stringify({ event: "git.push_retry", attempt: attempt2 + 1, waitMs: delay, cause }));
28794
28810
  sleep(delay);
28795
28811
  }
28796
28812
  }
@@ -51745,13 +51761,14 @@ function writePhase0Marker(runId) {
51745
51761
  }
51746
51762
 
51747
51763
  // src/failureArtifact.ts
51764
+ var import_node_child_process11 = require("node:child_process");
51748
51765
  var import_node_fs25 = require("node:fs");
51749
51766
  var import_node_path26 = require("node:path");
51750
51767
  var FAILURE_ARTIFACT_DIR = "quikpilot-failure";
51751
51768
  var REPORT_COPY = "final-test-report.xml";
51752
51769
  var MAX_REPORT_BYTES = 5 * 1024 * 1024;
51753
51770
  var MAX_FILES = 200;
51754
- var RUNNER_VERSION = true ? "9.3.0-rc.68" : "dev";
51771
+ var RUNNER_VERSION = true ? "9.3.0-rc.69" : "dev";
51755
51772
  function safeDestination(base, repoPath) {
51756
51773
  if (!repoPath || (0, import_node_path26.isAbsolute)(repoPath)) return null;
51757
51774
  const destination = (0, import_node_path26.resolve)(base, repoPath);
@@ -51759,6 +51776,26 @@ function safeDestination(base, repoPath) {
51759
51776
  if (!rel || rel.startsWith("..") || (0, import_node_path26.isAbsolute)(rel)) return null;
51760
51777
  return destination;
51761
51778
  }
51779
+ var BUNDLE_FILE = "quikpilot-change.bundle";
51780
+ function keepCommitBundle(repo, folder, branch) {
51781
+ const git3 = (args2) => (0, import_node_child_process11.execFileSync)("git", args2, { cwd: repo, encoding: "utf8", stdio: ["ignore", "pipe", "pipe"] }).trim();
51782
+ try {
51783
+ if (git3(["rev-parse", "--abbrev-ref", "HEAD"]) !== branch) return null;
51784
+ if (git3(["diff", "--name-only", "HEAD~1", "HEAD"]) === "") return null;
51785
+ const commit2 = git3(["rev-parse", "HEAD"]);
51786
+ const file = (0, import_node_path26.join)(folder, BUNDLE_FILE);
51787
+ git3(["bundle", "create", file, "HEAD", "^HEAD~1"]);
51788
+ let verified = true;
51789
+ try {
51790
+ git3(["bundle", "verify", file]);
51791
+ } catch {
51792
+ verified = false;
51793
+ }
51794
+ return { file: BUNDLE_FILE, branch, commit: commit2, verified, restore: `git fetch ${BUNDLE_FILE} HEAD:refs/heads/${branch}` };
51795
+ } catch {
51796
+ return null;
51797
+ }
51798
+ }
51762
51799
  function writeFailureArtifact(input) {
51763
51800
  if (input.results.length === 0) return { written: false };
51764
51801
  try {
@@ -51786,6 +51823,7 @@ function writeFailureArtifact(input) {
51786
51823
  testReport = "included";
51787
51824
  }
51788
51825
  }
51826
+ const bundle = input.commitBranch ? keepCommitBundle(input.cwd, base, input.commitBranch) : null;
51789
51827
  const manifest = {
51790
51828
  runId: input.runId,
51791
51829
  issueKey: input.issueKey,
@@ -51799,7 +51837,8 @@ function writeFailureArtifact(input) {
51799
51837
  files,
51800
51838
  skipped,
51801
51839
  testReport,
51802
- failureReasons: input.failureReasons
51840
+ failureReasons: input.failureReasons,
51841
+ bundle
51803
51842
  };
51804
51843
  const text3 = JSON.stringify(manifest, (_key, value) => typeof value === "string" ? scrubSecrets(value, input.secrets) : value, 2);
51805
51844
  (0, import_node_fs25.writeFileSync)((0, import_node_path26.join)(base, "manifest.json"), text3);
@@ -52856,6 +52895,7 @@ async function run2(env2) {
52856
52895
  results: generatedResults,
52857
52896
  testReport: finalTestReport,
52858
52897
  failureReasons,
52898
+ commitBranch: packet?.branch ?? null,
52859
52899
  secrets: runToken ? [runToken] : []
52860
52900
  });
52861
52901
  } catch (err2) {