@ai-dossier/sched 0.2.1 → 0.4.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.
Files changed (57) hide show
  1. package/README.md +179 -17
  2. package/dist/attribution.d.ts +132 -0
  3. package/dist/attribution.d.ts.map +1 -0
  4. package/dist/attribution.js +268 -0
  5. package/dist/attribution.js.map +1 -0
  6. package/dist/bisect.d.ts +67 -0
  7. package/dist/bisect.d.ts.map +1 -0
  8. package/dist/bisect.js +122 -0
  9. package/dist/bisect.js.map +1 -0
  10. package/dist/dispatch.d.ts +48 -1
  11. package/dist/dispatch.d.ts.map +1 -1
  12. package/dist/dispatch.js +92 -5
  13. package/dist/dispatch.js.map +1 -1
  14. package/dist/engine.d.ts +53 -13
  15. package/dist/engine.d.ts.map +1 -1
  16. package/dist/engine.js +421 -75
  17. package/dist/engine.js.map +1 -1
  18. package/dist/enqueue.d.ts +9 -0
  19. package/dist/enqueue.d.ts.map +1 -1
  20. package/dist/enqueue.js +96 -12
  21. package/dist/enqueue.js.map +1 -1
  22. package/dist/groundtruth.d.ts +66 -5
  23. package/dist/groundtruth.d.ts.map +1 -1
  24. package/dist/groundtruth.js +150 -5
  25. package/dist/groundtruth.js.map +1 -1
  26. package/dist/index.d.ts +10 -6
  27. package/dist/index.d.ts.map +1 -1
  28. package/dist/index.js +51 -2
  29. package/dist/index.js.map +1 -1
  30. package/dist/persist.d.ts.map +1 -1
  31. package/dist/persist.js +14 -0
  32. package/dist/persist.js.map +1 -1
  33. package/dist/recovery.d.ts +263 -0
  34. package/dist/recovery.d.ts.map +1 -0
  35. package/dist/recovery.js +730 -0
  36. package/dist/recovery.js.map +1 -0
  37. package/dist/scheduler.d.ts +12 -0
  38. package/dist/scheduler.d.ts.map +1 -1
  39. package/dist/scheduler.js +53 -58
  40. package/dist/scheduler.js.map +1 -1
  41. package/dist/state.d.ts +57 -4
  42. package/dist/state.d.ts.map +1 -1
  43. package/dist/state.js +238 -8
  44. package/dist/state.js.map +1 -1
  45. package/dist/status.d.ts +16 -4
  46. package/dist/status.d.ts.map +1 -1
  47. package/dist/status.js +10 -4
  48. package/dist/status.js.map +1 -1
  49. package/dist/teardown.d.ts +57 -0
  50. package/dist/teardown.d.ts.map +1 -0
  51. package/dist/teardown.js +242 -0
  52. package/dist/teardown.js.map +1 -0
  53. package/dist/types.d.ts +155 -4
  54. package/dist/types.d.ts.map +1 -1
  55. package/dist/types.js +39 -5
  56. package/dist/types.js.map +1 -1
  57. package/package.json +2 -2
@@ -0,0 +1,242 @@
1
+ "use strict";
2
+ /**
3
+ * Script-based teardown for merged units (#468 AC2) — the tail work that the
4
+ * fleet pattern used to re-dispatch a whole full-cycle run for.
5
+ *
6
+ * Two scripts, chosen by the run's `setup` milestone:
7
+ * - pool-claimed worktree → `worktree-pool return --path <wt> --json` — the
8
+ * pool's own self-check (#453: `verification.entry_status`) is the
9
+ * verification; a non-`warm` entry or a failed exit is a failed step.
10
+ * - cold worktree → `git worktree remove --force <wt>` + a path-gone check
11
+ * (verify-first, so a re-run after a crash between subprocess and state
12
+ * write is idempotent).
13
+ *
14
+ * `--force` on the remove is deliberate: the WIP-sync rule pushes everything
15
+ * durable to origin, so untracked leftovers (logs, warmup status) are trash.
16
+ *
17
+ * A failed teardown is DEGRADATION, never unit failure — the PR is already
18
+ * merged. The outcome is recorded as `cleanup=failed-<step>` on the entry and
19
+ * journaled, and the report agent is dispatched regardless so the failure is
20
+ * surfaced in the report.
21
+ *
22
+ * Everything runs through an injectable `ExecFn` (the project.ts pattern) —
23
+ * tests script the subprocesses, no real pool or git is touched.
24
+ */
25
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
26
+ if (k2 === undefined) k2 = k;
27
+ var desc = Object.getOwnPropertyDescriptor(m, k);
28
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
29
+ desc = { enumerable: true, get: function() { return m[k]; } };
30
+ }
31
+ Object.defineProperty(o, k2, desc);
32
+ }) : (function(o, m, k, k2) {
33
+ if (k2 === undefined) k2 = k;
34
+ o[k2] = m[k];
35
+ }));
36
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
37
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
38
+ }) : function(o, v) {
39
+ o["default"] = v;
40
+ });
41
+ var __importStar = (this && this.__importStar) || (function () {
42
+ var ownKeys = function(o) {
43
+ ownKeys = Object.getOwnPropertyNames || function (o) {
44
+ var ar = [];
45
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
46
+ return ar;
47
+ };
48
+ return ownKeys(o);
49
+ };
50
+ return function (mod) {
51
+ if (mod && mod.__esModule) return mod;
52
+ var result = {};
53
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
54
+ __setModuleDefault(result, mod);
55
+ return result;
56
+ };
57
+ })();
58
+ Object.defineProperty(exports, "__esModule", { value: true });
59
+ exports.TEARDOWN_TIMEOUT_MS = void 0;
60
+ exports.isSafeWorktree = isSafeWorktree;
61
+ exports.runTeardown = runTeardown;
62
+ const fs = __importStar(require("node:fs"));
63
+ const path = __importStar(require("node:path"));
64
+ /** Timeout for teardown subprocesses — pool return shells out through npx and recycles a worktree (git ops), which is slow. */
65
+ exports.TEARDOWN_TIMEOUT_MS = 120_000;
66
+ /**
67
+ * Pool CLI invocation. Requires ≥0.6.0 — `status --json`, `return --json`,
68
+ * and the `verification.entry_status` self-check (#453) all landed there, so
69
+ * `^0.5.1` (which resolves to ≤0.5.3) cannot ever satisfy the JSON contract
70
+ * and every pool teardown would record `failed-pool-return`. Versions ≤0.5.0
71
+ * additionally carry the data-loss `gc` bug — never pin lower.
72
+ */
73
+ const POOL_BIN = 'npx';
74
+ const POOL_ARGS_PREFIX = ['-y', '@ai-dossier/worktree-pool@^0.6.0'];
75
+ /**
76
+ * Containment check for a worktree path recovered from an issue comment
77
+ * (#468): the path must be absolute and fully resolved (no `..`/`.`/symlink
78
+ * variance), and — for COLD worktrees — live under one of the two worktree
79
+ * roots this project uses: `<repo>/worktrees/` (setup-issue-workflow's
80
+ * inside-repo convention) or `<repo>/../worktrees/` (the AGENTS.md sibling
81
+ * convention). A crafted milestone can otherwise make the scheduler
82
+ * `git worktree remove --force` ANY registered worktree — including a
83
+ * parallel agent's (CWE-22). Pool-claimed worktrees are validated by the
84
+ * pool itself (return only accepts paths in pool state), so containment
85
+ * applies to the cold path only.
86
+ */
87
+ function isSafeWorktree(repoRoot, worktree) {
88
+ if (worktree.includes('\0'))
89
+ return false;
90
+ if (!path.isAbsolute(worktree))
91
+ return false;
92
+ if (path.resolve(worktree) !== worktree)
93
+ return false;
94
+ const roots = [path.resolve(repoRoot, 'worktrees'), path.resolve(repoRoot, '..', 'worktrees')];
95
+ return roots.some((root) => worktree.startsWith(root + path.sep));
96
+ }
97
+ /** The repo's toplevel directory (containment root), or null when git cannot say. */
98
+ function repoToplevel(exec, repoDir) {
99
+ const out = exec('git', ['rev-parse', '--show-toplevel'], repoDir);
100
+ return out !== null && path.isAbsolute(out) ? path.resolve(out) : null;
101
+ }
102
+ /** Path-listing of `git worktree list --porcelain` (null when the call fails). */
103
+ function worktreeList(exec, repoDir) {
104
+ return exec('git', ['worktree', 'list', '--porcelain'], repoDir);
105
+ }
106
+ /** Whether `worktree` still appears in git's worktree listing. */
107
+ function listedAsWorktree(exec, repoDir, worktree) {
108
+ const list = worktreeList(exec, repoDir);
109
+ if (list === null)
110
+ return true; // unknown — assume still present (conservative)
111
+ return list
112
+ .split('\n')
113
+ .some((line) => line.startsWith('worktree ') && line.slice('worktree '.length) === worktree);
114
+ }
115
+ /**
116
+ * Run the teardown script for one merged unit. `info` comes from the unit's
117
+ * setup milestone (groundtruth.setupInfo); a missing `info` is the caller's
118
+ * `failed-missing-setup-info` case — this function always has one.
119
+ */
120
+ function runTeardown(exec, repoDir, info, fsExists = (p) => {
121
+ try {
122
+ return fs.existsSync(p);
123
+ }
124
+ catch {
125
+ return false;
126
+ }
127
+ }) {
128
+ // The worktree path originates from an issue comment written by the spawned
129
+ // agent — validate it before any destructive subprocess (CWE-22).
130
+ if (info.worktree.includes('\0') || !path.isAbsolute(info.worktree)) {
131
+ return {
132
+ cleanup: 'failed-invalid-worktree',
133
+ detail: `worktree path rejected (must be absolute): ${info.worktree}`,
134
+ };
135
+ }
136
+ if (info.poolClaimed) {
137
+ // Pool membership is validated by the pool's own `return` (it only
138
+ // accepts paths in pool state) — no local containment root applies.
139
+ return poolReturn(exec, repoDir, info.worktree);
140
+ }
141
+ const root = repoToplevel(exec, repoDir) ?? path.resolve(repoDir);
142
+ if (!isSafeWorktree(root, info.worktree)) {
143
+ return {
144
+ cleanup: 'failed-invalid-worktree',
145
+ detail: `worktree path rejected (must be a resolved path under the repo's worktrees root ${path.join(root, 'worktrees')}): ${info.worktree}`,
146
+ };
147
+ }
148
+ return worktreeRemove(exec, repoDir, info.worktree, fsExists);
149
+ }
150
+ function poolReturn(exec, repoDir, worktree) {
151
+ // Verify-first idempotency: if the pool already lists this path as a warm
152
+ // (unassigned) spare, a previous return landed and the state write was
153
+ // lost — claim done rather than erroring a second return.
154
+ const statusJson = exec(POOL_BIN, [...POOL_ARGS_PREFIX, 'status', '--json'], repoDir);
155
+ if (statusJson !== null && poolEntryFor(statusJson, worktree) === 'warm') {
156
+ return { cleanup: 'done', detail: 'already returned to pool (idempotent re-run)' };
157
+ }
158
+ const out = exec(POOL_BIN, [...POOL_ARGS_PREFIX, 'return', '--path', worktree, '--json'], repoDir);
159
+ if (out === null) {
160
+ return {
161
+ cleanup: 'failed-pool-return',
162
+ detail: 'worktree-pool return failed (non-zero exit, timeout, or npx unavailable) — entry left unverified; inspect `worktree-pool status`',
163
+ };
164
+ }
165
+ // Verified before claimed: the pool's own self-check must report the
166
+ // recycled entry as `warm` — anything else is a failed step.
167
+ const entryStatus = parseReturnVerification(out);
168
+ if (entryStatus === null) {
169
+ return {
170
+ cleanup: 'failed-pool-return',
171
+ detail: 'worktree-pool return produced unparseable output',
172
+ };
173
+ }
174
+ if (entryStatus !== 'warm') {
175
+ return {
176
+ cleanup: 'failed-pool-return',
177
+ detail: `pool self-check reports entry_status=${entryStatus}`,
178
+ };
179
+ }
180
+ return { cleanup: 'done', detail: 'returned to pool as a warm spare' };
181
+ }
182
+ function worktreeRemove(exec, repoDir, worktree, fsExists) {
183
+ // Verify-first idempotency: already gone → a previous remove landed.
184
+ if (!fsExists(worktree) && !listedAsWorktree(exec, repoDir, worktree)) {
185
+ return { cleanup: 'done', detail: 'worktree already removed (idempotent re-run)' };
186
+ }
187
+ const out = exec('git', ['worktree', 'remove', '--force', '--', worktree], repoDir);
188
+ if (out === null) {
189
+ return {
190
+ cleanup: 'failed-worktree-remove',
191
+ detail: 'git worktree remove failed (non-zero exit or timeout)',
192
+ };
193
+ }
194
+ // Verified before claimed: the path must be gone AND git must no longer
195
+ // list it — a lingering entry means the removal did not fully land.
196
+ if (fsExists(worktree) || listedAsWorktree(exec, repoDir, worktree)) {
197
+ return {
198
+ cleanup: 'failed-worktree-remove',
199
+ detail: 'worktree still present after git worktree remove',
200
+ };
201
+ }
202
+ return { cleanup: 'done', detail: 'worktree removed' };
203
+ }
204
+ /** The pool entry status (`warm`/`assigned`/…) for `worktree`, or null when absent/unparseable. */
205
+ function poolEntryFor(statusJson, worktree) {
206
+ try {
207
+ const parsed = JSON.parse(statusJson);
208
+ if (parsed === null || typeof parsed !== 'object')
209
+ return null;
210
+ const worktrees = parsed.worktrees;
211
+ if (!Array.isArray(worktrees))
212
+ return null;
213
+ for (const raw of worktrees) {
214
+ if (raw === null || typeof raw !== 'object')
215
+ continue;
216
+ const entry = raw;
217
+ if (entry.path === worktree && typeof entry.status === 'string')
218
+ return entry.status;
219
+ }
220
+ return null;
221
+ }
222
+ catch {
223
+ return null;
224
+ }
225
+ }
226
+ /** `verification.entry_status` of a successful `return --json`, or null when unparseable. */
227
+ function parseReturnVerification(returnJson) {
228
+ try {
229
+ const parsed = JSON.parse(returnJson);
230
+ if (parsed === null || typeof parsed !== 'object')
231
+ return null;
232
+ const verification = parsed.verification;
233
+ if (verification === null || typeof verification !== 'object')
234
+ return null;
235
+ const status = verification.entry_status;
236
+ return typeof status === 'string' ? status : null;
237
+ }
238
+ catch {
239
+ return null;
240
+ }
241
+ }
242
+ //# sourceMappingURL=teardown.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"teardown.js","sourceRoot":"","sources":["../src/teardown.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4CH,wCAMC;AA2BD,kCAiCC;AA5GD,4CAA8B;AAC9B,gDAAkC;AAKlC,+HAA+H;AAClH,QAAA,mBAAmB,GAAG,OAAO,CAAC;AAE3C;;;;;;GAMG;AACH,MAAM,QAAQ,GAAG,KAAK,CAAC;AACvB,MAAM,gBAAgB,GAAG,CAAC,IAAI,EAAE,kCAAkC,CAAC,CAAC;AAapE;;;;;;;;;;;GAWG;AACH,SAAgB,cAAc,CAAC,QAAgB,EAAE,QAAgB;IAC/D,IAAI,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC;QAAE,OAAO,KAAK,CAAC;IAC1C,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC;QAAE,OAAO,KAAK,CAAC;IAC7C,IAAI,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IACtD,MAAM,KAAK,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,WAAW,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,IAAI,EAAE,WAAW,CAAC,CAAC,CAAC;IAC/F,OAAO,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI,GAAG,IAAI,CAAC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AAC;QACH,MAAM,MAAM,GAAY,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;QAC/C,IAAI,MAAM,KAAK,IAAI,IAAI,OAAO,MAAM,KAAK,QAAQ;YAAE,OAAO,IAAI,CAAC;QAC/D,MAAM,YAAY,GAAI,MAAqC,CAAC,YAAY,CAAC;QACzE,IAAI,YAAY,KAAK,IAAI,IAAI,OAAO,YAAY,KAAK,QAAQ;YAAE,OAAO,IAAI,CAAC;QAC3E,MAAM,MAAM,GAAI,YAA2C,CAAC,YAAY,CAAC;QACzE,OAAO,OAAO,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC;IACpD,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC"}
package/dist/types.d.ts CHANGED
@@ -17,6 +17,8 @@ export type ModelTier = 'mechanical' | 'mid' | 'strong';
17
17
  * ```
18
18
  * queued → classified{full|slot}
19
19
  * full: → dispatched → (full-cycle's own phase trail) → shipped → done
20
+ * #468 detached ship: dispatched → parked{pr} (PR on auto-merge;
21
+ * the watcher owns the merge wait) → shipped → done
20
22
  * slot: → batched(b) → waiting → in-work → committed(range) → validated
21
23
  * → shipped-in-batch → done
22
24
  * failure edges (any state):
@@ -24,7 +26,7 @@ export type ModelTier = 'mechanical' | 'mid' | 'strong';
24
26
  * any → blocked(dep-failed) | decision-pending | failed(escalation-cap)
25
27
  * ```
26
28
  */
27
- export type IssueStatus = 'queued' | 'classified' | 'dispatched' | 'shipped' | 'done' | 'batched' | 'waiting' | 'in-work' | 'committed' | 'validated' | 'shipped-in-batch' | 'evicted' | 'requeued' | 'blocked' | 'decision-pending' | 'failed';
29
+ export type IssueStatus = 'queued' | 'classified' | 'dispatched' | 'parked' | 'shipped' | 'done' | 'batched' | 'waiting' | 'in-work' | 'committed' | 'validated' | 'shipped-in-batch' | 'evicted' | 'requeued' | 'blocked' | 'decision-pending' | 'failed';
28
30
  /** Issue statuses that cannot transition further. */
29
31
  export declare const TERMINAL_ISSUE_STATUSES: ReadonlySet<IssueStatus>;
30
32
  /**
@@ -32,6 +34,54 @@ export declare const TERMINAL_ISSUE_STATUSES: ReadonlySet<IssueStatus>;
32
34
  * these: "an issue with an unmerged dependency is never runnable" (AC5).
33
35
  */
34
36
  export declare const SATISFIED_ISSUE_STATUSES: ReadonlySet<IssueStatus>;
37
+ /** Teardown outcome values (#468): verified cleanup or a failed step. */
38
+ export type CleanupStatus = 'done' | `failed-${string}`;
39
+ /**
40
+ * How a failing test was traced back to a member: by changed-path /
41
+ * focused-test overlap, by `git bisect` over the issue-boundary commits, or
42
+ * not at all (a blanket dissolve requeue attributes nothing).
43
+ */
44
+ export type AttributionMethod = 'overlap' | 'bisect' | 'none';
45
+ /**
46
+ * What an evicted member carries into its full-cycle requeue (RFC-0001 §F.9 —
47
+ * "requeue the member as full-cycle with its plan artifact + failure evidence
48
+ * attached"). The plan artifact already lives on the issue as its `plan:v1`
49
+ * comment, so the evidence records only what the batch run learned.
50
+ */
51
+ export interface FailureEvidence {
52
+ /** Batch the member was evicted from. */
53
+ batch: string;
54
+ /** Why it was evicted (`suite-red`, `revert-conflict`, `dissolve`, …). */
55
+ reason: string;
56
+ /** Failing test ids attributed to this member (empty for a blanket dissolve). */
57
+ failing_tests: string[];
58
+ /** How those tests were attributed. */
59
+ attribution: AttributionMethod;
60
+ /** Commits reverted out of the batch branch for this member. */
61
+ reverted_commits: string[];
62
+ at: string;
63
+ }
64
+ /**
65
+ * One eviction, kept on the batch for the batch report and as the classifier
66
+ * feedback signal (RFC-0001 §D.4 audit, AC5 "per-member outcome recorded").
67
+ */
68
+ export interface EvictionRecord {
69
+ issue: number;
70
+ reason: string;
71
+ attribution: AttributionMethod;
72
+ reverted_commits: string[];
73
+ /** Members evicted alongside it because they share an eviction group (§E.4). */
74
+ group: number[];
75
+ at: string;
76
+ }
77
+ /** The one bounded fix attempt a member gets before it is evicted (§F.2). */
78
+ export interface FixAttemptRecord {
79
+ issue: number;
80
+ tier: ModelTier;
81
+ /** `dispatched` while the fix agent runs; then the suite's verdict for that member. */
82
+ outcome: 'dispatched' | 'green' | 'red';
83
+ at: string;
84
+ }
35
85
  /**
36
86
  * Batch lifecycle per RFC-0001 §D.2:
37
87
  *
@@ -83,6 +133,23 @@ export interface QueueEntry {
83
133
  status: IssueStatus;
84
134
  /** Free-form reason attached to failure-edge transitions (evicted/blocked/failed). */
85
135
  reason: string | null;
136
+ /**
137
+ * PR number the unit parked on `auto-merge` (#468), from the ship phase's
138
+ * `awaiting-merge` milestone (`pr=` key). Set when the agent exits parked;
139
+ * drives the PR watcher until the merge is accepted.
140
+ */
141
+ pr: number | null;
142
+ /**
143
+ * Teardown outcome for a merged unit (#468): `done` or `failed-<step>`, or
144
+ * null while teardown is still pending. Recorded only after the cleanup
145
+ * was verified (pool return self-check / worktree path gone).
146
+ */
147
+ cleanup: CleanupStatus | null;
148
+ /**
149
+ * Why this entry was evicted from a batch, carried into its full-cycle
150
+ * requeue (#472). Null for every entry that never rode the eviction rail.
151
+ */
152
+ failure_evidence: FailureEvidence | null;
86
153
  enqueued_at: string;
87
154
  updated_at: string;
88
155
  }
@@ -95,6 +162,36 @@ export interface BatchEntry {
95
162
  base_branch: string;
96
163
  /** Index of the member currently in work, when status is `executing` (1-based member pointer). */
97
164
  executing_member: number;
165
+ /**
166
+ * The batch ANCHOR issue — where every batch milestone posts (#472 AC5).
167
+ * Null until batch-prep supplies one; recovery then journals the milestone it
168
+ * could not post, rather than guessing an issue to comment on.
169
+ */
170
+ anchor: number | null;
171
+ /**
172
+ * The batch working branch. Reserved for the batch-setup phase; nothing in
173
+ * this package writes it yet, and recovery only READS it — to refuse a rebase
174
+ * when the checkout is on some other branch.
175
+ */
176
+ branch: string | null;
177
+ /**
178
+ * runstate run id of the batch run (`r-<issue>-<hex>`), null until batch-setup
179
+ * mints it. `ai-dossier runstate post` REQUIRES a run id, so a batch without
180
+ * one cannot post milestones at all — recovery journals them instead.
181
+ */
182
+ run_id: string | null;
183
+ /**
184
+ * Members that must revert together when any one of them is evicted
185
+ * (RFC-0001 §E.4 eviction groups — e.g. a member built on another's API).
186
+ * Each inner array is one group; members in no group evict alone.
187
+ */
188
+ eviction_groups: number[][];
189
+ /** Eviction history, oldest first (§D.4 audit / AC5 feedback signal). */
190
+ evictions: EvictionRecord[];
191
+ /** Fix attempts, at most `MAX_FIX_ATTEMPTS_PER_MEMBER` per member (§F.2). */
192
+ fix_attempts: FixAttemptRecord[];
193
+ /** Rebases of the batch branch after a PR conflict (§F.9, capped at `MAX_REBASE_ATTEMPTS`). */
194
+ rebase_attempts: number;
98
195
  created_at: string;
99
196
  updated_at: string;
100
197
  }
@@ -136,6 +233,13 @@ export interface SchedState {
136
233
  slots: SlotEntry[];
137
234
  /** Monotonic counter for stable slot ids. */
138
235
  next_slot_id: number;
236
+ /**
237
+ * When the PR watcher last polled (#468) — parked PRs are polled every
238
+ * `pr_poll_interval_ms` (default 150 s). Polled on each reconcile tick
239
+ * when due (a `reconcile_interval_ms` longer than the interval slows the
240
+ * effective cadence); persisted so the cadence survives a sched restart.
241
+ */
242
+ last_pr_poll_at: string | null;
139
243
  }
140
244
  /** Durable intent, persisted separately in `config.json` (state.json is rebuildable hot truth). */
141
245
  export interface SchedConfig {
@@ -144,6 +248,11 @@ export interface SchedConfig {
144
248
  stall_timeout_ms?: number;
145
249
  /** Reconciliation tick interval in ms (default 60 000). */
146
250
  reconcile_interval_ms?: number;
251
+ /**
252
+ * Parked-PR poll interval in ms (#468, default 150 000 — "every 2–3 min").
253
+ * Checked on each reconcile tick when due; see `SchedState.last_pr_poll_at`.
254
+ */
255
+ pr_poll_interval_ms?: number;
147
256
  /** Agent dispatch settings (#464); every field optional with engine defaults. */
148
257
  dispatch?: DispatchConfig;
149
258
  }
@@ -159,19 +268,60 @@ export interface DispatchConfig {
159
268
  prompt?: string;
160
269
  /** Tier → model id/alias mapping (defaults: haiku / sonnet / opus). */
161
270
  tier_models?: Partial<Record<ModelTier, string>>;
271
+ /**
272
+ * Prompt template for the report agent dispatched after a merged PR
273
+ * (#468); `{issue}`, `{pr}` and `{cleanup}` substituted. Defaults to
274
+ * `DEFAULT_REPORT_PROMPT_TEMPLATE`.
275
+ */
276
+ report_prompt?: string;
277
+ /**
278
+ * Prompt template for the one bounded fix attempt on a failing batch member
279
+ * (#472); `{issue}`, `{batch}` and `{tests}` substituted. Defaults to
280
+ * `DEFAULT_FIX_PROMPT_TEMPLATE`.
281
+ */
282
+ fix_prompt?: string;
162
283
  }
163
284
  /** The escalation ladder: one tier stronger, or null at the top (RFC-0001 §C.1). */
164
285
  export declare const TIER_LADDER: Readonly<Record<ModelTier, ModelTier | null>>;
286
+ /** The ladder as an ordered array (weakest first) — the single ordering source. */
287
+ export declare const TIER_ORDER: readonly ModelTier[];
165
288
  /** Cap on recovery attempts before a unit fails (RFC-0001 §C.1 "cap 2"). */
166
289
  export declare const ESCALATION_CAP = 2;
167
290
  /** Default stall timeout: 30 minutes without a milestone or pushed commit (RFC-0001 §C.1). */
168
291
  export declare const DEFAULT_STALL_TIMEOUT_MS: number;
169
292
  /** Default reconciliation tick: ~60s (RFC-0001 §C.1). */
170
293
  export declare const DEFAULT_RECONCILE_INTERVAL_MS: number;
171
- export declare const SCHEMA_VERSION: "1.1.0";
294
+ /** Default parked-PR poll interval: 2.5 min (#468 AC1 "every 2–3 min"). */
295
+ export declare const DEFAULT_PR_POLL_INTERVAL_MS: number;
296
+ /**
297
+ * Fraction of a batch's members whose eviction dissolves it: STRICTLY more
298
+ * than a third (RFC-0001 §F.8 "> ⅓ evicted → dissolve").
299
+ */
300
+ export declare const DISSOLVE_EVICTION_FRACTION: number;
301
+ /** Bounded fix attempts per member before it is evicted (§F.2 "one bounded attempt"). */
302
+ export declare const MAX_FIX_ATTEMPTS_PER_MEMBER = 1;
303
+ /**
304
+ * Tier the one bounded fix attempt runs at (§F.2 "mid-tier agent dispatch").
305
+ * Deliberately not the member's own tier: that tier already produced the code
306
+ * the suite is failing on.
307
+ */
308
+ export declare const FIX_ATTEMPT_TIER: ModelTier;
309
+ /**
310
+ * The batch-line runstate phases (RFC-0001 §D.2).
311
+ *
312
+ * MUST stay in sync with `BATCH_PHASES`/`BATCH_SPECS` in `cli/src/runstate.ts`,
313
+ * which is the validating authority — this package cannot import from the CLI
314
+ * (the CLI depends on this package), so the vocabulary is a deliberate copy.
315
+ * A phase or status the CLI rejects makes the milestone un-postable at runtime.
316
+ */
317
+ export declare const BATCH_PHASES: readonly ["batch-setup", "batch-validate", "batch-review", "batch-ship", "batch-report"];
318
+ export type BatchPhase = (typeof BATCH_PHASES)[number];
319
+ /** Rebases of a conflicting batch PR before dissolving into halves (§F.9 "re-ship once"). */
320
+ export declare const MAX_REBASE_ATTEMPTS = 1;
321
+ export declare const SCHEMA_VERSION: "1.3.0";
172
322
  /** Schema versions `validateState` accepts on load (migrated to SCHEMA_VERSION on save). */
173
323
  export declare const LEGACY_SCHEMA_VERSIONS: readonly string[];
174
- export declare const CONFIG_SCHEMA_VERSION: "1.1.0";
324
+ export declare const CONFIG_SCHEMA_VERSION: "1.2.0";
175
325
  /** Config schema versions `loadConfig` accepts (older configs carry only max_slots). */
176
326
  export declare const LEGACY_CONFIG_SCHEMA_VERSIONS: readonly string[];
177
327
  /** Config file shape (schema_version + the config itself). */
@@ -180,6 +330,7 @@ export interface SchedConfigFile {
180
330
  max_slots: number;
181
331
  stall_timeout_ms?: number;
182
332
  reconcile_interval_ms?: number;
333
+ pr_poll_interval_ms?: number;
183
334
  dispatch?: DispatchConfig;
184
335
  }
185
336
  export declare const DEFAULT_MAX_SLOTS = 3;
@@ -198,7 +349,7 @@ export declare class SchedNotFoundError extends Error {
198
349
  constructor(message: string);
199
350
  }
200
351
  /** Every event the engine journals to `events.jsonl` (append-only). */
201
- export type JournalEventName = 'assigned' | 'spawned' | 'exit-detected' | 'orphan-pid' | 'external-advance' | 'progress' | 'phase-updated' | 'verify-complete' | 'verify-incomplete' | 'stalled' | 'redispatched' | 'unit-failed' | 'dependents-blocked' | 'requeued' | 'ground-truth-unreachable' | 'tick-failed';
352
+ export type JournalEventName = 'assigned' | 'spawned' | 'exit-detected' | 'orphan-pid' | 'external-advance' | 'progress' | 'phase-updated' | 'verify-complete' | 'verify-incomplete' | 'stalled' | 'redispatched' | 'unit-failed' | 'dependents-blocked' | 'requeued' | 'ground-truth-unreachable' | 'tick-failed' | 'pr-parked' | 'merge-accepted' | 'pr-watch-failed' | 'pr-watch-waiting' | 'teardown-done' | 'teardown-failed' | 'report-dispatched' | 'report-failed' | 'suite-failed' | 'git-failed' | 'attributed' | 'fix-dispatched' | 'fix-resolved' | 'member-evicted' | 'revert-conflict' | 'batch-rebased' | 'batch-dissolved' | 'batch-split' | 'milestone-post-failed';
202
353
  /** One journaled event. `ts` is stamped by the journal, never by callers. */
203
354
  export interface JournalEvent {
204
355
  ts: string;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,4GAA4G;AAC5G,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,MAAM,CAAC;AAExC,+GAA+G;AAC/G,MAAM,MAAM,SAAS,GAAG,YAAY,GAAG,KAAK,GAAG,QAAQ,CAAC;AAIxD;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,WAAW,GACnB,QAAQ,GACR,YAAY,GACZ,YAAY,GACZ,SAAS,GACT,MAAM,GACN,SAAS,GACT,SAAS,GACT,SAAS,GACT,WAAW,GACX,WAAW,GACX,kBAAkB,GAClB,SAAS,GACT,UAAU,GACV,SAAS,GACT,kBAAkB,GAClB,QAAQ,CAAC;AAEb,qDAAqD;AACrD,eAAO,MAAM,uBAAuB,EAAE,WAAW,CAAC,WAAW,CAA+B,CAAC;AAE7F;;;GAGG;AACH,eAAO,MAAM,wBAAwB,EAAE,WAAW,CAAC,WAAW,CAI5D,CAAC;AAIH;;;;;;;;;;;;;GAa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).
10
10
  */
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.SchedNotFoundError = exports.IllegalTransitionError = exports.MAX_MAX_SLOTS = exports.MIN_MAX_SLOTS = exports.DEFAULT_MAX_SLOTS = exports.LEGACY_CONFIG_SCHEMA_VERSIONS = exports.CONFIG_SCHEMA_VERSION = exports.LEGACY_SCHEMA_VERSIONS = exports.SCHEMA_VERSION = exports.DEFAULT_RECONCILE_INTERVAL_MS = exports.DEFAULT_STALL_TIMEOUT_MS = exports.ESCALATION_CAP = exports.TIER_LADDER = exports.LIVE_SLOT_STATUSES = exports.MERGED_BATCH_STATUSES = exports.TERMINAL_BATCH_STATUSES = exports.SATISFIED_ISSUE_STATUSES = exports.TERMINAL_ISSUE_STATUSES = void 0;
12
+ exports.SchedNotFoundError = exports.IllegalTransitionError = exports.MAX_MAX_SLOTS = exports.MIN_MAX_SLOTS = exports.DEFAULT_MAX_SLOTS = exports.LEGACY_CONFIG_SCHEMA_VERSIONS = exports.CONFIG_SCHEMA_VERSION = exports.LEGACY_SCHEMA_VERSIONS = exports.SCHEMA_VERSION = exports.MAX_REBASE_ATTEMPTS = exports.BATCH_PHASES = exports.FIX_ATTEMPT_TIER = exports.MAX_FIX_ATTEMPTS_PER_MEMBER = exports.DISSOLVE_EVICTION_FRACTION = exports.DEFAULT_PR_POLL_INTERVAL_MS = exports.DEFAULT_RECONCILE_INTERVAL_MS = exports.DEFAULT_STALL_TIMEOUT_MS = exports.ESCALATION_CAP = exports.TIER_ORDER = exports.TIER_LADDER = exports.LIVE_SLOT_STATUSES = exports.MERGED_BATCH_STATUSES = exports.TERMINAL_BATCH_STATUSES = exports.SATISFIED_ISSUE_STATUSES = exports.TERMINAL_ISSUE_STATUSES = void 0;
13
13
  /** Issue statuses that cannot transition further. */
14
14
  exports.TERMINAL_ISSUE_STATUSES = new Set(['done', 'failed']);
15
15
  /**
@@ -46,18 +46,52 @@ exports.TIER_LADDER = {
46
46
  mid: 'strong',
47
47
  strong: null,
48
48
  };
49
+ /** The ladder as an ordered array (weakest first) — the single ordering source. */
50
+ exports.TIER_ORDER = ['mechanical', 'mid', 'strong'];
49
51
  /** Cap on recovery attempts before a unit fails (RFC-0001 §C.1 "cap 2"). */
50
52
  exports.ESCALATION_CAP = 2;
51
53
  /** Default stall timeout: 30 minutes without a milestone or pushed commit (RFC-0001 §C.1). */
52
54
  exports.DEFAULT_STALL_TIMEOUT_MS = 30 * 60 * 1000;
53
55
  /** Default reconciliation tick: ~60s (RFC-0001 §C.1). */
54
56
  exports.DEFAULT_RECONCILE_INTERVAL_MS = 60 * 1000;
55
- exports.SCHEMA_VERSION = '1.1.0';
57
+ /** Default parked-PR poll interval: 2.5 min (#468 AC1 "every 2–3 min"). */
58
+ exports.DEFAULT_PR_POLL_INTERVAL_MS = 150 * 1000;
59
+ /**
60
+ * Fraction of a batch's members whose eviction dissolves it: STRICTLY more
61
+ * than a third (RFC-0001 §F.8 "> ⅓ evicted → dissolve").
62
+ */
63
+ exports.DISSOLVE_EVICTION_FRACTION = 1 / 3;
64
+ /** Bounded fix attempts per member before it is evicted (§F.2 "one bounded attempt"). */
65
+ exports.MAX_FIX_ATTEMPTS_PER_MEMBER = 1;
66
+ /**
67
+ * Tier the one bounded fix attempt runs at (§F.2 "mid-tier agent dispatch").
68
+ * Deliberately not the member's own tier: that tier already produced the code
69
+ * the suite is failing on.
70
+ */
71
+ exports.FIX_ATTEMPT_TIER = 'mid';
72
+ /**
73
+ * The batch-line runstate phases (RFC-0001 §D.2).
74
+ *
75
+ * MUST stay in sync with `BATCH_PHASES`/`BATCH_SPECS` in `cli/src/runstate.ts`,
76
+ * which is the validating authority — this package cannot import from the CLI
77
+ * (the CLI depends on this package), so the vocabulary is a deliberate copy.
78
+ * A phase or status the CLI rejects makes the milestone un-postable at runtime.
79
+ */
80
+ exports.BATCH_PHASES = [
81
+ 'batch-setup',
82
+ 'batch-validate',
83
+ 'batch-review',
84
+ 'batch-ship',
85
+ 'batch-report',
86
+ ];
87
+ /** Rebases of a conflicting batch PR before dissolving into halves (§F.9 "re-ship once"). */
88
+ exports.MAX_REBASE_ATTEMPTS = 1;
89
+ exports.SCHEMA_VERSION = '1.3.0';
56
90
  /** Schema versions `validateState` accepts on load (migrated to SCHEMA_VERSION on save). */
57
- exports.LEGACY_SCHEMA_VERSIONS = ['1.0.0'];
58
- exports.CONFIG_SCHEMA_VERSION = '1.1.0';
91
+ exports.LEGACY_SCHEMA_VERSIONS = ['1.0.0', '1.1.0', '1.2.0'];
92
+ exports.CONFIG_SCHEMA_VERSION = '1.2.0';
59
93
  /** Config schema versions `loadConfig` accepts (older configs carry only max_slots). */
60
- exports.LEGACY_CONFIG_SCHEMA_VERSIONS = ['1.0.0'];
94
+ exports.LEGACY_CONFIG_SCHEMA_VERSIONS = ['1.0.0', '1.1.0'];
61
95
  exports.DEFAULT_MAX_SLOTS = 3;
62
96
  /** Bounds for `max_slots` when reading `config.json` (named — not magic numbers in persist.ts). */
63
97
  exports.MIN_MAX_SLOTS = 1;
package/dist/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;;;AA2CH,qDAAqD;AACxC,QAAA,uBAAuB,GAA6B,IAAI,GAAG,CAAC,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC;AAE7F;;;GAGG;AACU,QAAA,wBAAwB,GAA6B,IAAI,GAAG,CAAC;IACxE,SAAS;IACT,kBAAkB;IAClB,MAAM;CACP,CAAC,CAAC;AAsCH,qDAAqD;AACxC,QAAA,uBAAuB,GAA6B,IAAI,GAAG,CAAC,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC;AAEhG;;;;GAIG;AACU,QAAA,qBAAqB,GAA6B,IAAI,GAAG,CAAC;IACrE,QAAQ;IACR,UAAU;IACV,UAAU;IACV,MAAM;CACP,CAAC,CAAC;AAuBH,+DAA+D;AAClD,QAAA,kBAAkB,GAA4B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,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,oBAAoB,CAAC;IACnC,CAAC;CACF;AALD,gDAKC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ai-dossier/sched",
3
- "version": "0.2.1",
4
- "description": "Deterministic scheduler core for dossier batch cycles — queue, slots, persistent state machine, dispatch engine with completion verification and stall/escalation ladder. The scheduler never invokes an LLM.",
3
+ "version": "0.4.0",
4
+ "description": "Deterministic scheduler core for dossier batch cycles — queue, slots, persistent state machine, dispatch engine with completion verification and stall/escalation ladder, PR watching with script-based teardown, and batch failure recovery (attribution, bisect, eviction, dissolve). The scheduler never invokes an LLM.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "files": [