@quikit/quikpilot-runner 9.3.0-rc.21 → 9.3.0-rc.23
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 +4 -0
- package/dist/index.js +48 -21
- package/dist/index.js.map +3 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -150,6 +150,10 @@ 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.23 — the red check counts one-file runs (QUIKTR-1608, live run QUIKSPL-208).** On rc.22 the first two-phase run opened a correct pull request (#112), but phase 1 proved the bug with a run of its test file (4 failing on the old code), the red check counted whole-suite runs only, sent the DONE back twice and ended phase 1 marked 5 cases unproven, so the reviewer was wrongly warned. Every run of phase 1 is now evidence, with the change it ran on: a case is FAILING when a run on the change as it stands lists its test failing; PASSING when such a run covered its test (the whole suite, or the one file that holds its `[QP-...]` token) and it did not fail; NOT RUN when nothing covered it. A test seen passing is sent back as before; one not run is sent back with a sentence naming it, and if phase 1 ends anyway it is logged (`ended_unrun`) but never shown to the reviewer as unproven: only a test seen passing on the old code is. A cut failing list still cannot tell. The next phase is told about the latest run on the change as it stands, a one-file run included. Runner only.
|
|
154
|
+
|
|
155
|
+
**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.
|
|
156
|
+
|
|
153
157
|
**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
158
|
|
|
155
159
|
**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
|
@@ -14293,22 +14293,38 @@ async function runCodegenLoop(args, deps) {
|
|
|
14293
14293
|
const refusedTurns = [];
|
|
14294
14294
|
let refusedStreak = 0;
|
|
14295
14295
|
let sent = { entries: 0, results: 0 };
|
|
14296
|
-
|
|
14296
|
+
const redRuns = [];
|
|
14297
14297
|
let redRefusals = 0;
|
|
14298
14298
|
let redUnproven;
|
|
14299
|
+
const currentRedRuns = () => {
|
|
14300
|
+
const now2 = versionOfFiles(filesOnDisk());
|
|
14301
|
+
return redRuns.filter((r) => r.version === now2);
|
|
14302
|
+
};
|
|
14299
14303
|
const redProblem = () => {
|
|
14300
14304
|
const ids = args.redCheckIds ?? [];
|
|
14301
14305
|
if (ids.length === 0) return null;
|
|
14302
|
-
|
|
14303
|
-
|
|
14304
|
-
|
|
14305
|
-
|
|
14306
|
-
|
|
14307
|
-
|
|
14308
|
-
|
|
14309
|
-
|
|
14310
|
-
|
|
14311
|
-
|
|
14306
|
+
const runs = currentRedRuns();
|
|
14307
|
+
const passing = [];
|
|
14308
|
+
const unrun = [];
|
|
14309
|
+
for (const id of ids) {
|
|
14310
|
+
const token = `[${id}]`;
|
|
14311
|
+
if (runs.some((r) => r.failing.some((name) => name.includes(token)))) continue;
|
|
14312
|
+
const covering = runs.filter((r) => r.file === void 0 || (overlay.get(r.file)?.lf ?? "").includes(token));
|
|
14313
|
+
if (covering.length === 0) unrun.push(id);
|
|
14314
|
+
else if (covering.every((r) => !r.truncated)) passing.push(id);
|
|
14315
|
+
}
|
|
14316
|
+
if (passing.length > 0) {
|
|
14317
|
+
const one = passing.length === 1;
|
|
14318
|
+
const named = passing.slice(0, 6).map((id) => `[${id}]`).join(", ");
|
|
14319
|
+
const sentence = `${named} ${one ? "passes" : "pass"} on the code before any change, so ${one ? "it does" : "they do"} not show the bug: revise ${one ? "it" : "them"} so ${one ? "it fails" : "each fails"} for the reason its case gives.`;
|
|
14320
|
+
return { ids: passing, sentence: sentence.slice(0, 300), kind: "passing" };
|
|
14321
|
+
}
|
|
14322
|
+
if (unrun.length > 0) {
|
|
14323
|
+
const named = unrun.slice(0, 6).map((id) => `[${id}]`).join(", ");
|
|
14324
|
+
const sentence = `Run the tests with run_tests (the whole suite, or the file that holds them) before finishing phase 1: ${named} ${unrun.length === 1 ? "has" : "have"} not been run on the code as it is now.`;
|
|
14325
|
+
return { ids: unrun, sentence: sentence.slice(0, 300), kind: "unrun" };
|
|
14326
|
+
}
|
|
14327
|
+
return null;
|
|
14312
14328
|
};
|
|
14313
14329
|
const sentSteps = () => stepsOf(transcript.slice(0, sent.entries), toolResults.slice(0, sent.results));
|
|
14314
14330
|
let turns = 0;
|
|
@@ -14485,6 +14501,11 @@ async function runCodegenLoop(args, deps) {
|
|
|
14485
14501
|
log({ event: "codegen.loop_turn", turn, outcome: "cannot_complete", requestTokens, elapsedMs: now() - turnStarted, calls: [] });
|
|
14486
14502
|
const said = typeof body.summary === "string" ? body.summary.slice(0, MAX_SUMMARY_CHARS) : void 0;
|
|
14487
14503
|
const last = lastTestAnswer;
|
|
14504
|
+
if (harness && args.phase === "tests" && currentRedRuns().length > 0 && handOverRefusal(turn, true) === null && redProblem() === null) {
|
|
14505
|
+
log({ event: "codegen.red_check", turn, outcome: "gave_up_but_red", files: overlay.changedPaths().length });
|
|
14506
|
+
const red = currentRedRuns().at(-1).answer;
|
|
14507
|
+
return { results: overlay.results(), summary: snapshot("gave_up_kept"), doneSummary: said ?? "", steps: sentSteps(), lastTestAnswer: last ?? red };
|
|
14508
|
+
}
|
|
14488
14509
|
if (args.keepOnGiveUp === true && last !== void 0 && last.regressions + last.newFailures > 0 && handOverRefusal(turn, true) === null) {
|
|
14489
14510
|
log({ event: "codegen.loop_kept", files: overlay.changedPaths().length, regressions: last.regressions, newFailures: last.newFailures });
|
|
14490
14511
|
return { results: overlay.results(), summary: snapshot("gave_up_kept"), doneSummary: said ?? "", gaveUp: true, steps: sentSteps(), ...lastTestAnswer ? { lastTestAnswer } : {} };
|
|
@@ -14508,13 +14529,14 @@ async function runCodegenLoop(args, deps) {
|
|
|
14508
14529
|
forced = settleNextTurn(turn, forced);
|
|
14509
14530
|
continue;
|
|
14510
14531
|
}
|
|
14511
|
-
redUnproven = red.ids;
|
|
14512
|
-
log({ event: "codegen.red_check", turn, outcome: "ended_unproven", cases: red.ids.length });
|
|
14532
|
+
if (red.kind === "passing") redUnproven = red.ids;
|
|
14533
|
+
log({ event: "codegen.red_check", turn, outcome: red.kind === "passing" ? "ended_unproven" : "ended_unrun", cases: red.ids.length });
|
|
14513
14534
|
}
|
|
14514
14535
|
const stopReason = isFinal ? `forced_${finalReason}` : "model_done";
|
|
14515
14536
|
const doneSummary = typeof body.summary === "string" ? body.summary.slice(0, MAX_SUMMARY_CHARS) : "";
|
|
14516
14537
|
log({ event: "codegen.loop_done", turns, toolCalls: ledger.toolCalls, edits: ws.edits.size, created: ws.created.size, stopReason });
|
|
14517
|
-
|
|
14538
|
+
const told = lastTestAnswer ?? (args.phase === "tests" ? currentRedRuns().at(-1)?.answer : void 0);
|
|
14539
|
+
return { results: overlay.results(), summary: snapshot(stopReason), doneSummary, steps: sentSteps(), ...redUnproven ? { redUnproven } : {}, ...told ? { lastTestAnswer: told } : {} };
|
|
14518
14540
|
}
|
|
14519
14541
|
if (body.outcome !== "TOOL_CALLS") throw new CodegenLoopFailure("bad_reply");
|
|
14520
14542
|
if (isFinal) throw new CodegenLoopFailure("final_not_produced");
|
|
@@ -14566,9 +14588,10 @@ async function runCodegenLoop(args, deps) {
|
|
|
14566
14588
|
}
|
|
14567
14589
|
}
|
|
14568
14590
|
results.push(result);
|
|
14569
|
-
if (call.name === RUN_TESTS_TOOL && isTestAnswer(result.output) && result.output.scope === void 0)
|
|
14570
|
-
|
|
14571
|
-
|
|
14591
|
+
if (call.name === RUN_TESTS_TOOL && isTestAnswer(result.output) && result.output.scope === void 0) lastTestAnswer = result.output;
|
|
14592
|
+
if (call.name === RUN_TESTS_TOOL && isTestAnswer(result.output) && result.status !== "duplicate") {
|
|
14593
|
+
const file = result.output.scope === "file" && isPlainObject3(call.args) && typeof call.args.file === "string" ? call.args.file : void 0;
|
|
14594
|
+
redRuns.push({ version: versionOfFiles(filesOnDisk()), ...file ? { file } : {}, failing: result.output.failingTests, truncated: result.output.truncated, answer: result.output });
|
|
14572
14595
|
}
|
|
14573
14596
|
if (read) reads.push(read);
|
|
14574
14597
|
statusCounts[result.status] = (statusCounts[result.status] ?? 0) + 1;
|
|
@@ -14630,6 +14653,10 @@ function keptChange(attempt2, endedWith, answer, steps) {
|
|
|
14630
14653
|
async function runPhases(i2) {
|
|
14631
14654
|
const phases = [];
|
|
14632
14655
|
const summaries = [];
|
|
14656
|
+
const recorded = (f, phase) => {
|
|
14657
|
+
if (f.summary) f.summary = mergePhaseSummaries([...summaries, { phase, summary: f.summary }], phases);
|
|
14658
|
+
return f;
|
|
14659
|
+
};
|
|
14633
14660
|
let tests = i2.resume;
|
|
14634
14661
|
if (tests) summaries.push({ phase: "tests", summary: tests.summary });
|
|
14635
14662
|
if (!tests) {
|
|
@@ -14648,7 +14675,7 @@ async function runPhases(i2) {
|
|
|
14648
14675
|
const f = asFailure(err);
|
|
14649
14676
|
phases.push(record("tests", "failed", f.summary));
|
|
14650
14677
|
i2.log({ event: "codegen.phase_end", attempt: i2.attempt, phase: "tests", outcome: "failed", reason: f.reason });
|
|
14651
|
-
return { failure: f, phases };
|
|
14678
|
+
return { failure: recorded(f, "tests"), phases };
|
|
14652
14679
|
}
|
|
14653
14680
|
phases.push(record("tests", "finished", d1.summary, d1.redUnproven?.length));
|
|
14654
14681
|
summaries.push({ phase: "tests", summary: d1.summary });
|
|
@@ -14677,7 +14704,7 @@ async function runPhases(i2) {
|
|
|
14677
14704
|
const f = asFailure(err);
|
|
14678
14705
|
phases.push(record("code", "failed", f.summary));
|
|
14679
14706
|
i2.log({ event: "codegen.phase_end", attempt: i2.attempt, phase: "code", outcome: "failed", reason: f.reason });
|
|
14680
|
-
return { failure: f, tests, phases };
|
|
14707
|
+
return { failure: recorded(f, "code"), tests, phases };
|
|
14681
14708
|
}
|
|
14682
14709
|
summaries.push({ phase: "code", summary: d2.summary });
|
|
14683
14710
|
if (!d2.gaveUp) {
|
|
@@ -14707,7 +14734,7 @@ async function runPhases(i2) {
|
|
|
14707
14734
|
i2.log({ event: "codegen.phase_end", attempt: i2.attempt, phase: "amend", outcome: "failed", reason: f.reason });
|
|
14708
14735
|
const disagree = new CodegenLoopFailure("test_case_disagree", void 0, f, `${amend.length} test file(s) and the approved cases still disagree`, f.told);
|
|
14709
14736
|
disagree.summary = f.summary ?? d2.summary;
|
|
14710
|
-
return { failure: disagree, tests, phases, final: true };
|
|
14737
|
+
return { failure: recorded(disagree, "amend"), tests, phases, final: true };
|
|
14711
14738
|
}
|
|
14712
14739
|
phases.push(record("amend", "finished", d3.summary));
|
|
14713
14740
|
summaries.push({ phase: "amend", summary: d3.summary });
|
|
@@ -16536,7 +16563,7 @@ var FAILURE_ARTIFACT_DIR = "quikpilot-failure";
|
|
|
16536
16563
|
var REPORT_COPY = "final-test-report.xml";
|
|
16537
16564
|
var MAX_REPORT_BYTES = 5 * 1024 * 1024;
|
|
16538
16565
|
var MAX_FILES = 200;
|
|
16539
|
-
var RUNNER_VERSION = true ? "9.3.0-rc.
|
|
16566
|
+
var RUNNER_VERSION = true ? "9.3.0-rc.23" : "dev";
|
|
16540
16567
|
function safeDestination(base, repoPath) {
|
|
16541
16568
|
if (!repoPath || (0, import_node_path15.isAbsolute)(repoPath)) return null;
|
|
16542
16569
|
const destination = (0, import_node_path15.resolve)(base, repoPath);
|