@ai-dossier/sched 0.32.0 → 0.33.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/README.md CHANGED
@@ -140,7 +140,7 @@ where every mechanical supervision decision is code, not remembered prose:
140
140
  completing a freshly-spawned agent on
141
141
  its first reconcile tick; a legacy slot with no `spawned_at` degrades to the old,
142
142
  unfenced check. Batch members get the same fence on their own completion signal
143
- (`isMemberComplete`, `phase=review status=done mode=slot`).
143
+ (`isMemberComplete`, `phase=review status=done` on the member-trail vocabulary — `mode=slot` or `batch=<id>`, #677).
144
144
  3. **Reconciliation tick (AC3)** — every tick detects externally-advanced state (someone
145
145
  finished the work outside sched → complete, kill the leftover agent, reclaim the
146
146
  slot), orphaned pids after a restart (dead pid on a running slot → exit rail →
@@ -685,18 +685,28 @@ failure rails: executing → dissolving (a member self-reports blocked)
685
685
  package-manager-detected install/build (`@ai-dossier/worktree-pool`'s command
686
686
  resolution — respects the repo's `.worktree-pool.json` `project_subdir`/
687
687
  `warm_commands` even in repos that never use the pool for anything else).
688
- - **Members run serially, one fresh `slot-cycle` agent at a time**, in the shared
689
- worktree. A member's completion signal is `phase=review status=done mode=slot` on its
690
- OWN issue (`slot-cycle` posts no phase of its own past `review` — ship is batch-owned);
691
- its commit range on the batch branch is recomputed (`git log`) after every member and
692
- kept on `BatchEntry.ranges` for eviction. An incremental gate (`ai-dossier cap run
688
+ This shared tree is the batch's INTEGRATION branch: members branch off it, and
689
+ the tail work (aggregate suite, review, ship) runs in it (#677).
690
+ - **Members run `member-cycle` serially, one fresh agent at a time — each in its OWN
691
+ worktree** on its OWN branch `batch/<id>-m<n>-<issue>` (#677, RFC-0001 §J.3), cut off
692
+ the integration branch, warmed, and pushed before the agent spawns; the agent never
693
+ creates either. When the member's incremental gate passes, the scheduler LANDS the
694
+ member's branch onto the integration branch (`git merge --ff-only` + push) and tears
695
+ the member worktree down (pool-return or remove) before the next member prep. A
696
+ member's completion signal is `phase=review status=done` carrying the member-trail
697
+ vocabulary — `mode=slot` or `batch=<id>` — on its OWN issue (the member workflow
698
+ posts no phase of its own past `review` — ship is batch-owned); its commit range on
699
+ the integration branch is recomputed (`git log`) after every landing and kept on
700
+ `BatchEntry.ranges` for eviction. An incremental gate (`ai-dossier cap run
693
701
  typecheck.run` / `test.focused`, when the repo has a manifest) runs after each member
694
- before advancing — a second, independent check that the member's self-reported "done"
695
- is real. Four-way outcome policy (#583, split further by #594): a `task-failed` whose
702
+ IN ITS MEMBER WORKTREE before landing — a second, independent check that the
703
+ member's self-reported "done" is real (`resume --batch` rechecks run there too).
704
+ Four-way outcome policy (#583, split further by #594): a `task-failed` whose
696
705
  `output_tail` carries recognizable evidence that the capability EARNED it — failing-test
697
706
  output for a `test.*` capability, compiler/build errors for the others
698
- (`hasEarnedFailureEvidence`) — evicts the member (same rail as a self-reported block);
699
- a `task-failed` with an empty or framing-only capture proves nothing and joins
707
+ (`hasEarnedFailureEvidence`) — evicts the member (same rail as a self-reported block;
708
+ its commits never landed, so there is nothing to revert); a `task-failed` with an
709
+ empty or framing-only capture proves nothing and joins
700
710
  `automation-broken`/`capability-unavailable` — the gate itself couldn't reach a verdict
701
711
  — on the block-the-batch path instead of silently proceeding (`gate-inconclusive:<cap>`,
702
712
  `member_gates`/`blocked_reason` on `BatchEntry`, surfaced in `sched status`; the journal
@@ -803,7 +813,26 @@ recorded under the old behavior, so those values are exact, not a guess. Cleared
803
813
  with the slot on release (`CLEARED_SLOT_FIELDS`), so the next unit assigned there
804
814
  journals its first milestone fresh.
805
815
 
816
+ Schema 1.18.0 (#677): `BatchEntry` gains `member_branch` and `member_worktree` (the
817
+ CURRENT member's own branch `batch/<id>-m<n>-<issue>` off the integration branch and
818
+ the worktree holding it — the `{worktree}`/`{integration_branch}` inputs the member
819
+ prompt carries, and where the incremental gate runs pre-landing) and
820
+ `member_pool_claimed` (teardown reads it to decide pool-return vs remove, mirroring
821
+ `pool_claimed` at member granularity). 1.17.0 states migrate on load, backfilling
822
+ `null`/`null`/`false` — pre-#677 members ran in the shared batch worktree, so those
823
+ values are exact, not a guess. Persisted (not re-derived) so a takeover redispatch or
824
+ a `sched resume --batch` recheck after an engine restart lands in the SAME
825
+ worktree/branch.
826
+
806
827
  New journal events: `batch-setup-done`, `batch-setup-failed`, `member-advanced`,
828
+ `member-worktree-reused` (#677 — an on-disk member worktree reused by a takeover
829
+ redispatch or a crash-window re-prep; a spawn-time event, never per-tick),
830
+ `member-landed` (#677 — the member's verified branch fast-forward-landed onto the
831
+ integration branch), `landing-failed` (#677 — the mechanical landing failed; BLOCKS
832
+ the batch for an operator, like `batch-blocked`), `member-worktree-torn-down` (#677 —
833
+ the member's own worktree/branch cleaned up after it resolved) and
834
+ `stale-member-worktree` (#677 — persisted member context that does not belong to the
835
+ current member was discarded for a fresh prep),
807
836
  `batch-warmup-done`, `batch-warmup-failed` (#561 — the cold-path warm step only; a pool
808
837
  claim emits neither). `gate-inconclusive` (#583 — the incremental gate came back
809
838
  `automation-broken`/`capability-unavailable` rather than a definite `ok`/`task-failed`;
@@ -818,7 +847,8 @@ once per member and names the member the batch is advancing FROM) and
818
847
  stops advancing never does so silently). Member/tail/report/fix-agent spawn, progress,
819
848
  completion and park events reuse the existing unit-generic names (`assigned`/`spawned`/`unit-failed`/
820
849
  `external-advance`/`pr-parked`/`merge-accepted`/`report-dispatched`/`teardown-done`/
821
- `teardown-failed`) with `unit = batch:<id>`.
850
+ `teardown-failed`) with `unit = batch:<id>`; the member `spawned` event also carries
851
+ `worktree` (#677) naming the member worktree the prompt was built with.
822
852
 
823
853
  ## API surface
824
854
 
@@ -953,10 +983,11 @@ import {
953
983
  type CapOutcome, // ok | task-failed | automation-broken | capability-unavailable
954
984
  type CapabilityGateResult, // {outcome: CapOutcome, outputTail?, reason?} — runCapability's return shape (#583)
955
985
  resumeBlockedGate, // #583: sched resume --batch <id> — re-run the gate that blocked a batch
956
- buildMemberPrompt, buildBatchTailPrompt, buildBatchReportPrompt, // #523 prompt builders
986
+ buildMemberPrompt, buildBatchTailPrompt, buildBatchReportPrompt, // #523 prompt builders (#677: member carries {issue}/{batch}/{worktree}/{integration_branch})
987
+ memberBranchFor, // #677: the member branch name, `batch/<id>-m<n>-<issue>` — one definition, every recovery surface derives from it
957
988
  DEFAULT_MEMBER_PROMPT_TEMPLATE, DEFAULT_BATCH_TAIL_PROMPT_TEMPLATE,
958
989
  DEFAULT_BATCH_REPORT_PROMPT_TEMPLATE,
959
- isMemberComplete, isMemberBlocked, // member milestone predicates (mode=slot gated)
990
+ isMemberComplete, isMemberBlocked, // member milestone predicates (member-trail gated: mode=slot or batch=<id>, #677)
960
991
  isBatchTailParked, // batch-ship awaiting-merge + pr= — the batch park signal
961
992
  isBatchPhaseDone, // <phase> done on the anchor (batch-review/batch-report)
962
993
  batchOfUnit, // batch:<id> → <id>; null for issue units or malformed ids
@@ -94,7 +94,7 @@ export interface BatchDispatchDeps {
94
94
  * Runs one `ai-dossier cap run <capabilityId>` in a batch worktree. Two call
95
95
  * sites, different degrade contracts:
96
96
  * - the per-member incremental gate (#523 AC2, revised #583): without this
97
- * hook, the gate is skipped entirely (the member's own `slot-cycle` run
97
+ * hook, the gate is skipped entirely (the member's own member-cycle run
98
98
  * already attempted this fast path before ever posting `review done`, so
99
99
  * a repo with no manifest loses nothing but the engine's independent
100
100
  * re-check). With the hook: `ok` advances, `task-failed` evicts,
@@ -140,6 +140,15 @@ export interface MemberFailure {
140
140
  detail: string;
141
141
  extraKv?: Record<string, string>;
142
142
  }
143
+ /**
144
+ * The current member's own branch: `batch/<id>-m<n>-<issue>` (#677) — member
145
+ * index and issue both in the name, and deterministic from persisted state,
146
+ * so a takeover redispatch, a `sched resume --batch` recheck, and teardown
147
+ * all re-derive the same string without a lookup table. Distinct from the
148
+ * integration branch (`batch/<id>-<date>`): the member commits here, the
149
+ * scheduler lands it there.
150
+ */
151
+ export declare function memberBranchFor(batchId: string, memberIndex: number, issue: number): string;
143
152
  /**
144
153
  * Evict the current member and either dissolve, or continue the batch via
145
154
  * `advanceMemberOrValidate` — the shared tail of both member-failure rails
@@ -1 +1 @@
1
- {"version":3,"file":"batch-dispatch.d.ts","sourceRoot":"","sources":["../src/batch-dispatch.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6DG;AAmBH,OAAO,EAWL,KAAK,gBAAgB,EAErB,KAAK,SAAS,EACf,MAAM,YAAY,CAAC;AAEpB,OAAO,EACL,KAAK,WAAW,EAQjB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,KAAK,OAAO,EAAa,MAAM,WAAW,CAAC;AACpD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAExC,OAAO,EAUL,KAAK,WAAW,EACjB,MAAM,YAAY,CAAC;AAmBpB,OAAO,EAAE,KAAK,QAAQ,EAA2D,MAAM,YAAY,CAAC;AACpG,OAAO,KAAK,EAEV,UAAU,EAEV,oBAAoB,EAMpB,WAAW,EAGZ,MAAM,SAAS,CAAC;AAYjB,YAAY,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE1C,8DAA8D;AAC9D,MAAM,WAAW,iBAAiB;IAChC,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,uFAAuF;IACvF,OAAO,EAAE,MAAM,CAAC;IAChB,0FAA0F;IAC1F,IAAI,EAAE,MAAM,CAAC;IACb;;;;;;OAMG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,sGAAsG;IACtG,QAAQ,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,WAAW,CAAC;IAC5C;;;;;;;;;;;;;;;;;;;OAmBG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