@quikit/quikpilot-runner 9.3.0-rc.21 → 9.3.0-rc.22

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
@@ -150,6 +150,8 @@ it, the callback carries it as `unsuppliedInputs` (at most 10 functions, 5 names
150
150
  noticed" as a check. This is the shape of a change whose new tests pass only because they hand the function the field themselves. It can be
151
151
  wrong (a field that arrives from a database row or a request), so it only warns and never blocks. TypeScript is not covered (QUIKTR-1547).
152
152
 
153
+ **9.3.0-rc.22 — phase 1 after the first live run (QUIKTR-1608, live run QUIKSPL-207).** On rc.21 the first live two-phase run failed in phase 1 in both attempts: the AI fought the existing-test rule for ten turns, then made its red tests pass and gave up. (1) In phase `tests`, a give-up (`CANNOT_COMPLETE`) whose change passes every hand-over check (every case covered, tests only) and whose tests were seen failing on the untouched code, in a whole-suite run on the change as it stands, is phase 1 done: the code phase follows (log `codegen.red_check` `gave_up_but_red`). (2) A failed two-phase attempt now records the phases it went through and their counts, as a finished one does. The AI Runtime's phase-1 paragraph (contract §33.4, amended) says failing is the goal (DONE then) and to put new tests and their helpers in a new test file when an existing one sends additions back; deploy it first.
154
+
153
155
  **9.3.0-rc.21 (harness 6 of 7) — reproduce first, then fix (QUIKTR-1608, contract §33).** One step could change the tests and the code at once; when they disagreed the AI changed both (G18, G20, G23; fixes rescued 2 of 6 kept give-ups). Under the harness version an attempt is now written in phases, each held to its files by the runner (`codegenTools.ts` lane, answered `protected` before any budget is touched): (1) `loop.phase: "tests"` - only test files may change (the code answers `code_locked`); before the phase may end, each own test for a case with a known, non-Regression label must be seen FAILING in a whole-suite run on the untouched code. Otherwise the DONE is sent back as a refused turn (rule word `done_rule`, a fixed sentence naming the cases), at most twice; then the phase ends and the reviewer is warned (record `phases[].redUnproven`). (2) `loop.phase: "code"` - the phase-1 tests are frozen (`test_frozen`, also for any new or existing test file); the request carries them as a kept change (`endedWith: "tests_written"`, the red run, §32's steps). (3) When the code phase gives up while frozen tests of this run still fail: ONE amendment, a short code-phase loop with `loop.amend` (those files only, `edit_file` only, never emptied); the change then goes on with a warning naming the files. If the amendment fails too, the attempt fails `test_case_disagree` and is not tried again; no pull request. A second attempt after a failed code phase starts from the same frozen tests; fixes after the project's checks and the review fix are code-only with the tests frozen. The run record gains `phases` (phase, outcome, counts) and each test run its `phase`; the record now keeps 20 test runs and a run's `scope` (two gaps of the 1604 build). **`QUIKPILOT_TWO_PHASE=off` writes the change in one phase, as before.** AI Runtime contract §33 and QuikProjects (record schema) first. **Not published: waits for all seven harness tickets.**
154
156
 
155
157
  **9.3.0-rc.21 (harness 5 of 7) — the next attempt is told what the one before it did, step by step (QUIKTR-1607, contract §32).** A second attempt or a fix was told how the earlier attempt ended, not what it tried, and in G18, G20 and G23 it started its diagnosis again and repeated the same kind of change. Under the harness version, `loop.previousAttempt` also carries `steps` (and `stepsTrimmed` when the oldest turns were left out): per turn, the AI's own note, and per call the tool, the path it named (or run_tests' `file`), the runner's closed answer and reason, test counts and `scope`, and the rule words of a reply the AI Runtime sent back. NO FILE TEXT: never an edit's find/replace/content, a function's arguments, any tool output text, a test name or a message (test names and messages stay in `lastTestRun`). Built only from what the AI Runtime was already SENT in that attempt (a turn that ran but was never sent stays out), within 15,000 characters, 40 turns, 8 calls a turn and 40 in all, oldest turns left out first. A second attempt gets the first attempt's steps; a fix gets the steps of the attempt whose change it keeps, and hands its own to the next fix. Wire only: never logged, never in the run record. Loop-2 never sends them. AI Runtime contract §32 first. **Not published: waits for all seven harness tickets.**
package/dist/index.js CHANGED
@@ -14485,6 +14485,10 @@ async function runCodegenLoop(args, deps) {
14485
14485
  log({ event: "codegen.loop_turn", turn, outcome: "cannot_complete", requestTokens, elapsedMs: now() - turnStarted, calls: [] });
14486
14486
  const said = typeof body.summary === "string" ? body.summary.slice(0, MAX_SUMMARY_CHARS) : void 0;
14487
14487
  const last = lastTestAnswer;
14488
+ if (harness && args.phase === "tests" && last !== void 0 && lastTestVersion === versionOfFiles(filesOnDisk()) && handOverRefusal(turn, true) === null && redProblem() === null) {
14489
+ log({ event: "codegen.red_check", turn, outcome: "gave_up_but_red", files: overlay.changedPaths().length });
14490
+ return { results: overlay.results(), summary: snapshot("gave_up_kept"), doneSummary: said ?? "", steps: sentSteps(), lastTestAnswer: last };
14491
+ }
14488
14492
  if (args.keepOnGiveUp === true && last !== void 0 && last.regressions + last.newFailures > 0 && handOverRefusal(turn, true) === null) {
14489
14493
  log({ event: "codegen.loop_kept", files: overlay.changedPaths().length, regressions: last.regressions, newFailures: last.newFailures });
14490
14494
  return { results: overlay.results(), summary: snapshot("gave_up_kept"), doneSummary: said ?? "", gaveUp: true, steps: sentSteps(), ...lastTestAnswer ? { lastTestAnswer } : {} };
@@ -14630,6 +14634,10 @@ function keptChange(attempt2, endedWith, answer, steps) {
14630
14634
  async function runPhases(i2) {
14631
14635
  const phases = [];
14632
14636
  const summaries = [];
14637
+ const recorded = (f, phase) => {
14638
+ if (f.summary) f.summary = mergePhaseSummaries([...summaries, { phase, summary: f.summary }], phases);
14639
+ return f;
14640
+ };
14633
14641
  let tests = i2.resume;
14634
14642
  if (tests) summaries.push({ phase: "tests", summary: tests.summary });
14635
14643
  if (!tests) {
@@ -14648,7 +14656,7 @@ async function runPhases(i2) {
14648
14656
  const f = asFailure(err);
14649
14657
  phases.push(record("tests", "failed", f.summary));
14650
14658
  i2.log({ event: "codegen.phase_end", attempt: i2.attempt, phase: "tests", outcome: "failed", reason: f.reason });
14651
- return { failure: f, phases };
14659
+ return { failure: recorded(f, "tests"), phases };
14652
14660
  }
14653
14661
  phases.push(record("tests", "finished", d1.summary, d1.redUnproven?.length));
14654
14662
  summaries.push({ phase: "tests", summary: d1.summary });
@@ -14677,7 +14685,7 @@ async function runPhases(i2) {
14677
14685
  const f = asFailure(err);
14678
14686
  phases.push(record("code", "failed", f.summary));
14679
14687
  i2.log({ event: "codegen.phase_end", attempt: i2.attempt, phase: "code", outcome: "failed", reason: f.reason });
14680
- return { failure: f, tests, phases };
14688
+ return { failure: recorded(f, "code"), tests, phases };
14681
14689
  }
14682
14690
  summaries.push({ phase: "code", summary: d2.summary });
14683
14691
  if (!d2.gaveUp) {
@@ -14707,7 +14715,7 @@ async function runPhases(i2) {
14707
14715
  i2.log({ event: "codegen.phase_end", attempt: i2.attempt, phase: "amend", outcome: "failed", reason: f.reason });
14708
14716
  const disagree = new CodegenLoopFailure("test_case_disagree", void 0, f, `${amend.length} test file(s) and the approved cases still disagree`, f.told);
14709
14717
  disagree.summary = f.summary ?? d2.summary;
14710
- return { failure: disagree, tests, phases, final: true };
14718
+ return { failure: recorded(disagree, "amend"), tests, phases, final: true };
14711
14719
  }
14712
14720
  phases.push(record("amend", "finished", d3.summary));
14713
14721
  summaries.push({ phase: "amend", summary: d3.summary });
@@ -16536,7 +16544,7 @@ var FAILURE_ARTIFACT_DIR = "quikpilot-failure";
16536
16544
  var REPORT_COPY = "final-test-report.xml";
16537
16545
  var MAX_REPORT_BYTES = 5 * 1024 * 1024;
16538
16546
  var MAX_FILES = 200;
16539
- var RUNNER_VERSION = true ? "9.3.0-rc.21" : "dev";
16547
+ var RUNNER_VERSION = true ? "9.3.0-rc.22" : "dev";
16540
16548
  function safeDestination(base, repoPath) {
16541
16549
  if (!repoPath || (0, import_node_path15.isAbsolute)(repoPath)) return null;
16542
16550
  const destination = (0, import_node_path15.resolve)(base, repoPath);