@quikit/quikpilot-runner 9.3.0-rc.36 → 9.3.0-rc.38
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 +68 -11
- package/dist/index.js.map +4 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -152,6 +152,10 @@ wrong (a field that arrives from a database row or a request), so it only warns
|
|
|
152
152
|
|
|
153
153
|
**9.3.0-rc.36 — the run record says what each step cost and what it could touch (QUIKTR-1582, S7).** Each loop turn now records its request size by part (the list of files or the repository summary, the test cases, the task, earlier answers, the AI's notes, the fixed instructions; the runner's own estimate) and what the AI Runtime said the call used (`tokensInput`, `tokensOutput`, `costEstimateUsd`, `latencyMs`), at most 30 rows per loop; each step's record also carries its totals over the whole job (every attempt, phase and fix). The record says which folder the run could change and which it could read, and its largest request, in the list view too (before, only in map mode). The report back carries `aiCostUsd`, the sum of the AI Runtime's cost estimate over every AI call of the job (the estimate leaves out the model's thinking; the early look's own cost is not included). The early look's first call now waits up to 150 seconds (it was 60), so a cold AI service no longer ends it at once; QuikProjects waits about 200 seconds for the whole look, so it cannot wait longer. Numbers only: no text from a request or a reply is kept.
|
|
154
154
|
|
|
155
|
+
**9.3.0-rc.37 — the AI always sees what it just read (QUIKTR-1582, S7).** In map mode the code-writing loop trims old read outputs once a request passes a soft target, to keep turns small. That target was a flat 40,000 estimated tokens, and the trim also took the outputs of the turn just finished, before the AI had seen them. On a big repository the loop's first request alone can weigh about 36,000 (the summary, the context files, the cases), so every read went over the target and was dropped unseen: in the first S7 trial on the QuikIT fork the AI read the same three files 27 times and wrote nothing. Now the soft target is the first request plus room for 20,000 tokens of reads (at least 40,000, never above the ceiling); the soft trim only takes outputs the AI has already been shown; and an output it has not seen is dropped only when nothing else makes the request fit the ceiling, after the text of old writes is shortened. That last case answers "Too large to send with the rest of this request. Read a smaller part of the file." and logs `codegen.read_dropped_unseen`. Listing mode keeps the ceiling as its only target, with the same order.
|
|
156
|
+
|
|
157
|
+
**9.3.0-rc.38 — a loop turn waits as long as its own clock says (QUIKTR-1582, S7).** Node's built-in `fetch` gives up on any reply whose headers take longer than 300 seconds, whatever limit the caller passes ("fetch failed", cause `UND_ERR_HEADERS_TIMEOUT`; measured on Node 20 and 24). So the 420 seconds a loop's first turn was given (9.3.0-rc.34) never happened: when the AI service's first answer of the day took more than 300 seconds, the call failed as "transport", and in map mode that ended the run (S7 trial QTRIA-8). Now every AI call that brings its own clock (each turn of the targeting, code-writing and early-look loops) goes through Node's own `http`/`https` client, which has no such limit, with TCP keep-alive as `fetch` sets it; the clock is the only thing that ends it, and a timed-out turn still reads as `turn_timeout`. Calls without a clock (the single targeting and code-writing calls) keep `fetch` exactly as before, 300 seconds included, and the retry rules are unchanged. No new dependency.
|
|
158
|
+
|
|
155
159
|
**9.3.0-rc.35 — the AI's own notes, old looks shrunk to a stub, the end-of-turn recap, a folder's guidance, and the newer versions only where a repository needs them (QUIKTR-1581, S6 release B; contract §37).** On `targeting-loop-4` and `codegen-loop-6` (each behind its own AI Runtime flag; a refusal steps one version back, `-4` to `-3` and `-6` to `-5`, then as before) a loop request carries `loop.recap`, the LAST key of `loop`: the approved cases, the folders the AI may change and its own notes. A `TOOL_CALLS` reply may carry `notes`; they replace the notes kept so far (an empty string clears them, a reply without them keeps them), credentials are hidden, at most 1,500 characters are kept, and the run record keeps their length only. The answer of a look (`list_files`, `read_file`, `grep`, `find_definition`) from a turn older than the latest three shrinks to `{dropped: true, note: "read src/a.ts lines 120-220"}`; asking for it again is answered afresh, not as a repeat. The first read under a folder that has its own `AGENTS.md`, `CLAUDE.md` or `README.md` (not the repository root's, not one already shown in the repository map) carries that file once, credentials hidden, at most 2,000 characters, at most six a run. The early look's `findings` are cut to 6,000 characters of JSON before they are handed on (open questions first, never what the verdict stands on). **`QUIKPILOT_TOOLS2` now defaults to `auto`**: search tools v2 and the notes are asked for only when the repository needs them, that is in the map view or when its file list would cost `QUIKPILOT_TOOLS_MIN_TOKENS` (default 8,000) or more tokens; a small project keeps the loops it always had (`targeting-loop-1`, `codegen-loop-3`) and pays for no extra tool, response format or recap. `on` always asks for the newest version, `off` never asks, and `QUIKPILOT_NOTES=off` keeps the tools but never asks for the notes. The run logs `tools.decided`.
|
|
156
160
|
|
|
157
161
|
**9.3.0-rc.34 — the first turn of a loop waits for a new response schema (QUIKTR-1581 follow-up).** The first call with a response schema the model provider has not seen recently is very slow (232 to 275 seconds measured on 19 Oct 2026 for a request that takes 5 to 8 once the provider has it) and fast afterwards. The targeting loop's turn limit was 180 seconds, the same as the AI Runtime's own provider timeout, so that first call was cut off every time, the provider never kept the schema, and runs fell back to the single targeting call (one found no file and failed). Now the FIRST turn of the targeting loop and of the code-writing loop waits up to 420 seconds; every later turn keeps its own limit (180 and 300), so a hung call does not cost the long wait twice. The targeting loop's whole-loop limit is 900 seconds (it was 600). A limit set by the caller still applies to every turn. Pair it with `OPENROUTER_TIMEOUT_SECONDS=420` on the AI Runtime (its default, 180, ends the call before the runner would). Nothing else changes.
|
package/dist/index.js
CHANGED
|
@@ -26725,6 +26725,46 @@ function scrubEntriesForModel(entries, secrets, keep) {
|
|
|
26725
26725
|
});
|
|
26726
26726
|
}
|
|
26727
26727
|
|
|
26728
|
+
// src/fetchOnOwnClock.ts
|
|
26729
|
+
var import_node_http = __toESM(require("node:http"));
|
|
26730
|
+
var import_node_https = __toESM(require("node:https"));
|
|
26731
|
+
var NATIVE_FETCH = globalThis.fetch;
|
|
26732
|
+
var KEEP_ALIVE_INITIAL_DELAY_MS = 6e4;
|
|
26733
|
+
var NULL_BODY_STATUSES = /* @__PURE__ */ new Set([204, 205, 304]);
|
|
26734
|
+
async function fetchOnOwnClock(url, init) {
|
|
26735
|
+
if (!init.signal || globalThis.fetch !== NATIVE_FETCH) return globalThis.fetch(url, init);
|
|
26736
|
+
return requestWithoutHeadersLimit(url, init, init.signal);
|
|
26737
|
+
}
|
|
26738
|
+
async function requestWithoutHeadersLimit(url, init, signal) {
|
|
26739
|
+
if (init.body != null && typeof init.body !== "string") throw new TypeError("fetchOnOwnClock sends a string body only");
|
|
26740
|
+
const target = new URL(url);
|
|
26741
|
+
const client = target.protocol === "http:" ? import_node_http.default : import_node_https.default;
|
|
26742
|
+
const headers = Object.fromEntries(new Headers(init.headers).entries());
|
|
26743
|
+
return new Promise((resolve6, reject) => {
|
|
26744
|
+
const fail = (err) => reject(signal.aborted ? signal.reason : err);
|
|
26745
|
+
const req = client.request(target, { method: init.method ?? "GET", headers, signal }, (res) => {
|
|
26746
|
+
const chunks = [];
|
|
26747
|
+
res.on("data", (chunk) => chunks.push(chunk));
|
|
26748
|
+
res.on("error", fail);
|
|
26749
|
+
res.on("end", () => {
|
|
26750
|
+
const status = res.statusCode ?? 0;
|
|
26751
|
+
const responseHeaders = new Headers();
|
|
26752
|
+
for (const [name, value] of Object.entries(res.headers)) {
|
|
26753
|
+
for (const one of Array.isArray(value) ? value : value === void 0 ? [] : [value]) responseHeaders.append(name, one);
|
|
26754
|
+
}
|
|
26755
|
+
try {
|
|
26756
|
+
resolve6(new Response(NULL_BODY_STATUSES.has(status) ? null : Buffer.concat(chunks), { status, statusText: res.statusMessage ?? "", headers: responseHeaders }));
|
|
26757
|
+
} catch (err) {
|
|
26758
|
+
reject(err);
|
|
26759
|
+
}
|
|
26760
|
+
});
|
|
26761
|
+
});
|
|
26762
|
+
req.on("socket", (socket) => socket.setKeepAlive(true, KEEP_ALIVE_INITIAL_DELAY_MS));
|
|
26763
|
+
req.on("error", fail);
|
|
26764
|
+
req.end(typeof init.body === "string" ? init.body : void 0);
|
|
26765
|
+
});
|
|
26766
|
+
}
|
|
26767
|
+
|
|
26728
26768
|
// src/retryFetch.ts
|
|
26729
26769
|
var RETRYABLE_STATUS_CODES = /* @__PURE__ */ new Set([502, 503, 504]);
|
|
26730
26770
|
var RETRYABLE_NETWORK_ERROR_CODES = /* @__PURE__ */ new Set(["ECONNRESET", "ETIMEDOUT"]);
|
|
@@ -26735,7 +26775,7 @@ function isRetryableNetworkError(err) {
|
|
|
26735
26775
|
async function fetchWithRetry(url, init, { retries = 2, backoffMs = 250 } = {}) {
|
|
26736
26776
|
for (let attempt2 = 0; ; attempt2++) {
|
|
26737
26777
|
try {
|
|
26738
|
-
const res = await
|
|
26778
|
+
const res = await fetchOnOwnClock(url, init);
|
|
26739
26779
|
if (RETRYABLE_STATUS_CODES.has(res.status) && attempt2 < retries) {
|
|
26740
26780
|
await new Promise((r) => setTimeout(r, backoffMs));
|
|
26741
26781
|
continue;
|
|
@@ -39845,6 +39885,10 @@ var CODEGEN_LOOP_4_CONTRACT_VERSION = "codegen-loop-4";
|
|
|
39845
39885
|
var CODEGEN_LOOP_5_CONTRACT_VERSION = "codegen-loop-5";
|
|
39846
39886
|
var CODEGEN_LOOP_6_CONTRACT_VERSION = "codegen-loop-6";
|
|
39847
39887
|
var MAP_SOFT_REQUEST_TOKENS = 4e4;
|
|
39888
|
+
var MAP_SOFT_HEADROOM_TOKENS = 2e4;
|
|
39889
|
+
function mapSoftTarget(firstRequestTokens, ceiling) {
|
|
39890
|
+
return Math.min(ceiling, Math.max(MAP_SOFT_REQUEST_TOKENS, firstRequestTokens + MAP_SOFT_HEADROOM_TOKENS));
|
|
39891
|
+
}
|
|
39848
39892
|
var CodegenLoopFailure = class extends Error {
|
|
39849
39893
|
reason;
|
|
39850
39894
|
runtimeCode;
|
|
@@ -39913,6 +39957,7 @@ function isTestAnswer(x) {
|
|
|
39913
39957
|
return isPlainObject3(x) && typeof x.passed === "number" && Array.isArray(x.failingTests);
|
|
39914
39958
|
}
|
|
39915
39959
|
var DROPPED_OUTPUT = { dropped: true, note: "Dropped to keep the request small. Read the file again if you need it." };
|
|
39960
|
+
var DROPPED_UNSEEN_OUTPUT = { dropped: true, note: "Too large to send with the rest of this request. Read a smaller part of the file." };
|
|
39916
39961
|
function repoMapGuidancePaths(baseContext) {
|
|
39917
39962
|
const map = baseContext.repoMap;
|
|
39918
39963
|
return (Array.isArray(map?.guidance) ? map.guidance : []).map((g) => g.path).filter((p) => typeof p === "string");
|
|
@@ -39969,6 +40014,7 @@ async function runCodegenLoop(args, deps) {
|
|
|
39969
40014
|
const notesOn = harness && args.tools2?.notes === true;
|
|
39970
40015
|
const contractVersion = harness ? args.tools2 ? notesOn ? CODEGEN_LOOP_6_CONTRACT_VERSION : CODEGEN_LOOP_5_CONTRACT_VERSION : args.readRoots ? CODEGEN_LOOP_4_CONTRACT_VERSION : CODEGEN_LOOP_3_CONTRACT_VERSION : tests ? CODEGEN_LOOP_2_CONTRACT_VERSION : CODEGEN_LOOP_CONTRACT_VERSION;
|
|
39971
40016
|
let peakRequestTokens = 0;
|
|
40017
|
+
let firstRequestTokens = 0;
|
|
39972
40018
|
const usage = new TurnUsage();
|
|
39973
40019
|
let notes = "";
|
|
39974
40020
|
let stubbed = 0;
|
|
@@ -40081,19 +40127,26 @@ async function runCodegenLoop(args, deps) {
|
|
|
40081
40127
|
...usage.totals.calls > 0 ? { turnUsage: usage.rows.map((r) => ({ ...r, parts: { ...r.parts } })), usage: { ...usage.totals } } : {},
|
|
40082
40128
|
...usage.rowsCut ? { turnUsageCut: true } : {}
|
|
40083
40129
|
});
|
|
40084
|
-
const
|
|
40085
|
-
const under = (limit) => estimateRequestTokens(buildContext(nextTurn, nextFinal, finalReason)) <= limit;
|
|
40086
|
-
const fits = () => under(limits.maxRequestTokens);
|
|
40087
|
-
const soft = args.readRoots ? Math.min(MAP_SOFT_REQUEST_TOKENS, limits.maxRequestTokens) : limits.maxRequestTokens;
|
|
40088
|
-
if (under(soft)) return true;
|
|
40130
|
+
const dropOutputs = (upTo, done, output) => {
|
|
40089
40131
|
const lastTestRun = toolResults.map((r) => r.name).lastIndexOf(RUN_TESTS_TOOL);
|
|
40090
40132
|
const lastCall = toolResults.map((r) => r.name).lastIndexOf(CALL_FUNCTION_TOOL);
|
|
40091
|
-
|
|
40133
|
+
let dropped = 0;
|
|
40134
|
+
for (let i2 = 0; i2 < upTo && !done(); i2++) {
|
|
40092
40135
|
const r = toolResults[i2];
|
|
40093
|
-
if (
|
|
40094
|
-
|
|
40095
|
-
if (
|
|
40136
|
+
if (r.output === DROPPED_OUTPUT || r.output === DROPPED_UNSEEN_OUTPUT) continue;
|
|
40137
|
+
const stale = READ_TOOLS.has(r.name) && r.status === "ok" || r.name === RUN_TESTS_TOOL && i2 !== lastTestRun && r.output !== void 0 || r.name === CALL_FUNCTION_TOOL && i2 !== lastCall && r.output !== void 0;
|
|
40138
|
+
if (!stale) continue;
|
|
40139
|
+
toolResults[i2] = { ...r, output };
|
|
40140
|
+
dropped++;
|
|
40096
40141
|
}
|
|
40142
|
+
return dropped;
|
|
40143
|
+
};
|
|
40144
|
+
const makeRoom = (nextTurn, nextFinal, finalReason) => {
|
|
40145
|
+
const under = (limit) => estimateRequestTokens(buildContext(nextTurn, nextFinal, finalReason)) <= limit;
|
|
40146
|
+
const fits = () => under(limits.maxRequestTokens);
|
|
40147
|
+
const soft = args.readRoots ? mapSoftTarget(firstRequestTokens, limits.maxRequestTokens) : limits.maxRequestTokens;
|
|
40148
|
+
if (under(soft)) return true;
|
|
40149
|
+
dropOutputs(sent.results, () => under(soft), DROPPED_OUTPUT);
|
|
40097
40150
|
for (const key of [...ledger.seen.keys()]) {
|
|
40098
40151
|
if (key.startsWith("read_file:") || key.startsWith("grep:") || key.startsWith("list_files:") || key.startsWith("show_changes:")) ledger.seen.delete(key);
|
|
40099
40152
|
}
|
|
@@ -40105,6 +40158,9 @@ async function runCodegenLoop(args, deps) {
|
|
|
40105
40158
|
return { ...c, args: { ...path, _omitted: "written earlier; read the file to see it" } };
|
|
40106
40159
|
});
|
|
40107
40160
|
}
|
|
40161
|
+
if (fits()) return true;
|
|
40162
|
+
const unseen = dropOutputs(toolResults.length, fits, DROPPED_UNSEEN_OUTPUT);
|
|
40163
|
+
if (unseen > 0) log({ event: "codegen.read_dropped_unseen", turn: nextTurn - 1, outputs: unseen, ceiling: limits.maxRequestTokens });
|
|
40108
40164
|
return fits();
|
|
40109
40165
|
};
|
|
40110
40166
|
const settleNextTurn = (turn, forcedNow) => {
|
|
@@ -40165,6 +40221,7 @@ async function runCodegenLoop(args, deps) {
|
|
|
40165
40221
|
const contextData = buildContext(turn, isFinal, finalReason);
|
|
40166
40222
|
const requestTokens = estimateRequestTokens(contextData);
|
|
40167
40223
|
peakRequestTokens = Math.max(peakRequestTokens, requestTokens);
|
|
40224
|
+
if (firstRequestTokens === 0) firstRequestTokens = requestTokens;
|
|
40168
40225
|
if (requestTokens > limits.maxRequestTokens) {
|
|
40169
40226
|
log({ event: "codegen.loop_ceiling", turn, action: "not_sent", projectedTokens: requestTokens, ceiling: limits.maxRequestTokens });
|
|
40170
40227
|
throw new CodegenLoopFailure("token_ceiling");
|
|
@@ -43179,7 +43236,7 @@ var FAILURE_ARTIFACT_DIR = "quikpilot-failure";
|
|
|
43179
43236
|
var REPORT_COPY = "final-test-report.xml";
|
|
43180
43237
|
var MAX_REPORT_BYTES = 5 * 1024 * 1024;
|
|
43181
43238
|
var MAX_FILES = 200;
|
|
43182
|
-
var RUNNER_VERSION = true ? "9.3.0-rc.
|
|
43239
|
+
var RUNNER_VERSION = true ? "9.3.0-rc.38" : "dev";
|
|
43183
43240
|
function safeDestination(base, repoPath) {
|
|
43184
43241
|
if (!repoPath || (0, import_node_path21.isAbsolute)(repoPath)) return null;
|
|
43185
43242
|
const destination = (0, import_node_path21.resolve)(base, repoPath);
|