@ai-dossier/sched 0.57.2 → 0.57.4
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/batch-dispatch.d.ts +1 -1
- package/dist/batch-dispatch.d.ts.map +1 -1
- package/dist/batch-dispatch.js +35 -12
- package/dist/batch-dispatch.js.map +1 -1
- package/dist/scheduler.d.ts.map +1 -1
- package/dist/scheduler.js +1 -0
- package/dist/scheduler.js.map +1 -1
- package/dist/state.d.ts +1 -0
- package/dist/state.d.ts.map +1 -1
- package/dist/state.js +9 -1
- package/dist/state.js.map +1 -1
- package/dist/types.d.ts +3 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/package.json +1 -1
package/dist/batch-dispatch.d.ts
CHANGED
|
@@ -71,8 +71,8 @@ import { type BatchSuiteContext, type SuiteResult } from './recovery';
|
|
|
71
71
|
import { tailMembersRefusal } from './state';
|
|
72
72
|
import { type FsExists } from './teardown';
|
|
73
73
|
import type { BatchEntry, CapabilityGateResult, MemberDispatchMode, MemberExitKind, SchedConfig, SchedState } from './types';
|
|
74
|
-
export { tailMembersRefusal };
|
|
75
74
|
export type { CapOutcome } from './types';
|
|
75
|
+
export { tailMembersRefusal };
|
|
76
76
|
/** Everything batch dispatch needs from the outside world. */
|
|
77
77
|
export interface BatchDispatchDeps {
|
|
78
78
|
store: SchedStore;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"batch-dispatch.d.ts","sourceRoot":"","sources":["../src/batch-dispatch.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8DG;AAUH,OAAO,EAIL,KAAK,YAAY,EAGjB,KAAK,gBAAgB,EAGtB,MAAM,gBAAgB,CAAC;AAUxB,OAAO,EAcL,KAAK,gBAAgB,EAGrB,KAAK,SAAS,EAEf,MAAM,YAAY,CAAC;AAEpB,OAAO,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MAAM,wBAAwB,IAAI,CAAC;AAmkB1C;;;;;;GAMG;AACH,wBAAgB,4BAA4B,CAAC,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,UAAU,GAAG,MAAM,EAAE,CAuB3F;AA6HD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH,wBAAgB,4BAA4B,CAC1C,IAAI,EAAE,iBAAiB,EACvB,GAAG,EAAE,IAAI,EACT,MAAM,EAAE,eAAe,EACvB,SAAS,EAAE,iBAAiB,GAAG,SAAS,GACvC,IAAI,CAmMN;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,iBAAiB,EAAE,GAAG,EAAE,IAAI,GAAG,IAAI,CAuG/E;AAED;;;;;;GAMG;AACH,UAAU,iBAAiB;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,gDAAgD;IAChD,IAAI,EAAE,gBAAgB,CAAC;IACvB,uEAAuE;IACvE,SAAS,EAAE,gBAAgB,CAAC;IAC5B,YAAY,EAAE,YAAY,CAAC;CAC5B;AAmTD;;;;;;;;;;;GAWG;AACH,oCAAoC;AACpC,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,UAAU,EACjB,KAAK,EAAE,UAAU,EACjB,MAAM,EAAE,WAAW,GAClB,kBAAkB,CAQpB;AA44BD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,YAAY,CAC1B,IAAI,EAAE,iBAAiB,EACvB,MAAM,EAAE,WAAW,EACnB,QAAQ,EAAE,gBAAgB,GACzB,eAAe,CAgSjB"}
|
package/dist/batch-dispatch.js
CHANGED
|
@@ -2477,9 +2477,9 @@ function currentDispatchStamp(stamp, spawnedAt, now) {
|
|
|
2477
2477
|
* `kill-escalated` once (`kill_escalated_at`). Pre-#844 this path re-sent
|
|
2478
2478
|
* SIGTERM forever, so an agent ignoring it held its member indefinitely.
|
|
2479
2479
|
*/
|
|
2480
|
-
function stopAgentBeforeDeciding(deps, batchId, memberIssue, slot, now) {
|
|
2480
|
+
function stopAgentBeforeDeciding(deps, config, batchId, memberIssue, slot, now, result) {
|
|
2481
2481
|
if (!agentAlive(deps, slot))
|
|
2482
|
-
return
|
|
2482
|
+
return 'gone';
|
|
2483
2483
|
const pid = slot.pid;
|
|
2484
2484
|
const pidStart = slot.pid_start ?? undefined;
|
|
2485
2485
|
const sentAt = currentDispatchStamp(slot.kill_sent_at, slot.spawned_at, now);
|
|
@@ -2488,7 +2488,26 @@ function stopAgentBeforeDeciding(deps, batchId, memberIssue, slot, now) {
|
|
|
2488
2488
|
// `kill` refuses a pid whose recorded identity no longer matches (reused by
|
|
2489
2489
|
// another process): the agent we spawned is gone, so stop waiting on it.
|
|
2490
2490
|
if (!deps.spawnDeps.kill(pid, pidStart, escalate ? 'SIGKILL' : 'SIGTERM'))
|
|
2491
|
-
return
|
|
2491
|
+
return 'gone';
|
|
2492
|
+
const escalatedAt = currentDispatchStamp(slot.kill_escalated_at, slot.spawned_at, now);
|
|
2493
|
+
const ineffective = escalatedAt !== null && now.getTime() - Date.parse(escalatedAt) >= dispatch_1.KILL_ESCALATION_MS;
|
|
2494
|
+
if (ineffective) {
|
|
2495
|
+
const firstIneffective = currentDispatchStamp(slot.kill_ineffective_at, slot.spawned_at, now) === null;
|
|
2496
|
+
if (firstIneffective) {
|
|
2497
|
+
deps.store.withLock((s) => ({
|
|
2498
|
+
state: (0, state_1.patchSlot)(s, slot.id, { kill_ineffective_at: now.toISOString() }, now),
|
|
2499
|
+
result: undefined,
|
|
2500
|
+
}));
|
|
2501
|
+
journalEvent(deps, 'kill-ineffective', unit(batchId), {
|
|
2502
|
+
issue: memberIssue,
|
|
2503
|
+
pid,
|
|
2504
|
+
slot: slot.id,
|
|
2505
|
+
detail: `agent remained alive ${dispatch_1.KILL_ESCALATION_MS / 1000}s after SIGKILL — blocking for operator`,
|
|
2506
|
+
});
|
|
2507
|
+
blockBatchForOperator(deps, config, batchId, { reason: 'agent-unkillable' }, now, result);
|
|
2508
|
+
}
|
|
2509
|
+
return 'unkillable';
|
|
2510
|
+
}
|
|
2492
2511
|
const firstEscalation = escalate && currentDispatchStamp(slot.kill_escalated_at, slot.spawned_at, now) === null;
|
|
2493
2512
|
if (sentAt === null || firstEscalation) {
|
|
2494
2513
|
deps.store.withLock((s) => {
|
|
@@ -2522,7 +2541,7 @@ function stopAgentBeforeDeciding(deps, batchId, memberIssue, slot, now) {
|
|
|
2522
2541
|
detail: `agent still alive ${Math.round(aliveForMs / 1000)}s after SIGTERM (bound ${dispatch_1.KILL_ESCALATION_MS / 1000}s) — sent SIGKILL (to its process group where available)`,
|
|
2523
2542
|
});
|
|
2524
2543
|
}
|
|
2525
|
-
return
|
|
2544
|
+
return 'waiting';
|
|
2526
2545
|
}
|
|
2527
2546
|
/**
|
|
2528
2547
|
* #822 (#810 proposal 3): the member's dispatch ran the wrong procedure (a
|
|
@@ -2538,12 +2557,12 @@ function stopAgentBeforeDeciding(deps, batchId, memberIssue, slot, now) {
|
|
|
2538
2557
|
* `evictMemberAndContinue`/`evictParallelMember`, which commits it in the
|
|
2539
2558
|
* eviction's own write (#844).
|
|
2540
2559
|
*/
|
|
2541
|
-
function repromptWrongProcedure(deps, batchId, memberIssue, milestoneAt, slot, release, now) {
|
|
2560
|
+
function repromptWrongProcedure(deps, config, batchId, memberIssue, milestoneAt, slot, release, now, result) {
|
|
2542
2561
|
// Never respawn into (or release) a worktree the old agent is still in: a
|
|
2543
2562
|
// dying full-cycle run could still push, post, or open a PR. Signal it and
|
|
2544
2563
|
// decide on a later tick, once it is gone — and so the re-prompt's
|
|
2545
2564
|
// `reprompted_at` fence postdates everything it could still post.
|
|
2546
|
-
if (stopAgentBeforeDeciding(deps, batchId, memberIssue, slot, now))
|
|
2565
|
+
if (stopAgentBeforeDeciding(deps, config, batchId, memberIssue, slot, now, result) !== 'gone')
|
|
2547
2566
|
return 'waiting';
|
|
2548
2567
|
const outcome = deps.store.withLock((s) => {
|
|
2549
2568
|
const b = (0, state_1.findBatch)(s, batchId);
|
|
@@ -2597,15 +2616,15 @@ function wrongProcedureFailure(lastTool, shippedPr = null) {
|
|
|
2597
2616
|
* a re-prompt. On an eviction the slot is still held: the caller passes
|
|
2598
2617
|
* `release` to the eviction, which commits both in one write (#844).
|
|
2599
2618
|
*/
|
|
2600
|
-
function decideWrongProcedure(deps, batchId, memberIssue, milestone, slot, release, lastTool, now) {
|
|
2619
|
+
function decideWrongProcedure(deps, config, batchId, memberIssue, milestone, slot, release, lastTool, now, result) {
|
|
2601
2620
|
const shipped = (0, groundtruth_1.wrongProcedureShippedPr)(milestone);
|
|
2602
2621
|
if (shipped !== null) {
|
|
2603
|
-
if (stopAgentBeforeDeciding(deps, batchId, memberIssue, slot, now))
|
|
2622
|
+
if (stopAgentBeforeDeciding(deps, config, batchId, memberIssue, slot, now, result) !== 'gone')
|
|
2604
2623
|
return 'waiting';
|
|
2605
2624
|
// #844: the caller's eviction releases the slot in its own write.
|
|
2606
2625
|
return wrongProcedureFailure(lastTool(), shipped);
|
|
2607
2626
|
}
|
|
2608
|
-
const verdict = repromptWrongProcedure(deps, batchId, memberIssue, milestone.at, slot, release, now);
|
|
2627
|
+
const verdict = repromptWrongProcedure(deps, config, batchId, memberIssue, milestone.at, slot, release, now, result);
|
|
2609
2628
|
if (verdict === 'waiting')
|
|
2610
2629
|
return verdict;
|
|
2611
2630
|
// The finished dispatch's run-log entry, exactly once (never while waiting).
|
|
@@ -2688,7 +2707,7 @@ function reconcileMemberSlot(deps, config, dispatch, batchId, slot, now, result)
|
|
|
2688
2707
|
// before the dead/blocked rail, which would otherwise evict it as an
|
|
2689
2708
|
// unverified exit at the first sight.
|
|
2690
2709
|
if (wrongProcedureCounts(batch, memberIssue, read) && read.milestone !== null) {
|
|
2691
|
-
const decision = decideWrongProcedure(deps, batchId, memberIssue, read.milestone, slot, release, () => recordMemberRunLog(deps, dispatch, state0, batchId, batch.executing_member, memberIssue, slot, now), now);
|
|
2710
|
+
const decision = decideWrongProcedure(deps, config, batchId, memberIssue, read.milestone, slot, release, () => recordMemberRunLog(deps, dispatch, state0, batchId, batch.executing_member, memberIssue, slot, now), now, result);
|
|
2692
2711
|
if (typeof decision === 'object') {
|
|
2693
2712
|
evictMemberAndContinue(deps, config, dispatch, batchId, batch, memberIssue, decision, now, result, release);
|
|
2694
2713
|
}
|
|
@@ -4401,7 +4420,11 @@ function reconcileParallelMemberSlot(deps, config, dispatch, batchId, run, slot,
|
|
|
4401
4420
|
// into that tree with its pid no longer tracked anywhere (so neither a
|
|
4402
4421
|
// dissolve nor `sched stop --batch` could stop it). Its work is done —
|
|
4403
4422
|
// stop it first.
|
|
4404
|
-
|
|
4423
|
+
// The member's tree may be rebased or removed immediately after its slot
|
|
4424
|
+
// is released. Keep this slot draining until the agent is really gone so
|
|
4425
|
+
// the #844 SIGKILL bound remains available to a SIGTERM-ignoring agent.
|
|
4426
|
+
if (stopAgentBeforeDeciding(deps, config, batchId, run.issue, slot, now, result) !== 'gone')
|
|
4427
|
+
return;
|
|
4405
4428
|
journalEvent(deps, 'external-advance', unit(batchId), {
|
|
4406
4429
|
issue: run.issue,
|
|
4407
4430
|
detail: 'member review done',
|
|
@@ -4428,7 +4451,7 @@ function reconcileParallelMemberSlot(deps, config, dispatch, batchId, run, slot,
|
|
|
4428
4451
|
if (parallelBatch &&
|
|
4429
4452
|
wrongProcedureCounts(parallelBatch, run.issue, read) &&
|
|
4430
4453
|
read.milestone !== null) {
|
|
4431
|
-
const decision = decideWrongProcedure(deps, batchId, run.issue, read.milestone, slot, release, () => recordMemberRunLog(deps, dispatch, state0, batchId, run.index, run.issue, slot, now), now);
|
|
4454
|
+
const decision = decideWrongProcedure(deps, config, batchId, run.issue, read.milestone, slot, release, () => recordMemberRunLog(deps, dispatch, state0, batchId, run.index, run.issue, slot, now), now, result);
|
|
4432
4455
|
if (typeof decision === 'object') {
|
|
4433
4456
|
evictParallelMember(deps, config, batchId, run, decision, now, result, release);
|
|
4434
4457
|
}
|