From a64266ea4e39c967aa7944b6fba64b51f8d9ec83 Mon Sep 17 00:00:00 2001 From: ework-agent Date: Sun, 15 Nov 2026 10:55:39 +0800 Subject: [PATCH 1/5] fix(ci): resolve REPO_ROOT via import.meta.dirname in e2e-selfupdate-cli On Windows, new URL(import.meta.url).pathname yields /D:/a/... (leading slash before the drive), so path.resolve prepends the current drive and the module-level readFileSync opens D:\D:\a\...\package.json and crashes the whole test file at import time. import.meta.dirname is the cross-platform form already used by every sibling e2e test. --- tests/e2e/e2e-selfupdate-cli.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/e2e/e2e-selfupdate-cli.test.ts b/tests/e2e/e2e-selfupdate-cli.test.ts index ed666e81cf..59c3402316 100644 --- a/tests/e2e/e2e-selfupdate-cli.test.ts +++ b/tests/e2e/e2e-selfupdate-cli.test.ts @@ -27,7 +27,7 @@ import { test } from "node:test"; import { startRegistry } from "./registry-fixture.js"; import { biliSpawnEnv, isolatedEnv, npmHomeEnv, npmRunSync, windowsSystemEnv } from "./crossplat.ts"; -const REPO_ROOT = path.resolve(path.dirname(new URL(import.meta.url).pathname), "..", ".."); +const REPO_ROOT = path.resolve(import.meta.dirname, "..", ".."); const PKG = JSON.parse(fs.readFileSync(path.join(REPO_ROOT, "package.json"), "utf8")) as { name: string; files: string[]; From 297709ef5be6331274af47119c236ee5ec5ced5d Mon Sep 17 00:00:00 2001 From: ework-agent Date: Mon, 16 Nov 2026 05:49:30 +0800 Subject: [PATCH 2/5] test: fix three flaky/slow test bugs reported on #4599 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - storage-durability: drop the #4609 verdict cache (index.db.chk) after corrupting the db — the flip keeps size + mtime (4 ms granularity), so a cached 'ok' skipped quick_check and the corrupt open succeeded, failing the assert.throws / shadow-alarm expectations. - wire-exit-matrix: abortAfterFirstByte now waits for a ready predicate (up.requests() >= 1) before destroying the client socket — the 400 ms fallback used to fire before the proxy forwarded on slow runners, leaving requests=0 / closed=0. Applied to all four abort cells. - issue4612-gc-online-guard: wrap the 21,000 fixture inserts in one BEGIN/COMMIT — autocommit paid one fsync per row (WAL + synchronous=FULL), ~17 min on slow-fsync disks, past the runner timeout. --- tests/issue4612-gc-online-guard.test.ts | 6 ++++ tests/storage-durability.test.ts | 8 +++++ tests/wire-exit-matrix.test.ts | 46 ++++++++++++++++--------- 3 files changed, 44 insertions(+), 16 deletions(-) diff --git a/tests/issue4612-gc-online-guard.test.ts b/tests/issue4612-gc-online-guard.test.ts index e2182f8abe..7c3b72a0a3 100644 --- a/tests/issue4612-gc-online-guard.test.ts +++ b/tests/issue4612-gc-online-guard.test.ts @@ -164,11 +164,17 @@ test("#4612: zero-ref sweep deletes every garbage row in batches with progress l // line lands every 10th batch plus always on the final batch const raw = new DatabaseSync(dbPath); try { + // One transaction: 21,000 autocommit inserts would pay one fsync + // per row (WAL + synchronous=FULL) — ~17 min on slow-fsync disks, + // past the runner timeout (#4599). BEGIN/COMMIT collapses it to a + // single fsync without changing the resulting row set. + raw.exec("BEGIN"); const ins = raw.prepare("INSERT INTO content (hash, byte_len, refcount, algo, bytes) VALUES (?, ?, 0, 'sha256', ?)"); for (let i = 0; i < N; i++) { const body = Buffer.from(`zero-ref body ${i}`); ins.run(`4612-zero-ref-${i}`, body.length, body); } + raw.exec("COMMIT"); } finally { raw.close(); } diff --git a/tests/storage-durability.test.ts b/tests/storage-durability.test.ts index 9851727f3f..cb672b6328 100644 --- a/tests/storage-durability.test.ts +++ b/tests/storage-durability.test.ts @@ -60,6 +60,10 @@ test("quick_check: a corrupt db fails open with a typed error, files left UNTOUC raw[i] = raw[i] ^ 0xff; } writeFileSync(path, raw); + // The flip keeps size + mtime (4 ms granularity), so the #4609 verdict + // cache (index.db.chk) would still match and skip quick_check — drop it + // so the reopen re-scans from fresh evidence (#4599). + rmSync(`${path}.chk`, { force: true }); // 3. Reopen — must fail with a typed, greppable integrity error // (migrations must never run against a corrupt file). @@ -146,6 +150,10 @@ test("shadow open ALARMS on a corrupt index.db set — nothing renamed, boot pro raw[i] = raw[i] ^ 0xff; } writeFileSync(path, raw); + // Drop the #4609 verdict cache: the flip keeps size + mtime, so a + // cached "ok" would skip quick_check and the shadow would open the + // corrupt set instead of alarming (#4599). + rmSync(`${path}.chk`, { force: true }); const beforeHash = createHash("sha256").update(raw).digest("hex"); // The shadow's maybeOpen (full mode) must ALARM, not refuse — come diff --git a/tests/wire-exit-matrix.test.ts b/tests/wire-exit-matrix.test.ts index 71d66dc2d4..1a11ab0f00 100644 --- a/tests/wire-exit-matrix.test.ts +++ b/tests/wire-exit-matrix.test.ts @@ -217,25 +217,39 @@ mitm: { enabled: false, domains: [] }, } /** Opens a request, waits for the first body byte (or headers for JSON), - * then destroys the client socket — simulating a user hitting Ctrl-C. */ -function abortAfterFirstByte(url: string, headers: Record, body: string): Promise<"header" | "first-byte"> { + * then destroys the client socket — simulating a user hitting Ctrl-C. + * `ready` (when given) must hold before the socket is destroyed: the abort + * only has an upstream socket to tear down once the proxy has actually + * forwarded, and the 400 ms fallback used to fire first on slow runners, + * leaving requests=0 / closed=0 (#4599). The wait is capped so a genuine + * forward hang still fails the teardown assertion. */ +function abortAfterFirstByte(url: string, headers: Record, body: string, ready?: () => boolean): Promise<"header" | "first-byte"> { return new Promise((resolve, reject) => { + let done = false; const req = http.request(url, { method: "POST", headers }, (res) => { - res.once("data", () => { - req.destroy(); - resolve("first-byte"); - }); + res.once("data", () => finish("first-byte")); // hang-json never sends a body — abort on headers after a beat. - res.once("end", () => resolve("header")); + res.once("end", () => finish("header")); }); req.on("error", (e: NodeJS.ErrnoException) => { - if (e.code === "ECONNRESET") resolve("first-byte"); + if (e.code === "ECONNRESET") finish("first-byte"); else reject(e); }); - setTimeout(() => { - req.destroy(); - resolve("header"); - }, 400).unref(); + setTimeout(() => finish("header"), 400).unref(); + function finish(outcome: "header" | "first-byte"): void { + if (done) return; + done = true; + const t0 = Date.now(); + const destroy = (): void => { + req.destroy(); + resolve(outcome); + }; + const waitReady = (): void => { + if (!ready || ready() || Date.now() - t0 > 5000) destroy(); + else setTimeout(waitReady, 25).unref(); + }; + waitReady(); + } req.end(body); }); } @@ -267,7 +281,7 @@ test("abort x proxy-openai-sse: client abort mid-stream destroys the upstream re const proxyPort = (proxy.address() as { port: number }).port; try { const url = `http://127.0.0.1:${proxyPort}/bili/http://127.0.0.1:${up.port}/v1/chat/completions`; - const outcome = await abortAfterFirstByte(url, { "content-type": "application/json", "x-acp-session": "mx-abort-oai" }, JSON.stringify({ model: "m-test", max_tokens: 1024, stream: true, messages: [{ role: "user", content: "hi" }] })); + const outcome = await abortAfterFirstByte(url, { "content-type": "application/json", "x-acp-session": "mx-abort-oai" }, JSON.stringify({ model: "m-test", max_tokens: 1024, stream: true, messages: [{ role: "user", content: "hi" }] }), () => up.requests() >= 1); assert.ok(outcome === "first-byte" || outcome === "header"); await awaitUpstreamTeardown(up.socketsClosed); assert.ok(up.socketsClosed() >= 1, `upstream socket(s) must be destroyed after the client abort (closed=${up.socketsClosed()})`); @@ -289,7 +303,7 @@ test("abort x proxy-anthropic-sse: client abort mid-stream destroys the upstream const proxyPort = (proxy.address() as { port: number }).port; try { const url = `http://127.0.0.1:${proxyPort}/bili/http://127.0.0.1:${up.port}/v1/messages`; - await abortAfterFirstByte(url, { "content-type": "application/json", "x-acp-session": "mx-abort-ant" }, JSON.stringify({ model: "m-test", max_tokens: 1024, stream: true, messages: [{ role: "user", content: "hi" }] })); + await abortAfterFirstByte(url, { "content-type": "application/json", "x-acp-session": "mx-abort-ant" }, JSON.stringify({ model: "m-test", max_tokens: 1024, stream: true, messages: [{ role: "user", content: "hi" }] }), () => up.requests() >= 1); await awaitUpstreamTeardown(up.socketsClosed); assert.ok(up.socketsClosed() >= 1, `upstream socket(s) destroyed after client abort (closed=${up.socketsClosed()})`); } finally { @@ -309,7 +323,7 @@ test("abort x proxy-responses-sse: client abort mid-stream destroys the upstream const proxyPort = (proxy.address() as { port: number }).port; try { const url = `http://127.0.0.1:${proxyPort}/bili/http://127.0.0.1:${up.port}/v1/responses`; - await abortAfterFirstByte(url, { "content-type": "application/json", "x-acp-session": "mx-abort-resp" }, JSON.stringify({ model: "m-test", max_tokens: 1024, stream: true, instructions: "You are a test agent.", input: [{ type: "message", role: "user", content: "hi" }] })); + await abortAfterFirstByte(url, { "content-type": "application/json", "x-acp-session": "mx-abort-resp" }, JSON.stringify({ model: "m-test", max_tokens: 1024, stream: true, instructions: "You are a test agent.", input: [{ type: "message", role: "user", content: "hi" }] }), () => up.requests() >= 1); await awaitUpstreamTeardown(up.socketsClosed); assert.ok(up.socketsClosed() >= 1, `upstream socket(s) destroyed after client abort (closed=${up.socketsClosed()})`); } finally { @@ -329,7 +343,7 @@ test("abort x proxy-json: client abort while the JSON is buffering destroys the const proxyPort = (proxy.address() as { port: number }).port; try { const url = `http://127.0.0.1:${proxyPort}/bili/http://127.0.0.1:${up.port}/v1/chat/completions`; - await abortAfterFirstByte(url, { "content-type": "application/json", "x-acp-session": "mx-abort-json" }, JSON.stringify({ model: "m-test", max_tokens: 1024, messages: [{ role: "user", content: "hi" }] })); + await abortAfterFirstByte(url, { "content-type": "application/json", "x-acp-session": "mx-abort-json" }, JSON.stringify({ model: "m-test", max_tokens: 1024, messages: [{ role: "user", content: "hi" }] }), () => up.requests() >= 1); await awaitUpstreamTeardown(up.socketsClosed); assert.ok(up.socketsClosed() >= 1, `upstream socket(s) destroyed after client abort (closed=${up.socketsClosed()})`); } finally { From 772af00a4f9e4e8d42a8b0a6448b6956702658ba Mon Sep 17 00:00:00 2001 From: ework-agent Date: Mon, 16 Nov 2026 15:59:58 +0800 Subject: [PATCH 3/5] feat(gate): laneScript + snapshotRender config knobs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The snapBase storage substrate reaches the R lanes via the bundled restart-lanes.mjs, but the P lanes prefer the candidate checkout OWN plugin-lanes.mjs — which predates the GATE_SNAPBASE knob, so P ran off-state in candidate-branch verification. laneScript forces the bundled copy (the entrypoint already supports GATE_LANE_SCRIPT for exactly this). snapshotRender flips BILI_ROLLOUT_SNAPSHOT_RENDER (env tier > 0% rollout) so the egress BODY plane renders live — without it storage.snapBase only exercises the v2 substrate, not the body path the verification is actually after. Both keys documented in config.example.json. --- scripts/gate/bili-gate.sh | 10 ++++++++++ scripts/gate/config.example.json | 4 ++++ 2 files changed, 14 insertions(+) diff --git a/scripts/gate/bili-gate.sh b/scripts/gate/bili-gate.sh index de6ee6fefd..ff2a766aab 100755 --- a/scripts/gate/bili-gate.sh +++ b/scripts/gate/bili-gate.sh @@ -75,6 +75,8 @@ TURN_MS=$(jget turnTimeoutMs "300000") AGENTS=$(jget agents "dsh,pi,codex,opencode,claude,dsh-google") AGENTS_R=$(jget agentsR "dsh,pi") SNAPBASE=$(jget snapBase "") +LANE_SCRIPT=$(jget laneScript "") +SNAP_RENDER=$(jget snapshotRender "") R_CORPUS=$(jget r.corpusTokens "80000") R_WINDOW=$(jget r.window "16384") R_CAP=$(jget r.capRatio "0.4") @@ -115,6 +117,14 @@ if [ -n "$GIT_PROXY" ]; then RUN+=(-e GATE_GIT_PROXY="$GIT_PROXY"); fi # Must be appended AFTER the RUN=(...) init above — an earlier append is wiped # by the reassignment. if [ -n "$SNAPBASE" ]; then RUN+=(-e GATE_SNAPBASE="$SNAPBASE"); fi +# GATE_LANE_SCRIPT: force the P-lane harness script copy (e.g. the bundled +# /gate-tools/plugin-lanes.mjs when the candidate predates a harness fix — +# the entrypoint prefers the candidate's OWN scripts/gate copy when present). +if [ -n "$LANE_SCRIPT" ]; then RUN+=(-e GATE_LANE_SCRIPT="$LANE_SCRIPT"); fi +# BILI_ROLLOUT_SNAPSHOT_RENDER: force the candidate's snapshotRender egress +# body plane live container-wide (env tier beats the 0% rollout default). +# Plugin-mode lanes stay client-authoritative by design. +if [ -n "$SNAP_RENDER" ]; then RUN+=(-e BILI_ROLLOUT_SNAPSHOT_RENDER="$SNAP_RENDER"); fi if [ "$NETWORK" = "bridge" ]; then RUN+=(--add-host=host.docker.internal:host-gateway) else diff --git a/scripts/gate/config.example.json b/scripts/gate/config.example.json index 0a4caccecb..c658fdb3ce 100644 --- a/scripts/gate/config.example.json +++ b/scripts/gate/config.example.json @@ -26,6 +26,10 @@ "agentsR": "", "_doc_snapBase": "P/R lanes only: run the candidate's snapBase egress plane (storage.snapBase) ON in the gate's bili.json. \"all\" = every protocol cohort; \"openai,responses,anthropic,google\" subset = explicit cohorts; absent or \"off\" = off (byte-identical gate). For candidate-branch verification (e.g. #6785).", "snapBase": "", + "_doc_laneScript": "Optional: force the P-lane harness script copy, e.g. \"/gate-tools/plugin-lanes.mjs\". Needed when the candidate checkout predates a harness fix (the gate otherwise prefers the candidate's OWN scripts/gate/plugin-lanes.mjs).", + "laneScript": "", + "_doc_snapshotRender": "Optional: value for BILI_ROLLOUT_SNAPSHOT_RENDER (\"1\" forces the candidate's snapshotRender egress body plane live in every lane; the env tier beats the 0% rollout default). Plugin-mode lanes (dsh profile bundle, pi native) stay client-authoritative by design.", + "snapshotRender": "", "r": { "corpusTokens": 80000, "window": 16384, From 850f0adf0833f53d06927f0f4c71a24a258d07b3 Mon Sep 17 00:00:00 2001 From: ework-agent Date: Mon, 16 Nov 2026 17:01:59 +0800 Subject: [PATCH 4/5] =?UTF-8?q?fix(gate):=20snapshotRender=20knob=20via=20?= =?UTF-8?q?config=20tier=20=E2=80=94=20env=20tier=20never=20reaches=20lane?= =?UTF-8?q?=20proxies?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit cleanEnv() strips BILI_* from the lane spawn env by design, so BILI_ROLLOUT_SNAPSHOT_RENDER set container-wide still resolved to off(bucket) in every lane (verified in the #6785 gate run: rollout line showed snapshotRender=off(bucket, 7206/10000 vs 0bp) with the env set). The knob now writes rollout.features.snapshotRender=true into the P/R lane bili.json — the config tier the rollout resolver honors above bucketing. GATE_SNAPSHOT_RENDER stays harness-internal; the proxy never sees it. --- scripts/gate/bili-gate.sh | 8 ++++---- scripts/gate/config.example.json | 2 +- scripts/gate/plugin-lanes.mjs | 14 ++++++++++++++ scripts/gate/restart-lanes.mjs | 4 ++-- 4 files changed, 21 insertions(+), 7 deletions(-) diff --git a/scripts/gate/bili-gate.sh b/scripts/gate/bili-gate.sh index ff2a766aab..35abe5614f 100755 --- a/scripts/gate/bili-gate.sh +++ b/scripts/gate/bili-gate.sh @@ -121,10 +121,10 @@ if [ -n "$SNAPBASE" ]; then RUN+=(-e GATE_SNAPBASE="$SNAPBASE"); fi # /gate-tools/plugin-lanes.mjs when the candidate predates a harness fix — # the entrypoint prefers the candidate's OWN scripts/gate copy when present). if [ -n "$LANE_SCRIPT" ]; then RUN+=(-e GATE_LANE_SCRIPT="$LANE_SCRIPT"); fi -# BILI_ROLLOUT_SNAPSHOT_RENDER: force the candidate's snapshotRender egress -# body plane live container-wide (env tier beats the 0% rollout default). -# Plugin-mode lanes stay client-authoritative by design. -if [ -n "$SNAP_RENDER" ]; then RUN+=(-e BILI_ROLLOUT_SNAPSHOT_RENDER="$SNAP_RENDER"); fi +# GATE_SNAPSHOT_RENDER: force the candidate's snapshotRender egress body +# plane live in the P/R lane bili.json (config tier — the env tier never +# reaches the lane proxies because cleanEnv() strips BILI_* by design). +if [ -n "$SNAP_RENDER" ]; then RUN+=(-e GATE_SNAPSHOT_RENDER="$SNAP_RENDER"); fi if [ "$NETWORK" = "bridge" ]; then RUN+=(--add-host=host.docker.internal:host-gateway) else diff --git a/scripts/gate/config.example.json b/scripts/gate/config.example.json index c658fdb3ce..528e3618a4 100644 --- a/scripts/gate/config.example.json +++ b/scripts/gate/config.example.json @@ -28,7 +28,7 @@ "snapBase": "", "_doc_laneScript": "Optional: force the P-lane harness script copy, e.g. \"/gate-tools/plugin-lanes.mjs\". Needed when the candidate checkout predates a harness fix (the gate otherwise prefers the candidate's OWN scripts/gate/plugin-lanes.mjs).", "laneScript": "", - "_doc_snapshotRender": "Optional: value for BILI_ROLLOUT_SNAPSHOT_RENDER (\"1\" forces the candidate's snapshotRender egress body plane live in every lane; the env tier beats the 0% rollout default). Plugin-mode lanes (dsh profile bundle, pi native) stay client-authoritative by design.", + "_doc_snapshotRender": "Optional: \"1\" writes rollout.features.snapshotRender=true into the P/R lane bili.json (config tier, beats the 0% rollout default) so the candidate's snapshotRender egress body plane renders live. Plugin-mode lanes (dsh profile bundle, pi native) stay client-authoritative by design.", "snapshotRender": "", "r": { "corpusTokens": 80000, diff --git a/scripts/gate/plugin-lanes.mjs b/scripts/gate/plugin-lanes.mjs index 2a935cee0e..1088439f90 100644 --- a/scripts/gate/plugin-lanes.mjs +++ b/scripts/gate/plugin-lanes.mjs @@ -83,6 +83,19 @@ export function gateStorageCfg() { const cohorts = v.toLowerCase() === "all" ? [] : v.split(",").map((x) => x.trim()).filter(Boolean); return { storage: cohorts.length ? { snapBase: { enabled: true, cohorts } } : { snapBase: { enabled: true } } }; } + +// GATE_SNAPSHOT_RENDER (#6785 verification): flip the candidate's snapshotRender +// egress body plane LIVE through the CONFIG tier — +// rollout.features.snapshotRender=true (a forced-on shorthand the rollout +// resolver honors above bucketing). The env tier +// (BILI_ROLLOUT_SNAPSHOT_RENDER) does NOT reach the lane proxies: cleanEnv() +// strips BILI_* from the spawn env by design (2026-11-16 gate run 3 showed +// snapshotRender=off(bucket) with the env set). +export function gateRolloutCfg() { + const v = String(process.env.GATE_SNAPSHOT_RENDER || ""); + if (!v || v === "0" || v.toLowerCase() === "off") return {}; + return { rollout: { features: { snapshotRender: true } } }; +} const MODEL_MAIN = MODEL_IDS[0]; const AGENTS = (process.env.GATE_AGENTS || "dsh,pi,codex,opencode,claude") .split(",").map((s) => s.trim().toLowerCase()).filter(Boolean); @@ -289,6 +302,7 @@ async function runLane(agent, recipe) { }, compress: { preserveRecentTokens: 0 }, ...gateStorageCfg(), + ...gateRolloutCfg(), }, null, 2)); writeWindow(BIG_WINDOW); diff --git a/scripts/gate/restart-lanes.mjs b/scripts/gate/restart-lanes.mjs index c1b601cc24..6564f08dbc 100644 --- a/scripts/gate/restart-lanes.mjs +++ b/scripts/gate/restart-lanes.mjs @@ -71,7 +71,7 @@ import { spawn, spawnSync } from "node:child_process"; import fs from "node:fs"; import net from "node:net"; import path from "node:path"; -import { buildCorpus, CODEWORDS, gateStorageCfg } from "./plugin-lanes.mjs"; +import { buildCorpus, CODEWORDS, gateStorageCfg, gateRolloutCfg } from "./plugin-lanes.mjs"; const HERE = path.dirname(new URL(import.meta.url).pathname); const WORK = process.env.RESTART_LANES_WORK || path.join(process.env.WORKDIR || process.cwd(), "restart-lanes"); @@ -86,7 +86,7 @@ const MODEL1 = { }; const MODEL_IDS = String(MODEL1.model).split(",").map((s) => s.trim()).filter(Boolean); -const laneCfg = (providers) => ({ providers, compress: { preserveRecentTokens: 0 }, ...gateStorageCfg() }); +const laneCfg = (providers) => ({ providers, compress: { preserveRecentTokens: 0 }, ...gateStorageCfg(), ...gateRolloutCfg() }); const MODEL_MAIN = MODEL_IDS[0]; const AGENTS = (process.env.GATE_AGENTS_R || process.env.GATE_AGENTS || "dsh,pi") .split(",").map((s) => s.trim().toLowerCase()).filter(Boolean); From aa9249411516b569c536640b8477bbb3947c035f Mon Sep 17 00:00:00 2001 From: ework-agent Date: Mon, 16 Nov 2026 18:23:15 +0800 Subject: [PATCH 5/5] fix(gate): t1 prompt quoted the corpus line count dynamically buildCorpus() produces a 441-line file, but the t1 recipe said "~1300 lines". Most models ignored the mismatch; opencode/codex occasionally flagged it ("the file is only 441 lines, but the task says ~1300") and wasted the turn, red-ing S40/S07 t1 (2026-11-16 gate run 4). Quote the actual count instead. --- scripts/gate/plugin-lanes.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/gate/plugin-lanes.mjs b/scripts/gate/plugin-lanes.mjs index 1088439f90..b62208410a 100644 --- a/scripts/gate/plugin-lanes.mjs +++ b/scripts/gate/plugin-lanes.mjs @@ -387,7 +387,7 @@ async function runLane(agent, recipe) { // the corpus middle — models sometimes elide it despite the chunk-read // instruction (observed in proxy mode). Verify the precondition at t1 // instead of letting downstream recalls fail for fixture reasons. - const t1 = await recipe.turn(ctx, `Read corpus.md in your cwd fully (~1300 lines). Your read tool may truncate or ELIDE the middle of a long file (e.g. claude-code's Read shows head+tail with "... N lines elided ...") — read in sequential chunks (offset 1, 201, 401, …, ~200 lines each, or equivalent line-range calls) until you have seen EVERY line including the middle; do not stop at a truncation or elision. Then reply with ONLY the TITLE lines of sections S40 and S07 (one per line). Do not run any other tool or command.`, sid, "t1"); + const t1 = await recipe.turn(ctx, `Read corpus.md in your cwd fully (it is ${fs.readFileSync(path.join(laneDir, "work", "corpus.md"), "utf8").split("\n").length} lines — do not stop early because the file looks shorter than you expected). Your read tool may truncate or ELIDE the middle of a long file (e.g. claude-code's Read shows head+tail with "... N lines elided ...") — read in sequential chunks (offset 1, 201, 401, …, ~200 lines each, or equivalent line-range calls) until you have seen EVERY line including the middle; do not stop at a truncation or elision. Then reply with ONLY the TITLE lines of sections S40 and S07 (one per line). Do not run any other tool or command.`, sid, "t1"); fs.writeFileSync(path.join(ctx.laneDir, `turn-t1.txt`), t1.out || ""); record(agent, "t1 read @ big window completes", t1.ok, t1.why.slice(0, 160)); record(agent, "S40 marker answered (t1)", MARK_RE(39).test(t1.out), `"${t1.out.trim().slice(0, 80)}"`);