@quikit/quikpilot-runner 9.3.0-rc.17 → 9.3.0-rc.18
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 +2 -0
- package/dist/index.js +59 -30
- package/dist/index.js.map +2 -2
- package/package.json +1 -1
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.18 — an honest "I cannot finish" no longer throws away a change that is one fix away (QUIKSPL-139).** The AI wrote the fix and its tests, ran the project's tests until its runs were used (4 failing, then 3, then 3) and answered `CANNOT_COMPLETE`; the whole change was thrown away and a second attempt started from nothing, which did worse. Had it said `DONE`, every check would have run and the fix step (QUIKTR-1527) would have continued from the same change. Now a give-up is KEPT when the change would have passed as a `DONE` (something changed, every required test case written, no file cut short or broken) and the AI's LAST test run came back with failing tests that are the change's doing. It is recorded as attempt 1 `kept`, goes through every check like any result, and when only the tests fail the existing fix continues from it (three attempts in all, so at most two fixes). Only in `loop-tests` mode with fixing on (the project's setting above 0); a fix attempt that gives up is not kept again; time-outs, network errors and every other ending behave as before. `QUIKPILOT_KEEP_ON_GIVE_UP=off` restores the clean second attempt without a new release. Nothing new goes to the AI service.
|
|
154
|
+
|
|
153
155
|
**9.3.0-rc.17 — the list of files that hold tests is read from this run's own test run (QUIKTR-1526).** Before the AI picks files, the AI service is given the files the project's test runner discovers and refuses an answer that puts test cases on any other existing file. That list used to come from the last merged QuikPilot run, so a test file added by hand since then was unknown and an honest answer about it was refused (QUIKSPL-140 died at targeting). Now `Setup` and the baseline test run come BEFORE targeting, and the list is built from that run's own report: the files it attributes tests to, put in the form of the file list and kept only if they are in it (the AI service rejects the whole request otherwise); each file that cannot be placed, and each test the report names without a file (a Java class name, a Jest describe title), is counted in `unmappedEntries`, which switches the refusal off. Doubt turns the check off, never on: no test command, no report, a report with no tests, or a wait that ran out sends `ABSENT`. Targeting waits for the baseline at most 90 seconds (`QUIKPILOT_DISCOVERY_WAIT_SECONDS`); past that the run says so in its notes and the baseline carries on beside the code-writing step exactly as before (it is started once). The list QuikProjects stores is no longer used by this runner. The log gets one `test_discovery` line with counts only. No change in the AI service or in QuikProjects.
|
|
154
156
|
|
|
155
157
|
**9.3.0-rc.16 — changes no test depends on are named (QUIKTR-1569).** A green test run only proves what the tests check (QUIKSPL-138: the pagination fix also rewrote the neighbouring `hasMore` line, wrongly, and all 75 tests stayed green). In `loop-tests` mode, after a change has passed every check, each changed block of an existing code file that is not a test is put back as it was, ON ITS OWN, and the project's tests run once more (a block that looks unneeded is run a second time before it is flagged). A block with every test still passing is reported under "What QuikPilot noticed" as a file and line numbers only, never the code: it is a statement about the tests, not about the code, since a block can be right and untested. It warns and never blocks. A run that times out, leaves no report or a stale one counts as unknown and is never flagged; a block put back that makes tests vanish counts as needed; at most 8 blocks are checked, for at most 6 minutes and never in the last 2 minutes before the job's stop; a suite too slow to run again, or a project with no readable baseline, is skipped. Files the run created, tests, documents and configuration are not looked at. The checkout and the final test report are put back after every run; a checkout that does not come back ends the run, as for `run_tests`. Switch it off with `QUIKPILOT_HUNK_CHECK=off`. An older QuikProjects ignores the new field.
|
package/dist/index.js
CHANGED
|
@@ -13393,6 +13393,36 @@ async function runCodegenLoop(args, deps) {
|
|
|
13393
13393
|
if (!fits) throw new CodegenLoopFailure("token_ceiling");
|
|
13394
13394
|
return reason;
|
|
13395
13395
|
};
|
|
13396
|
+
const handOverRefusal = (turn, quiet) => {
|
|
13397
|
+
const changed = overlay.changedPaths();
|
|
13398
|
+
if (changed.length === 0 || changed.length === seededText.size && changed.every((p) => seededText.get(p) === overlay.get(p)?.lf)) {
|
|
13399
|
+
return new CodegenLoopFailure("no_writes");
|
|
13400
|
+
}
|
|
13401
|
+
const texts = changed.map((p) => overlay.get(p)?.lf ?? "");
|
|
13402
|
+
const missing = args.requiredAutomationIds.filter((id) => !texts.some((t) => t.includes(`[${id}]`)));
|
|
13403
|
+
if (missing.length > 0) {
|
|
13404
|
+
if (!quiet) log({ event: "codegen.loop_refused", turn, reason: "coverage_missing", missing: missing.length });
|
|
13405
|
+
return new CodegenLoopFailure("coverage_missing", void 0, void 0, `${missing.length} required test case(s) not written`, coverageSentence(missing));
|
|
13406
|
+
}
|
|
13407
|
+
const planSteps = args.targets.flatMap((t) => t.planStepsImplemented);
|
|
13408
|
+
for (const path of changed) {
|
|
13409
|
+
const entry = overlay.get(path);
|
|
13410
|
+
if (!entry || entry.created || entry.originalLf === null) continue;
|
|
13411
|
+
const pseudo = { path, kind: "EXISTING", planStepsImplemented: planSteps };
|
|
13412
|
+
const suspect = looksLikeTruncatedRewrite(pseudo, entry.originalLf, entry.lf);
|
|
13413
|
+
if (suspect) {
|
|
13414
|
+
if (!quiet) log({ event: "codegen.loop_refused", turn, reason: "truncation_guard", path });
|
|
13415
|
+
return new CodegenLoopFailure("truncation_guard", void 0, void 0, `${path}: ${suspect}`, truncationSentence(path, suspect));
|
|
13416
|
+
}
|
|
13417
|
+
}
|
|
13418
|
+
const broken = ws.syntaxProblems()[0];
|
|
13419
|
+
if (broken) {
|
|
13420
|
+
if (!quiet) log({ event: "codegen.loop_refused", turn, reason: "syntax_error", path: broken.path, kind: broken.problem.kind, line: broken.problem.line });
|
|
13421
|
+
const sentence = `${broken.path}: ${describeSyntaxProblem(broken.problem)}`;
|
|
13422
|
+
return new CodegenLoopFailure("syntax_error", void 0, void 0, sentence, sentence.slice(0, MAX_PREVIOUS_DETAIL_CHARS));
|
|
13423
|
+
}
|
|
13424
|
+
return null;
|
|
13425
|
+
};
|
|
13396
13426
|
log({ event: "codegen.loop_start", maxTurns: limits.maxTurns, maxToolCalls: limits.maxToolCalls, listingFiles: args.listing.length });
|
|
13397
13427
|
try {
|
|
13398
13428
|
for (let turn = 1; turn <= limits.maxTurns; turn++) {
|
|
@@ -13456,37 +13486,17 @@ async function runCodegenLoop(args, deps) {
|
|
|
13456
13486
|
if (body.outcome === "CANNOT_COMPLETE") {
|
|
13457
13487
|
log({ event: "codegen.loop_turn", turn, outcome: "cannot_complete", requestTokens, elapsedMs: now() - turnStarted, calls: [] });
|
|
13458
13488
|
const said = typeof body.summary === "string" ? body.summary.slice(0, MAX_SUMMARY_CHARS) : void 0;
|
|
13489
|
+
const last = lastTestAnswer;
|
|
13490
|
+
if (args.keepOnGiveUp === true && last !== void 0 && last.regressions + last.newFailures > 0 && handOverRefusal(turn, true) === null) {
|
|
13491
|
+
log({ event: "codegen.loop_kept", files: overlay.changedPaths().length, regressions: last.regressions, newFailures: last.newFailures });
|
|
13492
|
+
return { results: overlay.results(), summary: snapshot("gave_up_kept"), doneSummary: said ?? "", gaveUp: true };
|
|
13493
|
+
}
|
|
13459
13494
|
throw new CodegenLoopFailure("cannot_complete", void 0, void 0, said, said);
|
|
13460
13495
|
}
|
|
13461
13496
|
if (body.outcome === "DONE") {
|
|
13462
13497
|
log({ event: "codegen.loop_turn", turn, outcome: "done", requestTokens, elapsedMs: now() - turnStarted, calls: [] });
|
|
13463
|
-
const
|
|
13464
|
-
if (
|
|
13465
|
-
throw new CodegenLoopFailure("no_writes");
|
|
13466
|
-
}
|
|
13467
|
-
const texts = changed.map((p) => overlay.get(p)?.lf ?? "");
|
|
13468
|
-
const missing = args.requiredAutomationIds.filter((id) => !texts.some((t) => t.includes(`[${id}]`)));
|
|
13469
|
-
if (missing.length > 0) {
|
|
13470
|
-
log({ event: "codegen.loop_refused", turn, reason: "coverage_missing", missing: missing.length });
|
|
13471
|
-
throw new CodegenLoopFailure("coverage_missing", void 0, void 0, `${missing.length} required test case(s) not written`, coverageSentence(missing));
|
|
13472
|
-
}
|
|
13473
|
-
const planSteps = args.targets.flatMap((t) => t.planStepsImplemented);
|
|
13474
|
-
for (const path of changed) {
|
|
13475
|
-
const entry = overlay.get(path);
|
|
13476
|
-
if (!entry || entry.created || entry.originalLf === null) continue;
|
|
13477
|
-
const pseudo = { path, kind: "EXISTING", planStepsImplemented: planSteps };
|
|
13478
|
-
const suspect = looksLikeTruncatedRewrite(pseudo, entry.originalLf, entry.lf);
|
|
13479
|
-
if (suspect) {
|
|
13480
|
-
log({ event: "codegen.loop_refused", turn, reason: "truncation_guard", path });
|
|
13481
|
-
throw new CodegenLoopFailure("truncation_guard", void 0, void 0, `${path}: ${suspect}`, truncationSentence(path, suspect));
|
|
13482
|
-
}
|
|
13483
|
-
}
|
|
13484
|
-
const broken = ws.syntaxProblems()[0];
|
|
13485
|
-
if (broken) {
|
|
13486
|
-
log({ event: "codegen.loop_refused", turn, reason: "syntax_error", path: broken.path, kind: broken.problem.kind, line: broken.problem.line });
|
|
13487
|
-
const sentence = `${broken.path}: ${describeSyntaxProblem(broken.problem)}`;
|
|
13488
|
-
throw new CodegenLoopFailure("syntax_error", void 0, void 0, sentence, sentence.slice(0, MAX_PREVIOUS_DETAIL_CHARS));
|
|
13489
|
-
}
|
|
13498
|
+
const refusal = handOverRefusal(turn, false);
|
|
13499
|
+
if (refusal) throw refusal;
|
|
13490
13500
|
const stopReason = isFinal ? `forced_${finalReason}` : "model_done";
|
|
13491
13501
|
const doneSummary = typeof body.summary === "string" ? body.summary.slice(0, MAX_SUMMARY_CHARS) : "";
|
|
13492
13502
|
log({ event: "codegen.loop_done", turns, toolCalls: ledger.toolCalls, edits: ws.edits.size, created: ws.created.size, stopReason });
|
|
@@ -13626,7 +13636,8 @@ function buildCodegenLoopArgs(p, context = collectLoopContext({ targets: p.targe
|
|
|
13626
13636
|
protectedTestPaths,
|
|
13627
13637
|
// The files already shown are evidence for the parse check that the project parses (`syntaxCheck.ts`).
|
|
13628
13638
|
syntaxSeed: context.entries.map((e) => ({ path: e.path, text: e.content })),
|
|
13629
|
-
...p.mode === "loop-tests" && p.tests ? { tests: p.tests } : {}
|
|
13639
|
+
...p.mode === "loop-tests" && p.tests ? { tests: p.tests } : {},
|
|
13640
|
+
...p.mode === "loop-tests" && p.tests && p.keepOnGiveUp ? { keepOnGiveUp: true } : {}
|
|
13630
13641
|
};
|
|
13631
13642
|
}
|
|
13632
13643
|
var NO_SUMMARY = {
|
|
@@ -13663,6 +13674,10 @@ async function oneTestRunMs(tests) {
|
|
|
13663
13674
|
const limit = testTimeLimitMs(timed?.durationMs ?? null);
|
|
13664
13675
|
return limit === "too_slow" ? MAX_TEST_LIMIT_MS : limit;
|
|
13665
13676
|
}
|
|
13677
|
+
function keptAttempt(n, summary) {
|
|
13678
|
+
return { n, outcome: "kept", reason: "cannot_complete", turns: summary.turns, toolCalls: summary.toolCalls };
|
|
13679
|
+
}
|
|
13680
|
+
var keptWarning = (n) => `The ${n === 1 ? "first" : "second"} attempt said it could not finish, but its change passed every check the AI is held to apart from the project's tests, so QuikPilot kept it and let the checks decide.`;
|
|
13666
13681
|
function failedAttempt(n, failure) {
|
|
13667
13682
|
return { n, outcome: "failed", reason: failure.reason, turns: failure.summary?.turns ?? 0, toolCalls: failure.summary?.toolCalls ?? 0 };
|
|
13668
13683
|
}
|
|
@@ -13724,6 +13739,11 @@ async function runCodegenStep(p) {
|
|
|
13724
13739
|
const first = await attempt2();
|
|
13725
13740
|
const firstMs = now() - firstStarted;
|
|
13726
13741
|
if ("done" in first) {
|
|
13742
|
+
if (first.done.gaveUp) {
|
|
13743
|
+
log({ event: "codegen.attempt_end", attempt: 1, outcome: "kept", reason: "cannot_complete", turns: first.done.summary.turns, toolCalls: first.done.summary.toolCalls, durationMs: firstMs });
|
|
13744
|
+
warn(p, keptWarning(1));
|
|
13745
|
+
return finish(first.done, [keptAttempt(1, first.done.summary)]);
|
|
13746
|
+
}
|
|
13727
13747
|
log({ event: "codegen.attempt_end", attempt: 1, outcome: "finished", turns: first.done.summary.turns, toolCalls: first.done.summary.toolCalls, durationMs: firstMs });
|
|
13728
13748
|
return finish(first.done);
|
|
13729
13749
|
}
|
|
@@ -13759,6 +13779,11 @@ async function runCodegenStep(p) {
|
|
|
13759
13779
|
const second = await attempt2(previous);
|
|
13760
13780
|
const secondMs = now() - secondStarted;
|
|
13761
13781
|
if ("done" in second) {
|
|
13782
|
+
if (second.done.gaveUp) {
|
|
13783
|
+
log({ event: "codegen.attempt_end", attempt: 2, outcome: "kept", reason: "cannot_complete", turns: second.done.summary.turns, toolCalls: second.done.summary.toolCalls, durationMs: secondMs });
|
|
13784
|
+
warn(p, keptWarning(2));
|
|
13785
|
+
return finish(second.done, [firstRecord, keptAttempt(2, second.done.summary)]);
|
|
13786
|
+
}
|
|
13762
13787
|
log({ event: "codegen.attempt_end", attempt: 2, outcome: "finished", turns: second.done.summary.turns, toolCalls: second.done.summary.toolCalls, durationMs: secondMs });
|
|
13763
13788
|
return finish(second.done, [firstRecord, { n: 2, outcome: "finished", turns: second.done.summary.turns, toolCalls: second.done.summary.toolCalls }]);
|
|
13764
13789
|
}
|
|
@@ -13822,7 +13847,9 @@ async function runHealAttempt(i2) {
|
|
|
13822
13847
|
const now = p.deps?.now ?? Date.now;
|
|
13823
13848
|
try {
|
|
13824
13849
|
const done = await runCodegenLoop(
|
|
13825
|
-
|
|
13850
|
+
// `keepOnGiveUp` is off on purpose, whatever the step says: only a first attempt keeps a give-up. A fix that gives up ends as `heal_failed`
|
|
13851
|
+
// with the earlier failure, so a hopeless change cannot be carried from fix to fix.
|
|
13852
|
+
{ ...args, keepOnGiveUp: false, seed: i2.results, previousAttempt: healPreviousAttempt(i2.attempt, i2.answer) },
|
|
13826
13853
|
{
|
|
13827
13854
|
post: (contextData, signal) => postCodegenTurn(p.gateway, contextData, signal),
|
|
13828
13855
|
...p.deps,
|
|
@@ -15124,7 +15151,7 @@ var FAILURE_ARTIFACT_DIR = "quikpilot-failure";
|
|
|
15124
15151
|
var REPORT_COPY = "final-test-report.xml";
|
|
15125
15152
|
var MAX_REPORT_BYTES = 5 * 1024 * 1024;
|
|
15126
15153
|
var MAX_FILES = 200;
|
|
15127
|
-
var RUNNER_VERSION = true ? "9.3.0-rc.
|
|
15154
|
+
var RUNNER_VERSION = true ? "9.3.0-rc.18" : "dev";
|
|
15128
15155
|
function safeDestination(base, repoPath) {
|
|
15129
15156
|
if (!repoPath || (0, import_node_path14.isAbsolute)(repoPath)) return null;
|
|
15130
15157
|
const destination = (0, import_node_path14.resolve)(base, repoPath);
|
|
@@ -15778,8 +15805,10 @@ async function run(env2) {
|
|
|
15778
15805
|
targeting.skippedCases ?? []
|
|
15779
15806
|
);
|
|
15780
15807
|
const codegenMode = resolveCodegenMode();
|
|
15808
|
+
const keepOnGiveUp = codegenMode === "loop-tests" && packet.guardrails.maxHealIterations > 0 && process.env.QUIKPILOT_KEEP_ON_GIVE_UP?.trim().toLowerCase() !== "off";
|
|
15781
15809
|
const stepParams = {
|
|
15782
15810
|
mode: codegenMode,
|
|
15811
|
+
...keepOnGiveUp ? { keepOnGiveUp: true } : {},
|
|
15783
15812
|
tests: {
|
|
15784
15813
|
root: process.cwd(),
|
|
15785
15814
|
command: packet.commands.test,
|