Skip to content
Open
4 changes: 2 additions & 2 deletions kernel/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 25 additions & 0 deletions scripts/gate/plugin-lanes.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,21 @@ async function runLane(agent, recipe) {

try {
await recipe.setup(ctx);
// One-time host warmup BEFORE timed turns: opencode v1 runs a one-time
// sqlite storage migration on fresh XDG ("Performing one time database
// migration, may take a few minutes...") — in hermetic containers that
// eats the whole t1 turn budget and wipes the lane (r5: every turn red,
// 0 upstream requests). A disposable long-timeout turn absorbs it;
// output discarded, failure logged but non-fatal.
if (recipe.warmup) {
const t0 = Date.now();
try {
await recipe.warmup(ctx);
console.log(`-- lane ${agent}: warmup ok in ${Math.round((Date.now() - t0) / 1000)}s`);
} catch (e) {
console.log(`-- lane ${agent}: warmup failed (non-fatal): ${String(e).slice(0, 140)}`);
}
}
const sid = { v: null };
// Dual marker: the t2/t4 S07-recall assertions presume t1 actually READ
// the corpus middle — models sometimes elide it despite the chunk-read
Expand Down Expand Up @@ -898,6 +913,16 @@ const RECIPES = {
ocFor(BIG_WINDOW);
ctx.env = { ...ctx.baseEnv, BILLION_CONTEXT_NODE: process.execPath };
},
// see runLane: absorbs the v1 CLI's one-time storage migration
async warmup(ctx) {
const model = MODEL1.model.split(",")[0];
const r = sh((process.env.GATE_OC1_BIN || "opencode").trim(),
["run", "-m", `gate/${model}`, "--dangerously-skip-permissions", "Reply with the single word READY."],
{ cwd: ctx.workDir, env: ctx.env, timeout: 600_000 });
// sh() swallows exit codes — throw so runLane logs "warmup failed"
// instead of a misleading "warmup ok" when the turn actually died.
if (r.status !== 0) throw new Error(`opencode warmup exited ${r.status ?? "timeout"}\n${(r.stderr || "").slice(-300)}`);
},
setWindow(ctx, w) {
const file = path.join(ctx.laneDir, "xdg/config/opencode/opencode.json");
const cfg = JSON.parse(fs.readFileSync(file, "utf8"));
Expand Down
Loading