{"version":210,"agent":"onboard","message":"Pipelines: a run job may set timeout, the seconds each of its steps may take (1 to 900, 300 when unset). JOB_TIMEOUT_DEFAULT and JOB_TIMEOUT_MAX are exported, and the job carries timeout when it is set. A timeout on a uses job, or one that isn't whole seconds in range, is refused with the reason. Tests: src/pipeline/test/pipeline.test.ts (25).","time":1792036014854,"timeIso":"2026-10-15T03:46:54.854Z","changes":2,"change":3508,"files":["src/pipeline/pipeline.ts","src/pipeline/test/pipeline.test.ts"],"draft":null,"diff":[{"path":"src/pipeline/pipeline.ts","added":35,"removed":2,"diff":"--- a/src/pipeline/pipeline.ts\n+++ b/src/pipeline/pipeline.ts\n@@ -9,7 +9,8 @@\n // jobs make a version green (`required`). A job runs a command (`run`) or a\n // built-in step (`uses`), after the jobs it `needs`, and may take another\n // job's kept files (`from`) and named `secrets`, and a run job may ask for an\n-// abso key on its own project (`abso: reader` or `writer`) for the length of the job.\n+// abso key on its own project (`abso: reader` or `writer`) for the length of the job. A run job may\n+// say how long each of its steps may take (`timeout`, in seconds: 300 unless it says, 900 at most).\n //\n // What the check refuses: a cycle in needs; needs, required or from naming a\n // job that doesn't exist; secrets in a pipeline a draft can start, since a\n@@ -42,6 +43,8 @@\n \treadonly secrets: readonly string[];\n \t/** An abso key on the project for the job's length (abso 343): none unless asked. */\n \treadonly abso?: \"reader\" | \"writer\";\n+\t/** Seconds each step of a run job may take, when it says (JOB_TIMEOUT_DEFAULT otherwise). */\n+\treadonly timeout?: number;\n \t/** The built-in step's own settings (deploy's worker, staging, live; notify's to), as written. */\n \treadonly with: Readonly<Record<string, unknown>>;\n }\n@@ -98,7 +101,21 @@\n }\n const SIZES: readonly Size[] = [\"small\", \"standard\", \"large\"];\n const MACHINE_KEYS = [\"image\", \"dockerfile\", \"size\"] as const;\n-const JOB_KEYS = [\"needs\", \"run\", \"uses\", \"from\", \"keep\", \"cache\", \"secrets\", \"abso\", ...MACHINE_KEYS] as const;\n+const JOB_KEYS = [\n+\t\"needs\",\n+\t\"run\",\n+\t\"uses\",\n+\t\"from\",\n+\t\"keep\",\n+\t\"cache\",\n+\t\"secrets\",\n+\t\"abso\",\n+\t\"timeout\",\n+\t...MACHINE_KEYS,\n+] as const;\n+/** A run job's step limit when it names none, and the most it may name (the customer runner's cap too). */\n+export const JOB_TIMEOUT_DEFAULT = 300;\n+export const JOB_TIMEOUT_MAX = 900;\n const PIPELINE_KEYS = [\"on\", \"only\", \"jobs\", \"required\"] as const;\n /** avcs.json's keys for today's CI (worker/src/ci.ts) and the merge queue: read elsewhere, left alone here. */\n const AVCS_JSON_KEYS = [\"setup\", \"check\", \"build\", \"out\", \"queue\", \"whole\"] as const;\n@@ -299,6 +316,21 @@\n \t\telse if (j.uses !== undefined)\n \t\t\tsay(`${at}.abso`, \"gives a run job a key; a uses step runs on the server and has none\");\n \t}\n+\tconst timeout = j.timeout;\n+\tconst timed =\n+\t\ttimeout !== undefined &&\n+\t\ttypeof timeout === \"number\" &&\n+\t\tNumber.isInteger(timeout) &&\n+\t\ttimeout >= 1 &&\n+\t\ttimeout <= JOB_TIMEOUT_MAX &&\n+\t\tj.uses === undefined;\n+\tif (timeout !== undefined && !timed)\n+\t\tsay(\n+\t\t\t`${at}.timeout`,\n+\t\t\tj.uses !== undefined\n+\t\t\t\t? \"gives a run job's steps more time; a uses step runs on the server and has none\"\n+\t\t\t\t: `must be whole seconds from 1 to ${JOB_TIMEOUT_MAX}, not ${q(timeout)}`,\n+\t\t);\n \tconst withs: Record<string, unknown> = {};\n \tfor (const k of settings) if (j[k] !== undefined) withs[k] = j[k];\n \tif (uses === \"deploy\" && typeof j.worker !== \"string\")\n@@ -327,6 +359,7 @@\n \t\tcache: list(j.cache, `${at}.cache`, say, \"a list of files\"),\n \t\tsecrets,\n \t\t...((j.abso === \"reader\" || j.abso === \"writer\") && j.uses === undefined ? { abso: j.abso } : {}),\n+\t\t...(timed ? { timeout: timeout as number } : {}),\n \t\twith: withs,\n \t\t...machine(j, at, say, false),\n \t};"},{"path":"src/pipeline/test/pipeline.test.ts","added":34,"removed":3,"diff":"--- a/src/pipeline/test/pipeline.test.ts\n+++ b/src/pipeline/test/pipeline.test.ts\n@@ -5,7 +5,14 @@\n import assert from \"node:assert/strict\";\n import { describe, it } from \"node:test\";\n import { parse } from \"yaml\";\n-import { type Checked, checkPipelines, type Problem, readPipelineFile } from \"../pipeline.ts\";\n+import {\n+\ttype Checked,\n+\tcheckPipelines,\n+\tJOB_TIMEOUT_DEFAULT,\n+\tJOB_TIMEOUT_MAX,\n+\ttype Problem,\n+\treadPipelineFile,\n+} from \"../pipeline.ts\";\n \n /** The draft pipeline file, comments included. */\n const DRAFT = `defaults: { image: node, size: standard }   # image: a menu or \\`dockerfile: path\\`\n@@ -300,14 +307,14 @@\n \t\tconst ps = problems(\n \t\t\tcheckPipelines({\n \t\t\t\tdefaults: { image: \"node\", colour: \"blue\" },\n-\t\t\t\tpipelines: { p: { on: [\"push\"], when: \"always\", jobs: { a: { run: \"x\", timeout: 5, worker: \"w\" } } } },\n+\t\t\t\tpipelines: { p: { on: [\"push\"], when: \"always\", jobs: { a: { run: \"x\", retries: 5, worker: \"w\" } } } },\n \t\t\t\textra: 1,\n \t\t\t}),\n \t\t);\n \t\thas(ps, \"extra\", /isn't a key here/);\n \t\thas(ps, \"defaults.colour\", /isn't a key here/);\n \t\thas(ps, \"pipelines.p.when\", /isn't a key here \\(known: on, only, jobs, required\\)/);\n-\t\thas(ps, \"pipelines.p.jobs.a.timeout\", /isn't a key here/);\n+\t\thas(ps, \"pipelines.p.jobs.a.retries\", /isn't a key here/);\n \t\t// worker is deploy's own setting, not a run job's.\n \t\thas(ps, \"pipelines.p.jobs.a.worker\", /isn't a key here/);\n \t});\n@@ -415,3 +422,27 @@\n \t\thas(ps, \"out\", /must be a folder under the project/);\n \t});\n });\n+\n+describe(\"a run job's step limit\", () => {\n+\tit(\"takes whole seconds up to the most a step may run, and keeps them on the job\", () => {\n+\t\tconst file = ok(checkPipelines(one({ test: { run: \"npm test\", timeout: 600 }, lint: { run: \"npx biome ci .\" } })));\n+\t\tconst jobs = file.pipelines[0]!.jobs;\n+\t\tassert.equal(jobs.find((j) => j.name === \"test\")?.timeout, 600);\n+\t\tassert.equal(jobs.find((j) => j.name === \"lint\")?.timeout, undefined, \"no timeout: the default, unsaid\");\n+\t\tok(checkPipelines(one({ a: { run: \"x\", timeout: JOB_TIMEOUT_MAX } })));\n+\t});\n+\tit(\"refuses a limit that isn't whole seconds from 1 to the most, and one on a uses step\", () => {\n+\t\tfor (const bad of [0, -5, 901, 2.5, \"600\", null])\n+\t\t\thas(\n+\t\t\t\tproblems(checkPipelines(one({ a: { run: \"x\", timeout: bad } }))),\n+\t\t\t\t\"pipelines.p.jobs.a.timeout\",\n+\t\t\t\t/whole seconds from 1 to 900/,\n+\t\t\t);\n+\t\thas(\n+\t\t\tproblems(checkPipelines(one({ a: { uses: \"notify\", to: \"x\", timeout: 600 } }))),\n+\t\t\t\"pipelines.p.jobs.a.timeout\",\n+\t\t\t/a uses step runs on the server/,\n+\t\t);\n+\t\tassert.equal(JOB_TIMEOUT_DEFAULT, 300);\n+\t});\n+});"}],"ci":null}