@operad-io/dev 0.0.1 → 0.1.0

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/dev.schema.json CHANGED
@@ -300,6 +300,11 @@
300
300
  "exclusiveMinimum": 0,
301
301
  "default": 1800
302
302
  },
303
+ "stallSecs": {
304
+ "description": "How long a gate command, or an integration key command, may write nothing before dev stops its process group, in seconds. A stalled command fails the check with reason \"stall\" and goes to the worker; it is not rerun and is not a \"not the code\" wait. Unset turns the limit off.",
305
+ "type": "number",
306
+ "exclusiveMinimum": 0
307
+ },
303
308
  "places": {
304
309
  "description": "The most checks of this repository that run at once, on top of the home's limit. A check waits, without a time limit, for a place of the home and one of the repository. Unset means the repository has no limit of its own.",
305
310
  "type": "integer",
@@ -422,27 +427,51 @@
422
427
  "additionalProperties": false
423
428
  },
424
429
  "fallback": {
425
- "description": "A second harness step and arguments used when the primary reviewer is unavailable.",
426
- "type": "object",
427
- "properties": {
428
- "use": {
429
- "description": "The harness step that reviews when the primary is unavailable.",
430
- "type": "string",
431
- "minLength": 1
430
+ "description": "A second harness step and arguments used when the primary reviewer is unavailable or does not write the report, or a list of them tried in order until one writes the report.",
431
+ "oneOf": [
432
+ {
433
+ "type": "object",
434
+ "properties": {
435
+ "use": {
436
+ "description": "The harness step that reviews when the primary is unavailable.",
437
+ "type": "string",
438
+ "minLength": 1
439
+ },
440
+ "args": {
441
+ "description": "Arguments the fallback harness step passes to its command.",
442
+ "type": "array",
443
+ "items": {
444
+ "type": "string"
445
+ },
446
+ "default": []
447
+ }
448
+ },
449
+ "required": ["use"],
450
+ "additionalProperties": false
432
451
  },
433
- "args": {
434
- "description": "Arguments the fallback harness step passes to its command.",
452
+ {
435
453
  "type": "array",
454
+ "minItems": 1,
436
455
  "items": {
437
- "type": "string"
438
- },
439
- "default": []
456
+ "type": "object",
457
+ "properties": {
458
+ "use": {
459
+ "type": "string",
460
+ "minLength": 1
461
+ },
462
+ "args": {
463
+ "type": "array",
464
+ "items": {
465
+ "type": "string"
466
+ },
467
+ "default": []
468
+ }
469
+ },
470
+ "required": ["use"],
471
+ "additionalProperties": false
472
+ }
440
473
  }
441
- },
442
- "required": [
443
- "use"
444
- ],
445
- "additionalProperties": false
474
+ ]
446
475
  },
447
476
  "timeoutSecs": {
448
477
  "description": "The longest a review may run, in seconds.",
package/package.json CHANGED
@@ -1,20 +1,20 @@
1
1
  {
2
2
  "name": "@operad-io/dev",
3
- "version": "0.0.1",
3
+ "version": "0.1.0",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": "./src/index.ts"
7
7
  },
8
8
  "dependencies": {
9
- "@operad-io/chat": "0.0.1",
10
- "@operad-io/engine": "0.0.1",
11
- "@operad-io/pool": "0.0.1",
12
- "@operad-io/review-grading": "0.0.1"
9
+ "@operad-io/chat": "0.1.0",
10
+ "@operad-io/engine": "0.1.0",
11
+ "@operad-io/pool": "0.1.0",
12
+ "@operad-io/review-grading": "0.1.0"
13
13
  },
14
14
  "devDependencies": {
15
- "@operad-io/shell": "0.0.1"
15
+ "@operad-io/shell": "0.1.0"
16
16
  },
17
- "description": "operad: the dev plugin, plans and tasks on a repository (in development)",
17
+ "description": "operad: the dev plugin, plans and tasks on a repository",
18
18
  "repository": {
19
19
  "type": "git",
20
20
  "url": "git+https://github.com/operad-io/operad.git",
package/src/chat.ts CHANGED
@@ -22,7 +22,7 @@ import { isRegistered, prepareWorktree, workBranch, worktreePath } from "./steps
22
22
  /**
23
23
  * The harnesses a repository chat offers, in order: the ones that can stop a
24
24
  * tool call before it starts, so the main clone stays read-only
25
- * (`operad-conversation.md` decisions 13 and 14). radian is not one.
25
+ * (ADR 0028 D2, D3). radian is not one.
26
26
  */
27
27
  export const CHAT_HARNESSES = ["claude", "pi"] as const;
28
28
 
package/src/gate.ts CHANGED
@@ -38,6 +38,7 @@ import {
38
38
  type DevSettings,
39
39
  type FixLevel,
40
40
  type ReviewerFallback,
41
+ reviewerFallbacks,
41
42
  type ReviewerSettings,
42
43
  } from "./settings.ts";
43
44
  import { reviewWaitKind } from "./waits.ts";
@@ -303,13 +304,20 @@ export async function runVerify(
303
304
  run: () =>
304
305
  runCheckCommands(
305
306
  runStep,
306
- { cwd: path, timeoutSecs: context.settings.gate.commandTimeoutSecs },
307
+ {
308
+ cwd: path,
309
+ timeoutSecs: context.settings.gate.commandTimeoutSecs,
310
+ ...(context.settings.gate.stallSecs === undefined
311
+ ? {}
312
+ : { stallSecs: context.settings.gate.stallSecs }),
313
+ },
307
314
  commands,
308
315
  stepOptions(ctx, path),
309
316
  rerun,
310
317
  checkPlaces(ctx, context.repository, context.settings.gate.places, context.taskKey),
311
318
  ),
312
319
  limit: context.settings.check.loadLimit,
320
+ flakyLimit: context.settings.check.flakyLoadLimit,
313
321
  signal: ctx.signal,
314
322
  log: (text) => ctx.logger.write(text),
315
323
  });
@@ -365,6 +373,7 @@ export async function runVerify(
365
373
  run: ctx.runId,
366
374
  commands: commands.map((line) => (typeof line === "string" ? line : line.run)),
367
375
  ...(command === undefined ? {} : { command }),
376
+ ...(typeof outcomeData.reason === "string" ? { reason: outcomeData.reason } : {}),
368
377
  ...(log === undefined ? {} : { log }),
369
378
  ...(message === undefined ? {} : { message }),
370
379
  ...(lineNumber === undefined ? {} : { lineNumber }),
@@ -1511,6 +1520,8 @@ function replayReview(
1511
1520
  interface ReviewAction {
1512
1521
  readonly role: ReviewRunRole;
1513
1522
  readonly reason: ReviewRunReason;
1523
+ /** The entry of the fallback list a fallback run uses. */
1524
+ readonly fallbackIndex?: number;
1514
1525
  }
1515
1526
 
1516
1527
  type ReviewNext =
@@ -1522,42 +1533,72 @@ type ReviewNext =
1522
1533
  | "out-of-time"
1523
1534
  | "failed";
1524
1535
 
1536
+ /** Whether two runs used the same reviewer: the primary, or the same fallback. */
1537
+ function sameRunner(a: ReviewRunRecord, b: ReviewRunRecord): boolean {
1538
+ return (
1539
+ a.role === b.role &&
1540
+ (a.role === "primary" || (a.fallbackIndex ?? 0) === (b.fallbackIndex ?? 0))
1541
+ );
1542
+ }
1543
+
1544
+ /** The same run again: same role and, for a fallback, the same list entry. */
1545
+ function retryOf(last: ReviewRunRecord): ReviewAction {
1546
+ return last.role === "fallback"
1547
+ ? { role: "fallback", reason: "retry", fallbackIndex: last.fallbackIndex ?? 0 }
1548
+ : { role: "primary", reason: "retry" };
1549
+ }
1550
+
1525
1551
  /**
1526
1552
  * What the next run of a review round is. A report ends the round; an
1527
1553
  * unavailable primary goes to the fallback once; a timeout is retried once on
1528
1554
  * the same model; an invalid report is retried once. Every other state ends
1529
1555
  * the round for a person or for a wait.
1530
1556
  */
1531
- function nextReviewAction(
1557
+ export function nextReviewAction(
1532
1558
  runs: readonly ReviewRunRecord[],
1533
- fallback: ReviewerFallback | undefined,
1559
+ fallback: ReviewerFallback | readonly ReviewerFallback[] | undefined,
1534
1560
  ): ReviewNext {
1535
1561
  const last = runs[runs.length - 1];
1536
1562
  if (last === undefined) return { role: "primary", reason: "initial" };
1563
+ const list = reviewerFallbacks(fallback);
1564
+ // The list got shorter after this run (dev.json changed): there is no entry
1565
+ // to retry or follow, so the round ends for a person.
1566
+ if (
1567
+ last.outcome !== "report" &&
1568
+ last.role === "fallback" &&
1569
+ (last.fallbackIndex ?? 0) >= list.length
1570
+ ) {
1571
+ return "failed";
1572
+ }
1573
+ // The fallback after the last run: the first one when the primary ran last
1574
+ // and no fallback has run in this round (a later primary failure waits
1575
+ // instead of trying them again), the next one after a fallback's failure.
1576
+ const nextFallback = (): ReviewAction | undefined => {
1577
+ const index =
1578
+ last.role === "primary"
1579
+ ? runs.some((run) => run.role === "fallback")
1580
+ ? list.length
1581
+ : 0
1582
+ : (last.fallbackIndex ?? 0) + 1;
1583
+ return index < list.length
1584
+ ? { role: "fallback", reason: "fallback", fallbackIndex: index }
1585
+ : undefined;
1586
+ };
1537
1587
  switch (last.outcome) {
1538
1588
  case "report":
1539
1589
  return "done";
1540
1590
  case "unavailable":
1541
- // A round uses its fallback exactly once, even when it runs again after
1542
- // `retryAt`: a later primary failure waits instead of trying it again.
1543
- if (
1544
- last.role === "primary" &&
1545
- fallback !== undefined &&
1546
- !runs.some((run) => run.role === "fallback")
1547
- ) {
1548
- return { role: "fallback", reason: "fallback" };
1549
- }
1550
- return "wait-unavailable";
1591
+ return nextFallback() ?? "wait-unavailable";
1551
1592
  case "timed_out": {
1552
1593
  const before = runs[runs.length - 2];
1553
1594
  if (
1554
1595
  before !== undefined &&
1555
1596
  before.outcome === "timed_out" &&
1556
- before.role === last.role
1597
+ sameRunner(before, last)
1557
1598
  ) {
1558
- return "wait-timed-out";
1599
+ return (last.role === "fallback" ? nextFallback() : undefined) ?? "wait-timed-out";
1559
1600
  }
1560
- return { role: last.role, reason: "retry" };
1601
+ return retryOf(last);
1561
1602
  }
1562
1603
  case "invalid":
1563
1604
  case "no_report": {
@@ -1565,20 +1606,23 @@ function nextReviewAction(
1565
1606
  if (
1566
1607
  before !== undefined &&
1567
1608
  (before.outcome === "invalid" || before.outcome === "no_report") &&
1568
- before.role === last.role
1609
+ sameRunner(before, last)
1569
1610
  ) {
1570
- return "failed";
1611
+ return (last.role === "fallback" ? nextFallback() : undefined) ?? "failed";
1571
1612
  }
1572
- return { role: last.role, reason: "retry" };
1613
+ return retryOf(last);
1573
1614
  }
1574
1615
  case "failed":
1575
- return "failed";
1616
+ return (last.role === "fallback" ? nextFallback() : undefined) ?? "failed";
1576
1617
  }
1577
1618
  }
1578
1619
 
1579
1620
  /** One run in words a person can read. */
1580
1621
  function runPhrase(run: ReviewRunRecord): string {
1581
- const who = run.role === "fallback" ? `fallback ${run.model}` : run.model;
1622
+ // A later list entry is named by its place, as the settings name it, so two
1623
+ // entries with one model and different arguments read apart.
1624
+ const place = (run.fallbackIndex ?? 0) > 0 ? `[${run.fallbackIndex}]` : "";
1625
+ const who = run.role === "fallback" ? `fallback${place} ${run.model}` : run.model;
1582
1626
  switch (run.outcome) {
1583
1627
  case "report":
1584
1628
  return `${who} reviewed`;
@@ -1851,7 +1895,9 @@ export async function runReview(
1851
1895
  // A report from the fallback harness ran with the fallback's harness and
1852
1896
  // arguments; only the limits carried over from the round.
1853
1897
  const lastRun = recorded.runs?.[recorded.runs.length - 1];
1854
- const fallback = context.settings.reviewer.fallback;
1898
+ const fallback = reviewerFallbacks(context.settings.reviewer.fallback)[
1899
+ lastRun?.fallbackIndex ?? 0
1900
+ ];
1855
1901
  if (used !== undefined && lastRun?.role === "fallback" && fallback !== undefined) {
1856
1902
  used = {
1857
1903
  ...used,
@@ -2268,18 +2314,22 @@ export async function runReview(
2268
2314
  const resume =
2269
2315
  pendingReview !== undefined &&
2270
2316
  pendingReview.role === action.role &&
2271
- pendingReview.reason === action.reason
2317
+ pendingReview.reason === action.reason &&
2318
+ (pendingReview.fallbackIndex ?? 0) === (action.fallbackIndex ?? 0)
2272
2319
  ? pendingReview
2273
2320
  : undefined;
2274
2321
  pendingReview = undefined;
2275
- const use =
2276
- resume?.use ??
2277
- (action.role === "fallback"
2278
- ? settings.fallback?.use ?? roundSettings.use
2279
- : roundSettings.use);
2322
+ const chosen =
2323
+ action.role === "fallback"
2324
+ ? reviewerFallbacks(settings.fallback)[action.fallbackIndex ?? 0]
2325
+ : undefined;
2326
+ const use = resume?.use ?? chosen?.use ?? roundSettings.use;
2280
2327
  const args =
2281
- resume?.args ??
2282
- (action.role === "fallback" ? settings.fallback?.args ?? [] : roundArgs);
2328
+ resume?.args ?? (action.role === "fallback" ? chosen?.args ?? [] : roundArgs);
2329
+ const fallbackFields =
2330
+ action.fallbackIndex === undefined
2331
+ ? {}
2332
+ : { fallbackIndex: action.fallbackIndex };
2283
2333
  const model = resume?.model ?? modelOf(use, args);
2284
2334
  // One path per call: the calls before it in this round are the try number,
2285
2335
  // so a stale report of an earlier call is never read and never removed.
@@ -2338,6 +2388,7 @@ export async function runReview(
2338
2388
  args,
2339
2389
  model,
2340
2390
  reason: action.reason,
2391
+ ...fallbackFields,
2341
2392
  run: ctx.runId,
2342
2393
  report: reportPath,
2343
2394
  },
@@ -2418,6 +2469,7 @@ export async function runReview(
2418
2469
  args,
2419
2470
  model,
2420
2471
  reason: action.reason,
2472
+ ...fallbackFields,
2421
2473
  outcome: "report",
2422
2474
  run: ctx.runId,
2423
2475
  findings,
@@ -2433,6 +2485,7 @@ export async function runReview(
2433
2485
  args,
2434
2486
  model,
2435
2487
  reason: action.reason,
2488
+ ...fallbackFields,
2436
2489
  outcome: call.outcome,
2437
2490
  run: ctx.runId,
2438
2491
  ...(call.message.length === 0 ? {} : { message: call.message }),
package/src/index.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  /** The dev plugin: repositories, plans, tasks and their commands and views. */
2
2
 
3
+ import pkg from "../package.json" with { type: "json" };
3
4
  import { definePlugin } from "@operad-io/engine";
4
5
  import { PLAN_FILTERS, REPO_FILTERS, TASK_FILTERS } from "./model.ts";
5
6
  import devFlow from "../flows/dev.flow.ts";
@@ -25,7 +26,7 @@ export function createDevPlugin() {
25
26
  return definePlugin({
26
27
  name: "dev",
27
28
  kind: "domain",
28
- version: "0.0.0",
29
+ version: pkg.version,
29
30
  objects: [
30
31
  {
31
32
  name: "repo",
package/src/integrate.ts CHANGED
@@ -586,7 +586,12 @@ export async function runIntegrate(
586
586
  run: () =>
587
587
  runCheckCommands(
588
588
  runStep,
589
- { cwd: gate },
589
+ {
590
+ cwd: gate,
591
+ ...(settings.gate.stallSecs === undefined
592
+ ? {}
593
+ : { stallSecs: settings.gate.stallSecs }),
594
+ },
590
595
  keyCommands,
591
596
  stepOptions(ctx, gate),
592
597
  settings.check.rerun,
@@ -599,6 +604,7 @@ export async function runIntegrate(
599
604
  ),
600
605
  ),
601
606
  limit: settings.check.loadLimit,
607
+ flakyLimit: settings.check.flakyLoadLimit,
602
608
  signal: ctx.signal,
603
609
  log: (text) => ctx.logger.write(text),
604
610
  });
@@ -920,7 +926,12 @@ export async function runIntegrate(
920
926
  run: () =>
921
927
  runCheckCommands(
922
928
  runStep,
923
- { cwd: gate },
929
+ {
930
+ cwd: gate,
931
+ ...(settings.gate.stallSecs === undefined
932
+ ? {}
933
+ : { stallSecs: settings.gate.stallSecs }),
934
+ },
924
935
  keyCommands,
925
936
  stepOptions(ctx, gate),
926
937
  settings.check.rerun,
@@ -933,6 +944,7 @@ export async function runIntegrate(
933
944
  ),
934
945
  ),
935
946
  limit: settings.check.loadLimit,
947
+ flakyLimit: settings.check.flakyLoadLimit,
936
948
  signal: ctx.signal,
937
949
  log: (text) => ctx.logger.write(text),
938
950
  });
package/src/marks.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * The mark and badge a dev row carries (presentation decision 10). The marks
2
+ * The mark and badge a dev row carries (ADR 0016). The marks
3
3
  * are read from the same task and plan data the views read: the phase, what
4
4
  * the attempt has recorded so far, and the holds the scheduler keeps.
5
5
  */
package/src/model.ts CHANGED
@@ -162,6 +162,8 @@ export interface VerifyRecord {
162
162
  /** The file the failed command's output was written to. */
163
163
  readonly log?: string | null;
164
164
  readonly message?: string | null;
165
+ /** The check's reason: `stall` names a command that stopped writing. */
166
+ readonly reason?: string | null;
165
167
  readonly lineNumber?: number | null;
166
168
  /** The gate commands this verify ran, as they were when it ran. */
167
169
  readonly commands?: readonly string[];
@@ -241,6 +243,8 @@ export interface ReviewRunRecord {
241
243
  readonly verified?: readonly string[] | null;
242
244
  /** How many of the findings are at or above the fix level. */
243
245
  readonly counted?: number | null;
246
+ /** Which entry of the fallback list a fallback run used; 0 when unset. */
247
+ readonly fallbackIndex?: number | null;
244
248
  }
245
249
 
246
250
  /**
@@ -257,6 +261,8 @@ export interface PendingReviewRun {
257
261
  readonly args: readonly string[];
258
262
  readonly model: string;
259
263
  readonly reason: ReviewRunReason;
264
+ /** Which entry of the fallback list a fallback run uses; 0 when unset. */
265
+ readonly fallbackIndex?: number | null;
260
266
  readonly run?: string | null;
261
267
  /** The report path inside the gate worktree this call was given. */
262
268
  readonly report?: string | null;
package/src/notcode.ts CHANGED
@@ -20,6 +20,11 @@
20
20
  * rerun. The check then passes; the kind tells the flaky-test count whether
21
21
  * the machine was to blame (see `isLoaded`).
22
22
  *
23
+ * A `test-timeout` is code, not the machine, when the failed test was rerun
24
+ * alone, timed out again, and the load during that rerun stayed below the
25
+ * flaky load limit (`check.flakyLoadLimit`, default twice the cores): the
26
+ * result goes to the worker as a failure with a rework note.
27
+ *
23
28
  * For a result of kind 1 to 3, `runCheckSteadily` waits until the machine's
24
29
  * 1-minute load average is below the limit (`check.loadLimit`, default the
25
30
  * number of cores), runs the check once more by itself, and reports a second
@@ -29,6 +34,7 @@
29
34
 
30
35
  import { machineLoad, type MachineLoad } from "@operad-io/engine/platform";
31
36
  import { waitFor } from "./gate.ts";
37
+ import { flakyLoadLimitOf } from "./flaky.ts";
32
38
  import { readSince, type CheckRun } from "./rerun.ts";
33
39
  import { isRecord } from "@operad-io/engine";
34
40
 
@@ -181,6 +187,33 @@ export interface CheckLoad {
181
187
  readonly end: MachineLoad;
182
188
  }
183
189
 
190
+ /**
191
+ * The checked result with a note when it is a test that timed out when run
192
+ * alone under a load below the flaky limit; otherwise undefined.
193
+ */
194
+ function timeoutAlone(
195
+ checked: CheckRun,
196
+ load: CheckLoad,
197
+ flakyLimit: number | undefined,
198
+ ): CheckRun | undefined {
199
+ if (checked.aloneRerun !== true) return undefined;
200
+ const facts = factsOf(checked);
201
+ if (classifyCheck(facts)?.kind !== "test-timeout") return undefined;
202
+ const limit = flakyLoadLimitOf(flakyLimit, load.end);
203
+ // Busy means above the limit, as `flaky.ts` reads it. The reading spans the whole
204
+ // check run (full suite and alone rerun), so a quiet reading is a strict test.
205
+ if (load.start.load1 > limit || load.end.load1 > limit) return undefined;
206
+ const outcome = checked.outcome;
207
+ if (outcome === undefined) return undefined;
208
+ const data = isRecord(outcome.data) ? outcome.data : {};
209
+ const names = failedTests(facts.log).map((test) => test.name).join("; ");
210
+ const seconds = testTimeoutOf(facts.line) / 1000;
211
+ const peak = Math.max(load.start.load1, load.end.load1);
212
+ const log = typeof data.log === "string" ? `; log: ${data.log}` : "";
213
+ const message = `the failed test "${names}" timed out at ${seconds} s when run alone under load ${Number(peak.toFixed(1))} on ${load.end.cores} cores${log}`;
214
+ return { ...checked, outcome: { ...outcome, data: { ...data, message } } };
215
+ }
216
+
184
217
  export interface SteadyCheck {
185
218
  readonly checked: CheckRun;
186
219
  /** Set when the check ended "not the code" twice: a person decides. */
@@ -229,6 +262,8 @@ async function waitForQuiet(
229
262
  export async function runCheckSteadily(input: {
230
263
  readonly run: () => Promise<CheckRun>;
231
264
  readonly limit: number | undefined;
265
+ /** `check.flakyLoadLimit`: a timeout alone below it is the code's. */
266
+ readonly flakyLimit?: number | undefined;
232
267
  readonly signal?: AbortSignal | undefined;
233
268
  readonly log?: ((text: string) => Promise<unknown> | unknown) | undefined;
234
269
  }): Promise<SteadyCheck> {
@@ -242,6 +277,8 @@ export async function runCheckSteadily(input: {
242
277
  const first = await input.run();
243
278
  const firstEnd = sample();
244
279
  const loads: CheckLoad[] = [{ start: firstStart, end: firstEnd }];
280
+ const firstCode = timeoutAlone(first, { start: firstStart, end: firstEnd }, input.flakyLimit);
281
+ if (firstCode !== undefined) return { checked: firstCode, runs: 1, load: peak, loads };
245
282
  if (!worthAnotherRun(classifyRun(first))) {
246
283
  return { checked: first, runs: 1, load: peak, loads };
247
284
  }
@@ -252,6 +289,8 @@ export async function runCheckSteadily(input: {
252
289
  const second = await input.run();
253
290
  const after = sample();
254
291
  loads.push({ start: secondStart, end: after });
292
+ const secondCode = timeoutAlone(second, { start: secondStart, end: after }, input.flakyLimit);
293
+ if (secondCode !== undefined) return { checked: secondCode, runs: 2, load: peak, loads };
255
294
  const found = classifyRun(second);
256
295
  if (!worthAnotherRun(found)) {
257
296
  return { checked: second, runs: 2, load: peak, loads };
@@ -82,6 +82,13 @@ export const DEV_PROJECT_SETTINGS: ProjectSettingsDeclaration = {
82
82
  description:
83
83
  "The longest one check may run, in seconds, before it counts as failed.",
84
84
  },
85
+ stallSecs: {
86
+ type: "number",
87
+ minimum: 1,
88
+ editable: true,
89
+ description:
90
+ "How long a check may write nothing, in seconds, before it is stopped and fails as a stall. Unset turns the limit off.",
91
+ },
85
92
  },
86
93
  },
87
94
  reviewer: {
package/src/rerun.ts CHANGED
@@ -34,6 +34,8 @@ export interface CheckRun {
34
34
  readonly passedOnRerun: readonly string[];
35
35
  /** The `failed` settings of the command whose match found each of those tests. */
36
36
  readonly failedBy?: ReadonlyMap<string, FailedRerun> | undefined;
37
+ /** Set when the result is the failed test's own rerun, run alone, failing again. */
38
+ readonly aloneRerun?: boolean | undefined;
37
39
  }
38
40
 
39
41
  /** The line drawn between the two runs in the check log. */
@@ -119,7 +121,13 @@ export async function runCheckWithRerun(
119
121
  const firstData = dataOf(first.outcome);
120
122
  const failed = first.hostError !== undefined || first.outcome?.result === "fail";
121
123
  // Only a plain failure is rerun: not a cancel, not a hang.
122
- if (!failed || rerun <= 0 || firstData.reason === "timeout" || first.hostError !== undefined) {
124
+ if (
125
+ !failed ||
126
+ rerun <= 0 ||
127
+ firstData.reason === "timeout" ||
128
+ firstData.reason === "stall" ||
129
+ first.hostError !== undefined
130
+ ) {
123
131
  return { ...first, rerun: false, note: undefined, passedOnRerun: [] };
124
132
  }
125
133
  const label =
@@ -144,10 +152,12 @@ export async function runCheckWithRerun(
144
152
  note: `${label} failed, passed on rerun${attempts > 1 ? ` ${attempts}` : ""}`,
145
153
  };
146
154
  }
155
+ const reason = dataOf(last.outcome).reason;
147
156
  if (
148
157
  last.hostError !== undefined ||
149
158
  last.outcome?.result !== "fail" ||
150
- dataOf(last.outcome).reason === "timeout"
159
+ reason === "timeout" ||
160
+ reason === "stall"
151
161
  ) {
152
162
  break;
153
163
  }
@@ -277,8 +287,10 @@ export async function runCheckCommands(
277
287
  };
278
288
  const finish = (
279
289
  result: Pick<CheckRun, "outcome" | "hostError">,
290
+ aloneRerun = false,
280
291
  ): CheckRun => ({
281
292
  ...result,
293
+ ...(aloneRerun ? { aloneRerun: true } : {}),
282
294
  rerun: reran,
283
295
  passedOnRerun: passed,
284
296
  failedBy,
@@ -368,7 +380,7 @@ export async function runCheckCommands(
368
380
  `the failed test "${name}" failed again when run alone`,
369
381
  ),
370
382
  hostError: again.hostError,
371
- });
383
+ }, again.hostError === undefined);
372
384
  }
373
385
  const note = describePass(passed);
374
386
  if (note !== undefined) notes.push(note);
package/src/schedule.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * The dev plugin's scheduler. The kernel calls `onTick`; this module decides
3
3
  * which ready tasks start, which reviewed task auto merge answers, and when a
4
- * plan is finished. Scheduling lives here, not in the kernel (operad decision 12).
4
+ * plan is finished. Scheduling lives here, not in the kernel (ADR 0002 D1).
5
5
  */
6
6
 
7
7
  import { DEFAULT_POOL } from "@operad-io/pool";