@ai-dossier/sched 0.9.0 → 0.11.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/dist/dispatch.js CHANGED
@@ -5,9 +5,12 @@
5
5
  * last-progress timestamp tracked in state.json"; RFC-0001 §C.1 "spawns agent
6
6
  * processes via the existing `run` machinery").
7
7
  *
8
- * The command is a template (default `claude -p --output-format json --model
9
- * {model}` — the same headless invocation `ai-dossier run` builds in
10
- * cli/src/helpers.ts) with `{model}`/`{issue}` placeholders; the prompt
8
+ * The command is a template (default `claude -p --output-format stream-json
9
+ * --verbose --model {model}` — `ai-dossier run`'s headless invocation in
10
+ * cli/src/helpers.ts uses the one-shot `json` form instead, because it
11
+ * captures stdout in-process from an agent it waits on; a detached dispatch
12
+ * needs incremental output, see {@link DEFAULT_DISPATCH_COMMAND}) with
13
+ * `{model}`/`{issue}` placeholders; the prompt
11
14
  * travels on stdin exactly like the run machinery's headless path. Children
12
15
  * spawn DETACHED and unref'd: an agent must survive a sched crash (RFC F.10 —
13
16
  * restart reconciles by pid, it never owns the agent's lifetime).
@@ -65,11 +68,14 @@ exports.buildBatchReportPrompt = buildBatchReportPrompt;
65
68
  exports.escalateTier = escalateTier;
66
69
  exports.reportTierFor = reportTierFor;
67
70
  exports.unitLogName = unitLogName;
71
+ exports.dispatchLogPath = dispatchLogPath;
72
+ exports.fileSizeOrZero = fileSizeOrZero;
68
73
  exports.procStartTime = procStartTime;
69
74
  exports.createSpawnDeps = createSpawnDeps;
70
75
  const node_child_process_1 = require("node:child_process");
71
76
  const fs = __importStar(require("node:fs"));
72
77
  const path = __importStar(require("node:path"));
78
+ const core_1 = require("@ai-dossier/core");
73
79
  const project_1 = require("./project");
74
80
  const types_1 = require("./types");
75
81
  /** Default tier → model mapping (claude aliases; override in config.json). */
@@ -78,12 +84,27 @@ exports.DEFAULT_TIER_MODELS = {
78
84
  mid: 'sonnet',
79
85
  strong: 'opus',
80
86
  };
81
- /** Default headless agent command template (claude, the run machinery's first choice). */
87
+ /**
88
+ * Default headless agent command template (claude, the run machinery's first choice).
89
+ *
90
+ * **`stream-json`, not `json` (ai-dossier#524).** `--output-format json`
91
+ * buffers the entire session and writes ONE object at process exit, so the
92
+ * dispatch log stays 0 bytes for the whole run and only fills if the agent
93
+ * exits cleanly. The batch pilot's six 0-byte logs are exactly the six units
94
+ * that never reached a detected exit — they were advanced by ground truth
95
+ * (`external-advance`) while their agent was still alive and then killed, so
96
+ * the one-shot write never happened. `stream-json` emits an event per turn,
97
+ * so the log fills as the run proceeds and `parseAgentUsage` can recover
98
+ * per-turn tokens even from a dispatch that was killed mid-flight.
99
+ * `--verbose` is required by claude whenever `-p` is combined with
100
+ * `stream-json`.
101
+ */
82
102
  exports.DEFAULT_DISPATCH_COMMAND = [
83
103
  'claude',
84
104
  '-p',
85
105
  '--output-format',
86
- 'json',
106
+ 'stream-json',
107
+ '--verbose',
87
108
  '--model',
88
109
  '{model}',
89
110
  ];
@@ -476,6 +497,39 @@ function reportTierFor(recoveries) {
476
497
  function unitLogName(unit) {
477
498
  return (0, project_1.sanitizeSlug)(unit);
478
499
  }
500
+ /**
501
+ * Path to a unit's dispatch log (`<runsDir>/<unitLogName>.log`) — the single
502
+ * definition shared by `spawnAndRecord` (which stats it for
503
+ * `log_offset_at_spawn`, #524) and `recordDispatchRunLog` (which reads it),
504
+ * so the two can never compute different paths for the same unit.
505
+ */
506
+ function dispatchLogPath(runsDir, unit) {
507
+ return path.join(runsDir, `${unitLogName(unit)}.log`);
508
+ }
509
+ /**
510
+ * Byte size of `file`, or 0 when it does not exist yet (#524: the log's
511
+ * append boundary right before a spawn — `log_offset_at_spawn`). Any other
512
+ * read error also degrades to 0 rather than throwing, since a spawn must
513
+ * never fail over a stat call on a debug log.
514
+ */
515
+ function fileSizeOrZero(file) {
516
+ try {
517
+ return fs.statSync(file).size;
518
+ }
519
+ catch (err) {
520
+ // ENOENT genuinely means "no prior bytes". Any OTHER stat error against a
521
+ // log that may already hold a previous dispatch's output silently
522
+ // re-enables the corruption the offset exists to prevent (claude:
523
+ // a prior dispatch's result attributed to this one; opencode: doubled
524
+ // tokens), so say so rather than degrading in silence.
525
+ const code = err.code;
526
+ if (code !== 'ENOENT') {
527
+ process.stderr.write(`⚠ sched: could not stat dispatch log ${file} (${code}); recording from offset 0 ` +
528
+ `may include a prior dispatch's output\n`);
529
+ }
530
+ return 0;
531
+ }
532
+ }
479
533
  /** Poll cadence bounds for `sleep`'s stop-check interval (engine loop). */
480
534
  exports.STOP_POLL_MIN_MS = 100;
481
535
  exports.STOP_POLL_MAX_MS = 1000;
@@ -530,8 +584,32 @@ function createSpawnDeps(cwd) {
530
584
  return {
531
585
  spawn(cmd, prompt, logFile) {
532
586
  fs.mkdirSync(path.dirname(logFile), { recursive: true, mode: 0o700 });
587
+ // Append, not truncate: `logFile` is per-UNIT (dispatchLogPath), so a
588
+ // redispatch's output lands after any prior dispatch's in the SAME
589
+ // file. `engine.ts`'s `recordDispatchRunLog` (#524) relies on
590
+ // `SlotEntry.log_offset_at_spawn` — stamped from this file's size right
591
+ // before this spawn — to read only the current dispatch's own slice.
533
592
  const out = fs.openSync(logFile, 'a', 0o600);
534
593
  try {
594
+ // #524: a log must never be 0 bytes for a unit that ran. The agent's
595
+ // own first write can be seconds (claude) or minutes away, and an
596
+ // agent killed before it writes anything would otherwise leave an
597
+ // empty file indistinguishable from "never spawned". This preamble
598
+ // makes the dispatch self-describing from t=0 and marks the boundary
599
+ // `log_offset_at_spawn` points at. Every parser in
600
+ // `@ai-dossier/core`'s agent-usage skips this `type`, so it never
601
+ // counts as agent output. Best-effort: a telemetry marker must not
602
+ // stop a dispatch, so a failed write is swallowed.
603
+ try {
604
+ fs.writeSync(out, `${JSON.stringify({ type: core_1.SCHED_DISPATCH_EVENT, ts: new Date().toISOString(), cmd })}\n`);
605
+ }
606
+ catch (err) {
607
+ // The fd opened fine, so the spawn below will NOT surface this — and
608
+ // a failed preamble write (ENOSPC, EDQUOT, EIO) leaves exactly the
609
+ // 0-byte log the preamble exists to prevent. Warn, matching
610
+ // `Journal.append`'s convention, rather than failing the dispatch.
611
+ process.stderr.write(`⚠ sched: could not write dispatch preamble to ${logFile}: ${err.message}\n`);
612
+ }
535
613
  const child = (0, node_child_process_1.spawn)(cmd[0], cmd.slice(1), {
536
614
  ...(cwd ? { cwd } : {}),
537
615
  detached: true,
@@ -548,6 +626,19 @@ function createSpawnDeps(cwd) {
548
626
  child.stdin.write(prompt);
549
627
  child.stdin.end();
550
628
  }
629
+ // A second marker once the pid is known: `events.jsonl` keys
630
+ // everything on pid/slot, and without this a log slice can only be
631
+ // matched to its journal record by timestamp. Parsers skip it by
632
+ // `type`, same as the preamble.
633
+ if (child.pid !== undefined) {
634
+ try {
635
+ fs.writeSync(out, `${JSON.stringify({ type: core_1.SCHED_DISPATCH_EVENT, event: 'spawned', pid: child.pid, ts: new Date().toISOString() })}\n`);
636
+ }
637
+ catch {
638
+ // Best-effort correlation aid; the preamble already guaranteed
639
+ // the log is non-empty, and its catch above warns on real trouble.
640
+ }
641
+ }
551
642
  child.unref();
552
643
  if (child.pid === undefined) {
553
644
  throw new Error(`failed to spawn '${cmd[0]}' — is it on PATH? (command: ${cmd.join(' ')})`);
@@ -1 +1 @@
1
- {"version":3,"file":"dispatch.js","sourceRoot":"","sources":["../src/dispatch.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;GAgBG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyQH,0CAwBC;AAsCD,oDAKC;AAUD,kDAOC;AAQD,8CAqBC;AAUD,kDAUC;AAQD,kCAGC;AAWD,8CASC;AA+BD,wCAqBC;AASD,8CAWC;AAOD,oDAaC;AAMD,wDAOC;AAGD,oCAEC;AAQD,sCAEC;AAiCD,kCAEC;AAYD,sCAcC;AAcD,0CAyEC;AAvrBD,2DAA2C;AAC3C,4CAA8B;AAC9B,gDAAkC;AAClC,uCAAyC;AACzC,mCAWiB;AAEjB,8EA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,GAAG,CAAC,KAAK,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;gBACxD,OAAO,KAAK,CAAC,GAAG,CAAC;YACnB,CAAC;oBAAS,CAAC;gBACT,wEAAwE;gBACxE,EAAE,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;YACpB,CAAC;QACH,CAAC;QACD,IAAI,CAAC,GAAW,EAAE,aAAsB;YACtC,IAAI,CAAC,oBAAoB,CAAC,GAAG,EAAE,aAAa,CAAC,EAAE,CAAC;gBAC9C,aAAa,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;gBAC1B,OAAO,KAAK,CAAC,CAAC,oDAAoD;YACpE,CAAC;YACD,IAAI,CAAC;gBACH,OAAO,CAAC,IAAI,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC;gBAC7B,OAAO,IAAI,CAAC;YACd,CAAC;YAAC,MAAM,CAAC;gBACP,aAAa,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;gBAC1B,OAAO,KAAK,CAAC;YACf,CAAC;QACH,CAAC;QACD,OAAO,CAAC,GAAW,EAAE,aAAsB;YACzC,IAAI,CAAC;gBACH,OAAO,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;gBACrB,OAAO,oBAAoB,CAAC,GAAG,EAAE,aAAa,CAAC,CAAC;YAClD,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACb,OAAQ,GAA6B,CAAC,IAAI,KAAK,OAAO,CAAC;YACzD,CAAC;QACH,CAAC;QACD,YAAY,CAAC,GAAW;YACtB,OAAO,aAAa,CAAC,GAAG,CAAC,CAAC;QAC5B,CAAC;KACF,CAAC;AACJ,CAAC"}
package/dist/engine.d.ts CHANGED
@@ -85,6 +85,14 @@ export interface EngineDeps {
85
85
  * existed, journaling `fence-failed` so the gap is visible rather than silent.
86
86
  */
87
87
  fencer?: RunFencer;
88
+ /**
89
+ * Home directory `runs.jsonl` telemetry (#524) is written under —
90
+ * `<homeDir>/.dossier/runs.jsonl`, the same file `cli`'s `ai-dossier run`
91
+ * writes to. Optional and defaults to `os.homedir()` (via
92
+ * `appendSchedRunLog`'s own default) when absent — override ONLY for
93
+ * tests, so they never touch the real machine's `~/.dossier`.
94
+ */
95
+ homeDir?: string;
88
96
  /**
89
97
  * Exec for batch git/milestone-CLI operations (#523) — worktree claim, member
90
98
  * commit-range recording, milestone posting, PR watch. Optional, and required
@@ -1 +1 @@
1
- {"version":3,"file":"engine.d.ts","sourceRoot":"","sources":["../src/engine.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8DG;AAGH,OAAO,KAAK,EAAE,iBAAiB,EAAmB,MAAM,kBAAkB,CAAC;AAE3E,OAAO,EAQL,KAAK,SAAS,EAKf,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,EACL,KAAK,WAAW,EAMjB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAe,KAAK,OAAO,EAAa,MAAM,WAAW,CAAC;AACjE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAIxC,OAAO,EAML,KAAK,WAAW,EAMjB,MAAM,SAAS,CAAC;AAEjB,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,UAAU,CAAC;IAClB,OAAO,EAAE,OAAO,CAAC;IACjB,WAAW,EAAE,WAAW,CAAC;IACzB,SAAS,EAAE,SAAS,CAAC;IACrB,GAAG,EAAE,MAAM,IAAI,CAAC;IAChB,qEAAqE;IACrE,OAAO,EAAE,MAAM,CAAC;IAChB,iFAAiF;IACjF,YAAY,EAAE,MAAM,CAAC;IACrB;;;;OAIG;IACH,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB;;;;;;;OAOG;IACH,SAAS,CAAC,EAAE,iBAAiB,CAAC,M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qDAAqD;AACrD,MAAM,WAAW,UAAU;IACzB,8DAA8D;IAC9D,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,kFAAkF;IAClF,gBAAgB,EAAE,MAAM,EAAE,CAAC;IAC3B,sDAAsD;IACtD,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,gFAAgF;IAChF,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,8DAA8D;IAC9D,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,6GAA6G;IAC7G,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,uHAAuH;IACvH,mBAAmB,EAAE,MAAM,EAAE,CAAC;IAC9B,kEAAkE;IAClE,gBAAgB,EAAE,MAAM,EAAE,CAAC;IAC3B,qFAAqF;IACrF,aAAa,EAAE,MAAM,CAAC;IACtB,0DAA0D;IAC1D,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,2FAA2F;IAC3F,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,uEAAuE;IACvE,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB;;;;;OAKG;IACH,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,gDAAgD;IAChD,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB;AAugDD;;;;;;GAMG;AACH,wBAAgB,IAAI,CAAC,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,WAAW,GAAG,UAAU,CAoEtE;AAeD;;;;;;;GAOG;AACH,wBAAsB,OAAO,CAC3B,IAAI,EAAE,UAAU,EAChB,MAAM,EAAE,WAAW,EACnB,UAAU,EAAE,MAAM,OAAO,EACzB,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,UAAU,KAAK,IAAI,GACpC,OAAO,CAAC,IAAI,CAAC,CAcf"}
package/dist/engine.js CHANGED
@@ -62,47 +62,14 @@
62
62
  * only when `EngineDeps.batchExec`/`runBatchSuite` are both supplied — an
63
63
  * engine missing either never dispatches a `ready` batch (it stays queued).
64
64
  */
65
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
66
- if (k2 === undefined) k2 = k;
67
- var desc = Object.getOwnPropertyDescriptor(m, k);
68
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
69
- desc = { enumerable: true, get: function() { return m[k]; } };
70
- }
71
- Object.defineProperty(o, k2, desc);
72
- }) : (function(o, m, k, k2) {
73
- if (k2 === undefined) k2 = k;
74
- o[k2] = m[k];
75
- }));
76
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
77
- Object.defineProperty(o, "default", { enumerable: true, value: v });
78
- }) : function(o, v) {
79
- o["default"] = v;
80
- });
81
- var __importStar = (this && this.__importStar) || (function () {
82
- var ownKeys = function(o) {
83
- ownKeys = Object.getOwnPropertyNames || function (o) {
84
- var ar = [];
85
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
86
- return ar;
87
- };
88
- return ownKeys(o);
89
- };
90
- return function (mod) {
91
- if (mod && mod.__esModule) return mod;
92
- var result = {};
93
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
94
- __setModuleDefault(result, mod);
95
- return result;
96
- };
97
- })();
98
65
  Object.defineProperty(exports, "__esModule", { value: true });
99
66
  exports.tick = tick;
100
67
  exports.runLoop = runLoop;
101
- const path = __importStar(require("node:path"));
102
68
  const batch_dispatch_1 = require("./batch-dispatch");
103
69
  const dispatch_1 = require("./dispatch");
104
70
  const groundtruth_1 = require("./groundtruth");
105
71
  const journal_1 = require("./journal");
72
+ const run_log_1 = require("./run-log");
106
73
  const scheduler_1 = require("./scheduler");
107
74
  const state_1 = require("./state");
108
75
  const teardown_1 = require("./teardown");
@@ -154,15 +121,46 @@ function patchSlot(state, slotId, patch, now) {
154
121
  slots: state.slots.map((s) => s.id === slotId ? { ...s, ...patch, updated_at: now.toISOString() } : s),
155
122
  };
156
123
  }
157
- /** Walk a slot to `idle` one declared edge per iteration; `step` picks the next status. */
124
+ /**
125
+ * Walk a slot to `idle` one declared edge per iteration; `step` picks the
126
+ * next status. Returns the released slot id — non-null only when the walk
127
+ * actually emptied a held slot, never for a slot that was already idle or
128
+ * held no unit. Journals nothing itself (#525): each caller journals its own
129
+ * cause event first, then `slot-released`, so the trail reads cause-then-
130
+ * release rather than the reverse.
131
+ *
132
+ * Bounded at 8 iterations — mirroring `batch-dispatch.ts`'s `releaseSlot` —
133
+ * though the longest real walk (`running` → `exited` → `verifying` →
134
+ * `complete` → `idle`, or `recovering` → `failed` → `idle`) is 4 hops. A
135
+ * non-converging `step` leaves the slot on whatever status it last reached
136
+ * rather than spinning forever inside the state lock; `releasedSlotId` stays
137
+ * null in that case, so no `slot-released` is journaled for a release that
138
+ * did not actually happen.
139
+ */
158
140
  function walkSlotToIdle(state, unit, now, step) {
159
141
  let next = state;
160
142
  let slot = slotOf(next, unit);
161
- while (slot && slot.status !== 'idle') {
143
+ if (!slot || slot.status === 'idle')
144
+ return { state: next, releasedSlotId: null };
145
+ const slotId = slot.id;
146
+ // Look the slot back up by id, not by `unit`, on every iteration: the
147
+ // `idle` transition clears `unit` (CLEARED_SLOT_FIELDS), so `slotOf(next,
148
+ // unit)` can no longer find it the instant it actually empties.
149
+ for (let i = 0; i < 8 && slot && slot.status !== 'idle'; i++) {
162
150
  next = (0, state_1.transitionSlot)(next, slot.id, step(slot.status), {}, now);
163
- slot = slotOf(next, unit);
151
+ slot = next.slots.find((s) => s.id === slotId);
152
+ }
153
+ return { state: next, releasedSlotId: slot?.status === 'idle' ? slotId : null };
154
+ }
155
+ /**
156
+ * Journal `slot-released` (#525) when `walkSlotToIdle` actually freed a
157
+ * slot. Callers invoke this AFTER journaling their own cause event, so the
158
+ * trail reads cause-then-release, never the reverse.
159
+ */
160
+ function journalSlotReleased(ctx, unit, releasedSlotId, reason) {
161
+ if (releasedSlotId !== null) {
162
+ journal(ctx, 'slot-released', unit, { slot: releasedSlotId, reason });
164
163
  }
165
- return next;
166
164
  }
167
165
  /** Kill the agent holding `unit`'s slot, if it is alive. */
168
166
  function killUnitAgent(ctx, state, unit) {
@@ -274,7 +272,12 @@ function pollParkedPrs(deps, state, dispatch) {
274
272
  * in tier, prompt, phase, and failure opts.
275
273
  */
276
274
  function spawnAndRecord(ctx, state, unit, slot, opts) {
277
- const logFile = path.join(ctx.deps.store.runsDir, `${(0, dispatch_1.unitLogName)(unit)}.log`);
275
+ const logFile = (0, dispatch_1.dispatchLogPath)(ctx.deps.store.runsDir, unit);
276
+ // #524: the log is per-unit and opened in append mode (createSpawnDeps), so
277
+ // a redispatch's output lands after any prior dispatch's in the SAME file.
278
+ // Captured BEFORE spawning — the size at this instant is exactly where
279
+ // THIS dispatch's own output will start.
280
+ const logOffset = (0, dispatch_1.fileSizeOrZero)(logFile);
278
281
  let pid;
279
282
  try {
280
283
  pid = ctx.deps.spawnDeps.spawn(opts.cmd, opts.prompt, logFile);
@@ -288,6 +291,11 @@ function spawnAndRecord(ctx, state, unit, slot, opts) {
288
291
  pid_start: ctx.deps.spawnDeps.processStart(pid),
289
292
  phase: opts.phase,
290
293
  last_progress_at: now.toISOString(),
294
+ // #524: distinct from last_progress_at, which later progress signals
295
+ // overwrite — this is the one field that answers "when did THIS dispatch
296
+ // start", the anchor `runs.jsonl`'s duration_ms is measured from.
297
+ spawned_at: now.toISOString(),
298
+ log_offset_at_spawn: logOffset,
291
299
  };
292
300
  const next = slot.status === 'assigned' || slot.status === 'recovering'
293
301
  ? (0, state_1.transitionSlot)(state, slot.id, 'running', patch, now)
@@ -298,6 +306,10 @@ function spawnAndRecord(ctx, state, unit, slot, opts) {
298
306
  slot: slot.id,
299
307
  cmd: opts.cmd.join(' '),
300
308
  log: logFile,
309
+ // #524: which byte of the append-mode per-unit log this dispatch starts
310
+ // at — without it, mapping a log slice to this dispatch needs state.json,
311
+ // and `CLEARED_SLOT_FIELDS` nulls the field when the slot is released.
312
+ log_offset: logOffset,
301
313
  ...(opts.journalExtra ?? {}),
302
314
  });
303
315
  ctx.result.spawned.push(unit);
@@ -380,13 +392,16 @@ function failUnit(ctx, state, unit, reason, opts = {}) {
380
392
  return state;
381
393
  const now = ctx.deps.now();
382
394
  killUnitAgent(ctx, state, unit);
383
- let next = releaseSlotViaFailure(ctx, state, unit);
395
+ const released = releaseSlotViaFailure(state, unit, now);
396
+ let next = released.state;
397
+ let releaseReason = 'unit-failed';
384
398
  const entry = (0, state_1.findEntry)(next, issue);
385
399
  if (entry && !types_1.TERMINAL_ISSUE_STATUSES.has(entry.status)) {
386
400
  ctx.result.failed.push(unit);
387
401
  if (opts.merged === true && entry.status === 'shipped') {
388
402
  next = (0, state_1.transitionIssue)(next, issue, 'done', { reason }, now);
389
403
  journal(ctx, 'report-failed', unit, { reason });
404
+ releaseReason = 'report-failed';
390
405
  }
391
406
  else {
392
407
  next = (0, state_1.transitionIssue)(next, issue, 'failed', { reason }, now);
@@ -396,11 +411,12 @@ function failUnit(ctx, state, unit, reason, opts = {}) {
396
411
  ctx.result.blocked.push(...blocked.issues);
397
412
  }
398
413
  }
414
+ journalSlotReleased(ctx, unit, released.releasedSlotId, releaseReason);
399
415
  return next;
400
416
  }
401
417
  /** Release a unit's slot to idle through the failure rail (failed → idle). */
402
- function releaseSlotViaFailure(ctx, state, unit) {
403
- return walkSlotToIdle(state, unit, ctx.deps.now(), (status) => status === 'complete' || status === 'failed' ? 'idle' : 'failed');
418
+ function releaseSlotViaFailure(state, unit, now) {
419
+ return walkSlotToIdle(state, unit, now, (status) => status === 'complete' || status === 'failed' ? 'idle' : 'failed');
404
420
  }
405
421
  /** Block every entry that transitively depends on `failedIssue` (AC4). */
406
422
  function blockTransitiveDependents(ctx, state, failedIssue) {
@@ -437,10 +453,18 @@ function blockTransitiveDependents(ctx, state, failedIssue) {
437
453
  }
438
454
  // A dependent mid-run is working toward a doomed merge — release its slot.
439
455
  const unit = `issue:${issue}`;
456
+ const slot = slotOf(next, unit);
440
457
  killUnitAgent(ctx, next, unit);
441
- next = releaseSlotViaFailure(ctx, next, unit);
458
+ // #524: this agent was live and never recorded — same reasoning as the
459
+ // stall/external-advance kills. Runs BEFORE the release, since
460
+ // `recordDispatchRunLog`'s guard requires the slot still be `running`.
461
+ if (slot)
462
+ recordDispatchRunLog(ctx, next, slot, unit);
463
+ const released = releaseSlotViaFailure(next, unit, now);
464
+ next = released.state;
442
465
  next = (0, state_1.transitionIssue)(next, issue, 'blocked', { reason }, now);
443
466
  journal(ctx, 'dependents-blocked', unit, { reason });
467
+ journalSlotReleased(ctx, unit, released.releasedSlotId, 'dependents-blocked');
444
468
  blockedIssues.push(issue);
445
469
  }
446
470
  return { state: next, issues: blockedIssues };
@@ -526,6 +550,14 @@ function enterRecovery(ctx, state, unit, causeEvent, cause, truth, evidence = {}
526
550
  if (!entry || !slot)
527
551
  return state;
528
552
  killUnitAgent(ctx, state, unit);
553
+ // #524: only the STALL path kills a still-live, not-yet-recorded agent —
554
+ // `causeEvent === 'verify-incomplete'` arrives from `completeUnitOrRecover`
555
+ // AFTER the agent's exit was already detected and recorded by the dead-pid
556
+ // branch of `reconcileRunning`; recording again here would double-count
557
+ // that same dispatch.
558
+ if (causeEvent === 'stalled') {
559
+ recordDispatchRunLog(ctx, state, slot, unit);
560
+ }
529
561
  const report = (0, state_1.isReportSlot)(slot);
530
562
  const nextTier = report ? (0, dispatch_1.reportTierFor)(slot.recoveries + 1) : (0, dispatch_1.escalateTier)(entry.tier);
531
563
  if (slot.recoveries >= types_1.ESCALATION_CAP || nextTier === null) {
@@ -593,7 +625,7 @@ function completeUnit(ctx, state, unit, via) {
593
625
  if (issue === null)
594
626
  return state;
595
627
  const now = ctx.deps.now();
596
- const next = walkSlotToIdle(state, unit, now, stepVerifiedExitToIdle);
628
+ const { state: next, releasedSlotId } = walkSlotToIdle(state, unit, now, stepVerifiedExitToIdle);
597
629
  let withEntry = next;
598
630
  const entry = (0, state_1.findEntry)(next, issue);
599
631
  if (entry && entry.status === 'dispatched') {
@@ -609,6 +641,7 @@ function completeUnit(ctx, state, unit, via) {
609
641
  ctx.result.externalAdvances.push(unit);
610
642
  else
611
643
  ctx.result.completed.push(unit);
644
+ journalSlotReleased(ctx, unit, releasedSlotId, via);
612
645
  return withEntry;
613
646
  }
614
647
  /**
@@ -625,10 +658,12 @@ function parkUnit(ctx, state, unit, milestone) {
625
658
  const pr = (0, groundtruth_1.prOfMilestone)(milestone);
626
659
  if (pr === null)
627
660
  return state; // isParkedMilestone guarantees this
628
- let next = walkSlotToIdle(state, unit, now, stepVerifiedExitToIdle);
661
+ const walked = walkSlotToIdle(state, unit, now, stepVerifiedExitToIdle);
662
+ let next = walked.state;
629
663
  next = (0, state_1.transitionIssue)(next, issue, 'parked', { pr }, now);
630
664
  journal(ctx, 'pr-parked', unit, { pr });
631
665
  ctx.result.parked.push(unit);
666
+ journalSlotReleased(ctx, unit, walked.releasedSlotId, 'parked');
632
667
  return next;
633
668
  }
634
669
  // --- Per-slot reconciliation ---
@@ -687,6 +722,106 @@ function applyProgressSignals(ctx, state, slot, truth, unit) {
687
722
  function effectiveClosedSignal(slot, truth) {
688
723
  return (0, state_1.isReportSlot)(slot) ? false : truth.closed;
689
724
  }
725
+ /**
726
+ * Append this dispatch's `runs.jsonl` entry (#524) — one per completed
727
+ * spawn, not per unit: a redispatch/takeover produces another entry, each
728
+ * with its own tokens/duration, never an update to the first. Called from
729
+ * every place a dispatch ends: `reconcileRunning`'s dead-pid branch (the
730
+ * agent exited on its own), its external-advance branch (ground truth says
731
+ * done while the agent was still alive and had to be killed), the
732
+ * stall-timeout kill in `enterRecovery`, and the dependents-blocked kill in
733
+ * `blockTransitiveDependents`.
734
+ *
735
+ * Exactly-once per dispatch is enforced by the guard below (slot still
736
+ * `running` and actually spawned), not by the call sites' ordering — two of
737
+ * the four reach slots in any non-idle status.
738
+ */
739
+ function recordDispatchRunLog(ctx, state, slot, unit) {
740
+ // Enforce the once-per-dispatch invariant HERE rather than restating it in
741
+ // prose at four call sites (#524 review). `blockTransitiveDependents` and
742
+ // `enterRecovery` reach slots in any non-idle status: a slot already moved
743
+ // to `exited`/`verifying` was recorded on the way out, and re-recording it
744
+ // would append a SECOND entry over the same log slice — doubling that
745
+ // issue's tokens in `sched stats`, the exact number-fabrication this work
746
+ // exists to eliminate. A slot that never spawned (`assigned`/`starting`,
747
+ // `spawned_at` still null) is worse: it would read from offset 0 and
748
+ // re-attribute every prior dispatch's tokens to a phantom run.
749
+ if (slot.status !== 'running' || slot.spawned_at === null) {
750
+ journal(ctx, 'run-log-skipped', unit, {
751
+ reason: slot.spawned_at === null ? 'never-spawned' : `already-recorded-${slot.status}`,
752
+ slot: slot.id,
753
+ });
754
+ return;
755
+ }
756
+ const issue = (0, journal_1.issueOfUnit)(unit);
757
+ const entry = issue === null ? undefined : (0, state_1.findEntry)(state, issue);
758
+ if (issue === null || !entry) {
759
+ // Left the queue already, or a batch unit (#464 non-goal: only issue:<n>
760
+ // units are dispatched) — nothing to attribute the run to. Journaled so
761
+ // an operator sees WHY a dispatch produced no runs.jsonl entry, rather
762
+ // than a silent gap next to `exit-detected`.
763
+ journal(ctx, 'run-log-skipped', unit, {
764
+ reason: issue === null ? 'not-an-issue-unit' : 'entry-gone',
765
+ });
766
+ return;
767
+ }
768
+ // Report slots ride the same tier the cycle escalation ladder set at
769
+ // dispatch time, EXCEPT `entry.tier` is deliberately not updated for a
770
+ // report redispatch (`enterRecovery`'s `if (!report)` guard) — mirror the
771
+ // spawn-side branch (`spawnReportAgent`) or a report slot's tier/model
772
+ // here would silently disagree with what was actually spawned.
773
+ const tier = (0, state_1.isReportSlot)(slot) ? ((0, dispatch_1.reportTierFor)(slot.recoveries) ?? entry.tier) : entry.tier;
774
+ const cmd = (0, dispatch_1.buildAgentCommand)(ctx.dispatch.command, tier, issue, ctx.dispatch.tierModels);
775
+ const logFile = (0, dispatch_1.dispatchLogPath)(ctx.deps.store.runsDir, unit);
776
+ // #524: read only THIS dispatch's slice — the log is per-unit and
777
+ // append-mode, so the whole file would include every prior dispatch's
778
+ // output too (claude: unparseable JSON concatenation; opencode: summed
779
+ // tokens double-counted).
780
+ const offset = slot.log_offset_at_spawn ?? 0;
781
+ const logContent = (0, run_log_1.readDispatchLog)(logFile, offset);
782
+ const runLogFile = (0, run_log_1.schedRunsLogPath)(ctx.deps.homeDir);
783
+ const runEntry = (0, run_log_1.buildSchedRunLogEntry)({
784
+ unit,
785
+ role: slot.role,
786
+ cmd0: ctx.dispatch.command[0],
787
+ cmd,
788
+ logContent,
789
+ spawnedAt: slot.spawned_at,
790
+ completedAt: ctx.deps.now(),
791
+ configuredModel: ctx.dispatch.tierModels[tier],
792
+ cwd: ctx.deps.repoDir,
793
+ });
794
+ // An entry with null tokens has four possible causes that look identical in
795
+ // `sched stats` (a row of dashes). Journal WHICH one, so an operator can
796
+ // tell "the agent wrote nothing" from "we couldn't read the log" without
797
+ // re-deriving it from the log file's mtime.
798
+ if (runEntry.input_tokens === null && runEntry.output_tokens === null) {
799
+ journal(ctx, 'run-log-no-usage', unit, {
800
+ log: logFile,
801
+ offset,
802
+ bytes: logContent === null ? null : logContent.length,
803
+ reason: logContent === null
804
+ ? 'log-unreadable'
805
+ : logContent.trim() === ''
806
+ ? 'log-empty'
807
+ : 'no-usage-events',
808
+ });
809
+ }
810
+ if (!(0, run_log_1.schedTelemetryEnabled)(ctx.deps.homeDir)) {
811
+ // The operator opted out. Journal it: otherwise a missing runs.jsonl entry
812
+ // is indistinguishable from a lost one.
813
+ journal(ctx, 'run-log-skipped', unit, { reason: 'telemetry-disabled' });
814
+ return;
815
+ }
816
+ const written = (0, run_log_1.appendSchedRunLog)(runEntry, ctx.deps.homeDir, (err) => journal(ctx, 'run-log-failed', unit, { detail: err.message, file: runLogFile }));
817
+ if (written) {
818
+ journal(ctx, 'run-log-recorded', unit, {
819
+ file: runLogFile,
820
+ input_tokens: runEntry.input_tokens,
821
+ output_tokens: runEntry.output_tokens,
822
+ });
823
+ }
824
+ }
690
825
  /** Reconcile one running slot against its polled ground truth. */
691
826
  function reconcileRunning(ctx, state, slot, truth, unit) {
692
827
  const now = ctx.deps.now();
@@ -694,6 +829,7 @@ function reconcileRunning(ctx, state, slot, truth, unit) {
694
829
  // is DETECTED, never trusted as completion (AC2/AC3).
695
830
  if (slot.pid !== null && !ctx.deps.spawnDeps.isAlive(slot.pid, slot.pid_start ?? undefined)) {
696
831
  journal(ctx, 'exit-detected', unit, { pid: slot.pid, slot: slot.id });
832
+ recordDispatchRunLog(ctx, state, slot, unit);
697
833
  const exited = (0, state_1.transitionSlot)(state, slot.id, 'exited', {}, now);
698
834
  return completeUnitOrRecover(ctx, exited, unit, truth, 'verify-complete');
699
835
  }
@@ -726,6 +862,10 @@ function reconcileRunning(ctx, state, slot, truth, unit) {
726
862
  : `report done (role=${slot.role})`,
727
863
  });
728
864
  killUnitAgent(ctx, state, unit);
865
+ // The agent was still alive (that's what "externally-advanced" means) —
866
+ // log it here too, or an external-advance dispatch would never get a
867
+ // runs.jsonl entry at all (it never takes the dead-pid branch above).
868
+ recordDispatchRunLog(ctx, state, slot, unit);
729
869
  const exited = (0, state_1.transitionSlot)(state, slot.id, 'exited', {}, now);
730
870
  return completeUnitOrRecover(ctx, exited, unit, truth, 'external-advance');
731
871
  }