@ai-dossier/sched 0.68.2-next.548.1 → 0.68.3-next.550.1
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 +6 -3
- package/dist/batch-dispatch.d.ts.map +1 -1
- package/dist/batch-dispatch.js +65 -6
- package/dist/batch-dispatch.js.map +1 -1
- package/dist/engine.d.ts +4 -1
- package/dist/engine.d.ts.map +1 -1
- package/dist/engine.js +1 -9
- package/dist/engine.js.map +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -402,9 +402,12 @@ ai-dossier sched service uninstall
|
|
|
402
402
|
`--repo-dir`), and the node/nvm `PATH` at install time (absolute entries only). Install refuses
|
|
403
403
|
node / entry-point / repo paths that are missing, relative, or under a temp or `worktrees/`
|
|
404
404
|
directory, and warns that an nvm node path must be re-pinned (re-run `install`) after a node
|
|
405
|
-
upgrade. It runs `sched start --auto-upgrade` (opt out with `--no-auto-upgrade`);
|
|
406
|
-
|
|
407
|
-
|
|
405
|
+
upgrade. It runs `sched start --auto-upgrade` (opt out with `--no-auto-upgrade`); after a
|
|
406
|
+
completed tick, a stale engine installs the latest CLI and re-execs the same command before
|
|
407
|
+
another state write. Detached agents keep running and the new engine reattaches by pid. The
|
|
408
|
+
new version migrates state on load; older engines reject newer schemas. If the Node runtime
|
|
409
|
+
cannot replace the process directly, exit code 75 asks systemd/the watchdog to restart the
|
|
410
|
+
updated entry point.
|
|
408
411
|
Output goes to the journal (`journalctl --user -u <unit>`) and the durable trail is the
|
|
409
412
|
project's `events.jsonl`. Run `loginctl enable-linger $USER` once so it starts at boot without a
|
|
410
413
|
login. Re-running `install` is idempotent; a changed unit is restarted (agents keep running).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"batch-dispatch.d.ts","sourceRoot":"","sources":["../src/batch-dispatch.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;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CAAC;CAC5B;AAoTD;;;;;;;;;;;GAWG;AACH,oCAAoC;AACpC,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,UAAU,EACjB,KAAK,EAAE,UAAU,EACjB,MAAM,EAAE,WAAW,GAClB,kBAAkB,CAQpB;AAgnBD;;;;;;;GAOG;AACH,eAAO,MAAM,qBAAqB,IAAI,CAAC;AA8UvC;;;;;;;;;;;;;GAaG;AACH,wBAAgB,YAAY,CAC1B,IAAI,EAAE,iBAAiB,EACvB,MAAM,EAAE,WAAW,EACnB,QAAQ,EAAE,gBAAgB,GACzB,eAAe,CAySjB"}
|
package/dist/batch-dispatch.js
CHANGED
|
@@ -1424,15 +1424,28 @@ function claimAndSetup(deps, config, dispatch, batchId, now, result) {
|
|
|
1424
1424
|
abortSetup(`member-worktree-prep-failed:${memberPrep.reason}`, `member worktree prep failed: ${memberPrep.reason} (member 1 #${firstIssue}, branch ${memberBranchFor(batchId, 1, firstIssue)})`);
|
|
1425
1425
|
return;
|
|
1426
1426
|
}
|
|
1427
|
+
// Persist the completed setup and the batch's executing/member-1 assignment
|
|
1428
|
+
// BEFORE spawning. If SIGKILL lands between this write and the provider
|
|
1429
|
+
// process creation, the next engine sees `executing` + an assigned slot and
|
|
1430
|
+
// `reconcileMemberSlot` resumes from the deterministic member worktree. The
|
|
1431
|
+
// previous single lock pass spawned first and only saved afterward, leaving
|
|
1432
|
+
// a kill window with batch=status ready + an assigned slot that no tick arm
|
|
1433
|
+
// could claim again.
|
|
1427
1434
|
deps.store.withLock((s) => ({
|
|
1428
|
-
state: landSetup(deps, s, batchId, setup, now, { member_dispatch: 'serial' }, 1, (next) =>
|
|
1429
|
-
const slot = slotFor(next, batchId);
|
|
1430
|
-
return slot
|
|
1431
|
-
? spawnMember(deps, dispatch, next, slot, batchId, now, result, memberPrep)
|
|
1432
|
-
: next;
|
|
1433
|
-
}),
|
|
1435
|
+
state: landSetup(deps, s, batchId, setup, now, { member_dispatch: 'serial' }, 1, (next) => next),
|
|
1434
1436
|
result: undefined,
|
|
1435
1437
|
}));
|
|
1438
|
+
deps.store.withLock((s) => {
|
|
1439
|
+
const freshBatch = (0, state_1.findBatch)(s, batchId);
|
|
1440
|
+
const slot = slotFor(s, batchId);
|
|
1441
|
+
if (!freshBatch || freshBatch.status !== 'executing' || !slot) {
|
|
1442
|
+
return { state: s, result: undefined };
|
|
1443
|
+
}
|
|
1444
|
+
return {
|
|
1445
|
+
state: spawnMember(deps, dispatch, s, slot, batchId, now, result, memberPrep),
|
|
1446
|
+
result: undefined,
|
|
1447
|
+
};
|
|
1448
|
+
});
|
|
1436
1449
|
}
|
|
1437
1450
|
/**
|
|
1438
1451
|
* Land a completed `runBatchSetup` on the batch entry (inside the caller's
|
|
@@ -2965,6 +2978,45 @@ function reconcileMemberSlot(deps, config, dispatch, batchId, slot, now, result)
|
|
|
2965
2978
|
release, () => runLog?.append());
|
|
2966
2979
|
}
|
|
2967
2980
|
}
|
|
2981
|
+
/**
|
|
2982
|
+
* Recover the durable setup→member handoff when an engine dies after
|
|
2983
|
+
* `landSetup` saved `batch.status=executing` but before the member process was
|
|
2984
|
+
* spawned and its pid was saved. The slot is still `assigned`; release that
|
|
2985
|
+
* claim and reuse `spawnMemberContinuation`, whose deterministic member
|
|
2986
|
+
* worktree path adopts the already-prepared tree. This is the batch equivalent
|
|
2987
|
+
* of `engine.ts`'s assigned-before-spawn recovery rail.
|
|
2988
|
+
*/
|
|
2989
|
+
function recoverAssignedMemberSlot(deps, config, dispatch, batchId, slot, now, result) {
|
|
2990
|
+
const current = deps.store.load();
|
|
2991
|
+
const batch = (0, state_1.findBatch)(current, batchId);
|
|
2992
|
+
if (!batch ||
|
|
2993
|
+
batch.status !== 'executing' ||
|
|
2994
|
+
isParallelBatch(batch) ||
|
|
2995
|
+
slot.status !== 'assigned' ||
|
|
2996
|
+
slot.pid !== null) {
|
|
2997
|
+
return;
|
|
2998
|
+
}
|
|
2999
|
+
const released = deps.store.withLock((state) => {
|
|
3000
|
+
const fresh = (0, state_1.findBatch)(state, batchId);
|
|
3001
|
+
const freshSlot = slotFor(state, batchId);
|
|
3002
|
+
if (!fresh ||
|
|
3003
|
+
fresh.status !== 'executing' ||
|
|
3004
|
+
isParallelBatch(fresh) ||
|
|
3005
|
+
!freshSlot ||
|
|
3006
|
+
freshSlot.status !== 'assigned' ||
|
|
3007
|
+
freshSlot.pid !== null) {
|
|
3008
|
+
return { state, result: false };
|
|
3009
|
+
}
|
|
3010
|
+
return { state: releaseSlot(state, batchId, now), result: true };
|
|
3011
|
+
});
|
|
3012
|
+
if (!released)
|
|
3013
|
+
return;
|
|
3014
|
+
journalEvent(deps, 'assigned-recovered', unit(batchId), {
|
|
3015
|
+
slot: slot.id,
|
|
3016
|
+
detail: 'engine restarted after a serial batch assignment was persisted but before member spawn was recorded',
|
|
3017
|
+
});
|
|
3018
|
+
spawnMemberContinuation(deps, config, dispatch, batchId, now, result);
|
|
3019
|
+
}
|
|
2968
3020
|
/**
|
|
2969
3021
|
* Park a member that left the batch before landing, record the exit, and
|
|
2970
3022
|
* dissolve if this tips the batch past its `dissolve_policy` threshold (#563;
|
|
@@ -5355,6 +5407,13 @@ function runBatchTick(deps, config, dispatch) {
|
|
|
5355
5407
|
reconcileParallelBatch(deps, config, batchDispatch, batch.id, now, result, paused);
|
|
5356
5408
|
continue;
|
|
5357
5409
|
}
|
|
5410
|
+
if (batch.status === 'executing' &&
|
|
5411
|
+
!isParallelBatch(batch) &&
|
|
5412
|
+
slot?.status === 'assigned' &&
|
|
5413
|
+
slot.pid === null) {
|
|
5414
|
+
recoverAssignedMemberSlot(deps, config, batchDispatch, batch.id, slot, now, result);
|
|
5415
|
+
continue;
|
|
5416
|
+
}
|
|
5358
5417
|
if (slot && (slot.status === 'running' || slot.status === 'assigned')) {
|
|
5359
5418
|
if (batch.status === 'executing') {
|
|
5360
5419
|
reconcileMemberSlot(deps, config, batchDispatch, batch.id, slot, now, result);
|