claude-code-session-manager 0.139.0 → 0.140.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 +20 -4
- package/dist/assets/AppSettings-CMFEM68R.js +2 -0
- package/dist/assets/History--JwsFnbn.js +2 -0
- package/dist/assets/{HomeClaudeConfig-CGD2Onjv.js → HomeClaudeConfig-ijEXs--3.js} +2 -2
- package/dist/assets/{Panel-Csyd9HbD.js → Panel-CALyU0pe.js} +1 -1
- package/dist/assets/{ProjectClaudeConfig-C-jlYpC_.js → ProjectClaudeConfig-sdlA-fUb.js} +1 -1
- package/dist/assets/Scheduler-YT3j8SUa.js +16 -0
- package/dist/assets/{SkillReferenceGraph-DcscPXAG.js → SkillReferenceGraph-CxAuwhNN.js} +1 -1
- package/dist/assets/{Skills-BpGRKOcY.js → Skills-DtRzghn5.js} +26 -26
- package/dist/assets/{TiptapBody-DSU3769X.js → TiptapBody-DApeu7x8.js} +1 -1
- package/dist/assets/{ViewTabs-C0PRZx4_.js → ViewTabs-B7qLXRAH.js} +1 -1
- package/dist/assets/{VoiceButton-D2rMurNg.js → VoiceButton-DtStfv1H.js} +1 -1
- package/dist/assets/{historyTotals-TcIQs2sh.js → historyTotals-ydfnwepc.js} +1 -1
- package/dist/assets/index-CtxruO1L.js +3121 -0
- package/dist/assets/{index-BCySPdtU.css → index-DKXdXfka.css} +1 -1
- package/dist/index.html +2 -2
- package/dist-web/app.css +1 -1
- package/dist-web/app.js +423 -426
- package/package.json +5 -2
- package/plugins/AGENTS.md +60 -0
- package/plugins/CLAUDE.md +1 -60
- package/plugins/session-manager-dev/skills/develop/SKILL.md +26 -19
- package/plugins/session-manager-dev/skills/maintaining-md-network/SKILL.md +5 -4
- package/plugins/session-manager-dev/skills/maintaining-md-network/audit.md +4 -2
- package/plugins/session-manager-dev/skills/maintaining-md-network/drift-check.md +16 -12
- package/plugins/session-manager-dev/skills/maintaining-md-network/migrate-to-agents-md.md +15 -0
- package/plugins/session-manager-dev/skills/maintaining-md-network/placement.md +50 -2
- package/plugins/session-manager-dev/skills/maintaining-md-network/plan.md +10 -10
- package/plugins/session-manager-dev/skills/maintaining-md-network/scripts/drift-check.cjs +117 -112
- package/plugins/session-manager-dev/skills/maintaining-md-network/scripts/mdDuplicates.cjs +182 -0
- package/plugins/session-manager-dev/skills/maintaining-md-network/scripts/mdLinks.cjs +340 -0
- package/scripts/README.md +1 -0
- package/scripts/hooks/guard-tool-risk.cjs +91 -0
- package/scripts/hooks/lib/guard-tool-risk-policy.cjs +217 -0
- package/scripts/ops-sweep.cjs +53 -23
- package/scripts/scheduler-mcp-server.cjs +200 -18
- package/src/main/build-info.json +4 -4
- package/src/main/config.cjs +112 -8
- package/src/main/docEdit.cjs +6 -1
- package/src/main/files.cjs +7 -27
- package/src/main/health.cjs +48 -15
- package/src/main/historyAggregator.cjs +88 -5
- package/src/main/historyDashboard.cjs +69 -4
- package/src/main/index.cjs +56 -2
- package/src/main/ipcSchemas.cjs +112 -16
- package/src/main/lib/AGENTS.md +54 -0
- package/src/main/lib/CLAUDE.md +1 -54
- package/src/main/lib/agent-cli/adapters/codex.cjs +5 -2
- package/src/main/lib/agent-cli/agentCliIpc.cjs +18 -2
- package/src/main/lib/agent-cli/agentCliSessionStore.cjs +1 -0
- package/src/main/lib/agent-cli/agentCliTurn.cjs +20 -2
- package/src/main/lib/agent-cli/geminiContextDefaults.cjs +94 -0
- package/src/main/lib/claude/effectiveModelInfo.cjs +90 -20
- package/src/main/lib/claude/jobSandboxPolicy.cjs +202 -0
- package/src/main/lib/claude/personaToolScope.cjs +12 -6
- package/src/main/lib/claude/rateLimitDetect.cjs +13 -2
- package/src/main/lib/claude/runClaudeP.cjs +6 -1
- package/src/main/lib/claude/toolRiskIpc.cjs +177 -0
- package/src/main/lib/claude/toolRiskMarks.cjs +373 -0
- package/src/main/lib/demo-video-kit/seedKit.cjs +27 -6
- package/src/main/lib/ephemeralCwd.cjs +37 -2
- package/src/main/lib/epic/delegationReadiness.cjs +42 -9
- package/src/main/lib/epic/epicAdminRoutes.cjs +25 -5
- package/src/main/lib/epic/epicOutsideRead.cjs +118 -1
- package/src/main/lib/epic/epicOutsideState.cjs +2 -2
- package/src/main/lib/epic/epicSweepValidator.cjs +7 -2
- package/src/main/lib/epic/epicValidationHook.cjs +24 -4
- package/src/main/lib/epic/guardSpawnSettings.cjs +57 -1
- package/src/main/lib/externalContract.cjs +31 -5
- package/src/main/lib/feedback-remote/crossProjectFeedback.cjs +55 -1
- package/src/main/lib/feedback-remote/crossProjectReply.cjs +106 -11
- package/src/main/lib/feedback-remote/macroAdminRoutes.cjs +47 -19
- package/src/main/lib/feedback-remote/needsYouStore.cjs +6 -2
- package/src/main/lib/feedback-remote/projectHomeAdminRoutes.cjs +98 -1
- package/src/main/lib/feedback-remote/remoteIpcDispatch.cjs +5 -0
- package/src/main/lib/git/branchSweep.cjs +209 -4
- package/src/main/lib/git/gitWorktree.cjs +41 -5
- package/src/main/lib/guardShims.cjs +1 -1
- package/src/main/lib/historyRollup.cjs +26 -0
- package/src/main/lib/insideHome.cjs +27 -1
- package/src/main/lib/mcpToolCatalog.cjs +122 -12
- package/src/main/lib/mdDocCensus.cjs +59 -78
- package/src/main/lib/mdDocRefs.cjs +71 -93
- package/src/main/lib/mdNetworkScan.cjs +245 -250
- package/src/main/lib/mdReviewRecord.cjs +22 -9
- package/src/main/lib/memoryMdNetwork.cjs +5 -12
- package/src/main/lib/opsOwnership.cjs +18 -2
- package/src/main/lib/opsRetentionSettings.cjs +28 -4
- package/src/main/lib/persona-macro/macroJobDispatch.cjs +90 -20
- package/src/main/lib/persona-macro/macroJobIpc.cjs +144 -46
- package/src/main/lib/persona-macro/macroJobStatus.cjs +87 -9
- package/src/main/lib/persona-macro/macroLibrary.cjs +95 -5
- package/src/main/lib/persona-macro/personaImportHealth.cjs +78 -17
- package/src/main/lib/persona-macro/projectVideoToolCheck.cjs +96 -0
- package/src/main/lib/persona-macro/shippedPersonaSeeds.cjs +11 -0
- package/src/main/lib/prd/depSlugResolve.cjs +104 -4
- package/src/main/lib/prd/prdAdminRoutes.cjs +35 -2
- package/src/main/lib/prd/prdCreate.cjs +351 -23
- package/src/main/lib/prd/prdDisposition.cjs +11 -2
- package/src/main/lib/prd/prdFrontmatter.cjs +96 -3
- package/src/main/lib/process/loginItem.cjs +171 -0
- package/src/main/lib/process/loginItemPlan.cjs +193 -0
- package/src/main/lib/project-pages/playerBridge.cjs +4 -0
- package/src/main/lib/project-pages/videoReview.cjs +268 -0
- package/src/main/lib/project-pages/videoReviewIpc.cjs +229 -0
- package/src/main/lib/scheduler/cpuSample.cjs +131 -4
- package/src/main/lib/scheduler/fixPlanSlug.cjs +4 -3
- package/src/main/lib/scheduler/loadGate.cjs +24 -6
- package/src/main/lib/scheduler/planRecordHarvest.cjs +108 -0
- package/src/main/lib/scheduler/planRecordRetention.cjs +144 -0
- package/src/main/lib/scheduler/queueStore.cjs +7 -0
- package/src/main/lib/scheduler/rcaReport.cjs +21 -1
- package/src/main/lib/scheduler/reaperHelpers.cjs +35 -5
- package/src/main/lib/scheduler/runLogRetention.cjs +104 -3
- package/src/main/lib/scheduler/scheduleJobSchema.cjs +3 -0
- package/src/main/lib/scheduler/schedulerBatch.cjs +25 -48
- package/src/main/lib/scheduler/schedulerPaths.cjs +3 -0
- package/src/main/lib/scheduler/sessionSlots.cjs +176 -21
- package/src/main/lib/scheduler/validationQuality.cjs +282 -0
- package/src/main/lib/scheduler/validatorVerdictSchema.cjs +254 -0
- package/src/main/lib/tasks/taskAdminRoutes.cjs +641 -0
- package/src/main/lib/tasks/taskIpc.cjs +80 -0
- package/src/main/lib/tasks/taskLedger.cjs +502 -0
- package/src/main/lib/tasks/taskRun.cjs +313 -0
- package/src/main/lib/tasks/taskSwitch.cjs +120 -0
- package/src/main/loginItemIpc.cjs +35 -0
- package/src/main/loopEfficiencyHandlers.cjs +10 -1
- package/src/main/projectPages.cjs +6 -15
- package/src/main/promptSessionEvents.cjs +9 -1
- package/src/main/queueOps.cjs +260 -3
- package/src/main/runVerify.cjs +53 -25
- package/src/main/scheduler/AGENTS.md +26 -0
- package/src/main/scheduler/CLAUDE.md +1 -26
- package/src/main/scheduler/budget.cjs +239 -9
- package/src/main/scheduler/cancelDependents.cjs +154 -0
- package/src/main/scheduler/prdParser.cjs +4 -1
- package/src/main/scheduler/starvation.cjs +20 -18
- package/src/main/scheduler.cjs +745 -64
- package/src/main/supervisor.cjs +5 -1
- package/src/main/templates/PRD_AUTHORING.md +6 -1
- package/src/main/validationQualityHandlers.cjs +199 -0
- package/src/main/webRemote.cjs +10 -2
- package/src/preload/api.d.ts +364 -21
- package/src/preload/apiSurface.json +89 -10
- package/src/preload/index.cjs +23 -2
- package/src/seed/agents/validator.md +19 -8
- package/dist/assets/AppSettings-CUfWY9vN.js +0 -2
- package/dist/assets/History-DDnqaLyw.js +0 -2
- package/dist/assets/Scheduler-NLs08fx7.js +0 -16
- package/dist/assets/index-C-d0DCre.js +0 -3124
|
@@ -6,13 +6,17 @@
|
|
|
6
6
|
*/
|
|
7
7
|
'use strict';
|
|
8
8
|
|
|
9
|
+
const crypto = require('node:crypto');
|
|
9
10
|
const fsp = require('node:fs/promises');
|
|
10
11
|
const path = require('node:path');
|
|
11
12
|
const { claudePidAlive } = require('../lib/scheduler/reaperHelpers.cjs');
|
|
12
13
|
const queueHistory = require('../lib/scheduler/queueHistory.cjs');
|
|
13
14
|
const { listArchivedPrdDirs } = require('../lib/prd/prdLocations.cjs');
|
|
14
15
|
const { LEGAL_TRANSITIONS } = require('../lib/scheduler/scheduleJobTransitions.cjs');
|
|
15
|
-
const {
|
|
16
|
+
const {
|
|
17
|
+
DEFAULT_PROJECT_CWD, DEP_HISTORY_FAIL_OPEN, enqueueTimestamp, findBlockingDep,
|
|
18
|
+
} = require('../lib/scheduler/schedulerBatch.cjs');
|
|
19
|
+
const { makeDepResolver, isCancelledRow, isSatisfiedDepRow } = require('../lib/prd/depSlugResolve.cjs');
|
|
16
20
|
const {
|
|
17
21
|
JOB_OVERRUN_FACTOR: JOB_OVERRUN_FACTOR_DEFAULT,
|
|
18
22
|
JOB_OVERRUN_FLOOR_MS: JOB_OVERRUN_FLOOR_MS_DEFAULT,
|
|
@@ -39,6 +43,19 @@ const JOB_BUDGET_FACTOR = numEnvOverride('SM_JOB_BUDGET_FACTOR', 1, JOB_BUDGET_F
|
|
|
39
43
|
const JOB_BUDGET_FLOOR_MS = numEnvOverride('SM_JOB_BUDGET_FLOOR_MINUTES', 60_000, JOB_BUDGET_FLOOR_MS_DEFAULT);
|
|
40
44
|
const JOB_BUDGET_CEILING_MS = numEnvOverride('SM_JOB_BUDGET_CEILING_MINUTES', 60_000, JOB_BUDGET_CEILING_MS_DEFAULT);
|
|
41
45
|
|
|
46
|
+
/**
|
|
47
|
+
* isNonProblemRow(row) — a row that is NOT waiting on anyone: completed,
|
|
48
|
+
* skipped, or a `failed` row a human cancelled (isCancelledRow — `cancelledAt`
|
|
49
|
+
* or an error starting 'cancelled via admin API'). A cancel is a decision,
|
|
50
|
+
* not a fault; counting it as a parked problem flagged Self's closed Epic
|
|
51
|
+
* (cancelled 1012-1016) as stalled every ~8 minutes (2026-11-22).
|
|
52
|
+
*/
|
|
53
|
+
function isNonProblemRow(row) {
|
|
54
|
+
if (!row) return false;
|
|
55
|
+
if (row.status === 'completed' || row.status === 'skipped') return true;
|
|
56
|
+
return row.status === 'failed' && isCancelledRow(row);
|
|
57
|
+
}
|
|
58
|
+
|
|
42
59
|
/**
|
|
43
60
|
* computeStallSummary(state) → { stalled, total, running, pending, byProject }
|
|
44
61
|
*
|
|
@@ -68,25 +85,29 @@ function computeStallSummary(state) {
|
|
|
68
85
|
let running = 0;
|
|
69
86
|
let pending = 0;
|
|
70
87
|
const byProject = {};
|
|
88
|
+
// Per-project "holds at least one parked problem row" — tracked beside the
|
|
89
|
+
// status counts (not as a count key) so the counts stay a pure status tally.
|
|
90
|
+
const problemByProject = new Map();
|
|
71
91
|
for (const j of jobs) {
|
|
72
92
|
if (j.status === 'running') running += 1;
|
|
73
93
|
if (j.status === 'pending') pending += 1;
|
|
74
94
|
const key = j.cwd || '(unknown)';
|
|
75
95
|
byProject[key] = byProject[key] || {};
|
|
76
96
|
byProject[key][j.status] = (byProject[key][j.status] || 0) + 1;
|
|
97
|
+
if (j.status !== 'running' && j.status !== 'pending' && !isNonProblemRow(j)) problemByProject.set(key, true);
|
|
77
98
|
}
|
|
78
99
|
for (const inv of invalidJobs) {
|
|
79
100
|
const key = inv.row?.cwd || '(unknown)';
|
|
80
101
|
byProject[key] = byProject[key] || {};
|
|
81
102
|
byProject[key].invalid = (byProject[key].invalid || 0) + 1;
|
|
103
|
+
problemByProject.set(key, true);
|
|
82
104
|
}
|
|
83
105
|
const total = jobs.length + invalidJobs.length;
|
|
84
|
-
// A drained queue (every row completed/skipped) is idle, not
|
|
85
|
-
// stall needs at least one parked problem row (failed/
|
|
86
|
-
// quarantined/invalid) that is waiting on someone.
|
|
87
|
-
const isProblemStatus = (st) => st !== 'completed' && st !== 'skipped';
|
|
106
|
+
// A drained queue (every row completed/skipped/cancelled) is idle, not
|
|
107
|
+
// stalled — a stall needs at least one parked problem row (failed/
|
|
108
|
+
// needs_review/quarantined/invalid) that is waiting on someone.
|
|
88
109
|
const stalled = total > 0 && running === 0 && pending === 0 && !state?.paused
|
|
89
|
-
&& (invalidJobs.length > 0 || jobs.some((j) =>
|
|
110
|
+
&& (invalidJobs.length > 0 || jobs.some((j) => j.status !== 'running' && j.status !== 'pending' && !isNonProblemRow(j)));
|
|
90
111
|
for (const key of Object.keys(byProject)) {
|
|
91
112
|
const counts = byProject[key];
|
|
92
113
|
const projRunning = counts.running || 0;
|
|
@@ -94,13 +115,208 @@ function computeStallSummary(state) {
|
|
|
94
115
|
const projTotal = Object.keys(counts)
|
|
95
116
|
.filter((k) => k !== 'stalled')
|
|
96
117
|
.reduce((sum, k) => sum + counts[k], 0);
|
|
97
|
-
|
|
98
|
-
.
|
|
99
|
-
counts.stalled = projTotal > 0 && projRunning === 0 && projPending === 0 && !state?.paused && projProblem;
|
|
118
|
+
counts.stalled = projTotal > 0 && projRunning === 0 && projPending === 0 && !state?.paused
|
|
119
|
+
&& problemByProject.get(key) === true;
|
|
100
120
|
}
|
|
101
121
|
return { stalled, total, running, pending, byProject };
|
|
102
122
|
}
|
|
103
123
|
|
|
124
|
+
/** Statuses a dependency can sit in that will never clear on their own. */
|
|
125
|
+
const DEAD_DEP_STATUSES = new Set(['failed', 'cancelled', 'unresolved', 'skipped', 'needs_review', 'quarantined']);
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* classifyPendingHolds(jobs, { satisfiedSlugsByCwd, holds, now, thresholdMs, loadGated })
|
|
129
|
+
* → [{ slug, cwd, ageMs, cause, dep?, depSlug?, depStatus?, rootSlug?, rootStatus?, overlapWith? }]
|
|
130
|
+
*
|
|
131
|
+
* Pure, no IO. Every `pending` row that has waited longer than `thresholdMs`
|
|
132
|
+
* (age from schedulerBatch.enqueueTimestamp) gets ONE cause, checked in order:
|
|
133
|
+
* - 'dependency' — findBlockingDep names a dep (the same resolver
|
|
134
|
+
* dispatch uses). `depSlug`/`depStatus` name the
|
|
135
|
+
* resolved blocking ROW ('cancelled' for a human cancel,
|
|
136
|
+
* 'unresolved' with depSlug null when no row/record
|
|
137
|
+
* exists). `rootSlug`/`rootStatus` follow pending
|
|
138
|
+
* blockers down the chain to the row actually stuck.
|
|
139
|
+
* - 'files-overlap' — the picker's `holds` carries a files-overlap record.
|
|
140
|
+
* - 'load-gate' — the last tick was load-deferred (`loadGated`).
|
|
141
|
+
* - 'concurrency' — otherwise: eligible, simply waiting for a slot.
|
|
142
|
+
* `satisfiedSlugsByCwd` is budget.computeDepHistorySatisfaction's map (a
|
|
143
|
+
* DEP_HISTORY_FAIL_OPEN value fails that project open, as dispatch does).
|
|
144
|
+
*/
|
|
145
|
+
function classifyPendingHolds(jobs, opts = {}) {
|
|
146
|
+
const {
|
|
147
|
+
satisfiedSlugsByCwd = new Map(), holds = [], now = Date.now(), thresholdMs = 0, loadGated = false,
|
|
148
|
+
} = opts;
|
|
149
|
+
const all = Array.isArray(jobs) ? jobs : [];
|
|
150
|
+
const byCwd = new Map();
|
|
151
|
+
for (const j of all) {
|
|
152
|
+
const cwd = j.cwd || DEFAULT_PROJECT_CWD;
|
|
153
|
+
if (!byCwd.has(cwd)) byCwd.set(cwd, []);
|
|
154
|
+
byCwd.get(cwd).push(j);
|
|
155
|
+
}
|
|
156
|
+
const holdBySlug = new Map();
|
|
157
|
+
for (const h of holds ?? []) if (h?.slug && !holdBySlug.has(h.slug)) holdBySlug.set(h.slug, h);
|
|
158
|
+
|
|
159
|
+
const out = [];
|
|
160
|
+
for (const [cwd, projectJobs] of byCwd) {
|
|
161
|
+
const sat = satisfiedSlugsByCwd instanceof Map ? satisfiedSlugsByCwd.get(cwd) : undefined;
|
|
162
|
+
const failOpen = sat === DEP_HISTORY_FAIL_OPEN;
|
|
163
|
+
const resolver = makeDepResolver(projectJobs, failOpen ? new Set() : (sat ?? new Set()), { failOpen });
|
|
164
|
+
const blockerOf = (job) => {
|
|
165
|
+
const dep = findBlockingDep(job, projectJobs, null, resolver);
|
|
166
|
+
if (!dep) return null;
|
|
167
|
+
const { rows } = resolver.resolve(dep, job);
|
|
168
|
+
const row = rows.find((r) => !isSatisfiedDepRow(r)) ?? null;
|
|
169
|
+
if (!row) return { dep, row: null, depSlug: null, depStatus: 'unresolved' };
|
|
170
|
+
return { dep, row, depSlug: row.slug, depStatus: isCancelledRow(row) ? 'cancelled' : row.status };
|
|
171
|
+
};
|
|
172
|
+
for (const job of projectJobs) {
|
|
173
|
+
if (job.status !== 'pending') continue;
|
|
174
|
+
const ageMs = now - enqueueTimestamp(job);
|
|
175
|
+
if (!(ageMs >= thresholdMs)) continue;
|
|
176
|
+
const base = { slug: job.slug, cwd, ageMs: Number.isFinite(ageMs) ? ageMs : null };
|
|
177
|
+
const blocker = blockerOf(job);
|
|
178
|
+
if (blocker) {
|
|
179
|
+
// Follow pending blockers to the root actually stuck (cycle-safe).
|
|
180
|
+
let root = blocker;
|
|
181
|
+
let cycle = false;
|
|
182
|
+
const seen = new Set([job.slug]);
|
|
183
|
+
while (root.row && root.row.status === 'pending') {
|
|
184
|
+
if (seen.has(root.row.slug)) { cycle = true; break; }
|
|
185
|
+
seen.add(root.row.slug);
|
|
186
|
+
const next = blockerOf(root.row);
|
|
187
|
+
if (!next) break;
|
|
188
|
+
root = next;
|
|
189
|
+
}
|
|
190
|
+
out.push({
|
|
191
|
+
...base,
|
|
192
|
+
cause: 'dependency',
|
|
193
|
+
dep: blocker.dep,
|
|
194
|
+
depSlug: blocker.depSlug,
|
|
195
|
+
depStatus: blocker.depStatus,
|
|
196
|
+
rootSlug: root.depSlug,
|
|
197
|
+
rootStatus: cycle ? 'cycle' : root.depStatus,
|
|
198
|
+
});
|
|
199
|
+
continue;
|
|
200
|
+
}
|
|
201
|
+
const hold = holdBySlug.get(job.slug);
|
|
202
|
+
if (typeof hold?.reason === 'string' && hold.reason.startsWith('files-overlap')) {
|
|
203
|
+
out.push({ ...base, cause: 'files-overlap', overlapWith: hold.reason.slice('files-overlap:'.length) || null });
|
|
204
|
+
continue;
|
|
205
|
+
}
|
|
206
|
+
out.push({ ...base, cause: loadGated ? 'load-gate' : 'concurrency' });
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
return out;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* findDependencyStalledProjects(jobs, classified) → { [cwd]: [{ slug, dep, depSlug, depStatus }] }
|
|
214
|
+
*
|
|
215
|
+
* Pure. A project is dependency-stalled when it has pending rows, nothing
|
|
216
|
+
* running, and EVERY pending row is classified 'dependency' whose chain ends
|
|
217
|
+
* at a row that will never clear on its own (DEAD_DEP_STATUSES — failed,
|
|
218
|
+
* cancelled, unresolved, ...). computeStallSummary can't see this: it needs
|
|
219
|
+
* 0 pending, and the Self incident held 16 pending rows behind a cancelled dep.
|
|
220
|
+
*/
|
|
221
|
+
function findDependencyStalledProjects(jobs, classified) {
|
|
222
|
+
const pendingByCwd = new Map();
|
|
223
|
+
const runningCwds = new Set();
|
|
224
|
+
for (const j of Array.isArray(jobs) ? jobs : []) {
|
|
225
|
+
const cwd = j.cwd || DEFAULT_PROJECT_CWD;
|
|
226
|
+
if (j.status === 'running') runningCwds.add(cwd);
|
|
227
|
+
if (j.status === 'pending') pendingByCwd.set(cwd, (pendingByCwd.get(cwd) || 0) + 1);
|
|
228
|
+
}
|
|
229
|
+
const heldByCwd = new Map();
|
|
230
|
+
for (const c of classified ?? []) {
|
|
231
|
+
if (c.cause !== 'dependency' || !DEAD_DEP_STATUSES.has(c.rootStatus)) continue;
|
|
232
|
+
if (!heldByCwd.has(c.cwd)) heldByCwd.set(c.cwd, []);
|
|
233
|
+
heldByCwd.get(c.cwd).push({ slug: c.slug, dep: c.dep, depSlug: c.depSlug, depStatus: c.depStatus });
|
|
234
|
+
}
|
|
235
|
+
const out = {};
|
|
236
|
+
for (const [cwd, held] of heldByCwd) {
|
|
237
|
+
if (runningCwds.has(cwd)) continue;
|
|
238
|
+
if (held.length !== pendingByCwd.get(cwd)) continue;
|
|
239
|
+
out[cwd] = held;
|
|
240
|
+
}
|
|
241
|
+
return out;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
/** A dependency hold this old on a failed/cancelled row earns a Needs-you item. */
|
|
245
|
+
const DEP_HOLD_NOTICE_MS = 30 * 60_000;
|
|
246
|
+
/** Root statuses a Needs-you dep-hold notice is posted for (a human can fix these in one click). */
|
|
247
|
+
const DEP_HOLD_NOTICE_STATUSES = new Set(['failed', 'cancelled']);
|
|
248
|
+
const DEP_HOLD_NOTICE_ID_PREFIX = 'stall-dep-hold:';
|
|
249
|
+
|
|
250
|
+
/**
|
|
251
|
+
* depHoldNoticeId(cwd, blockerSlug) → string
|
|
252
|
+
* Stable Needs-you id for one (project, blocking row) pair. The cwd is hashed
|
|
253
|
+
* (a path can hold characters the Needs-you id pattern refuses); the slug is
|
|
254
|
+
* kept readable, with any refused character replaced by '-'.
|
|
255
|
+
*/
|
|
256
|
+
function depHoldNoticeId(cwd, blockerSlug) {
|
|
257
|
+
const h = crypto.createHash('sha1').update(String(cwd)).digest('hex').slice(0, 12);
|
|
258
|
+
const slug = String(blockerSlug).replace(/[^A-Za-z0-9._:/@-]/g, '-').slice(0, 160);
|
|
259
|
+
return `${DEP_HOLD_NOTICE_ID_PREFIX}${h}:${slug}`;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
/**
|
|
263
|
+
* selectDepHoldNotices(classified, prevOpen, { thresholdMs }) → { post, withdraw }
|
|
264
|
+
*
|
|
265
|
+
* Pure. Given classifyPendingHolds output and the ids of dep-hold notices
|
|
266
|
+
* already open (a Set or array), decide which (cwd, blocking slug) pairs need
|
|
267
|
+
* a Needs-you post and which open notices must be withdrawn:
|
|
268
|
+
* - post: a pair NOT already open where at least one pending row has been
|
|
269
|
+
* held over `thresholdMs` by a chain whose root is a failed or cancelled
|
|
270
|
+
* row → { id, cwd, blockerSlug, blockerStatus, heldSlugs } (heldSlugs =
|
|
271
|
+
* every row that pair currently holds, sorted). Once open it is never
|
|
272
|
+
* re-posted in the same episode.
|
|
273
|
+
* - withdraw: an open id for which no pending row is held by that blocker
|
|
274
|
+
* any more (any age — a younger re-hold keeps the episode open).
|
|
275
|
+
*/
|
|
276
|
+
function selectDepHoldNotices(classified, prevOpen, opts = {}) {
|
|
277
|
+
const { thresholdMs = DEP_HOLD_NOTICE_MS } = opts;
|
|
278
|
+
const open = new Set(prevOpen ?? []);
|
|
279
|
+
const held = new Map();
|
|
280
|
+
for (const c of classified ?? []) {
|
|
281
|
+
if (c?.cause !== 'dependency' || !c.rootSlug || !DEP_HOLD_NOTICE_STATUSES.has(c.rootStatus)) continue;
|
|
282
|
+
const id = depHoldNoticeId(c.cwd, c.rootSlug);
|
|
283
|
+
if (!held.has(id)) {
|
|
284
|
+
held.set(id, { id, cwd: c.cwd, blockerSlug: c.rootSlug, blockerStatus: c.rootStatus, heldSlugs: [], due: false });
|
|
285
|
+
}
|
|
286
|
+
const entry = held.get(id);
|
|
287
|
+
entry.heldSlugs.push(c.slug);
|
|
288
|
+
if (Number.isFinite(c.ageMs) && c.ageMs >= thresholdMs) entry.due = true;
|
|
289
|
+
}
|
|
290
|
+
const post = [];
|
|
291
|
+
for (const entry of held.values()) {
|
|
292
|
+
if (!entry.due || open.has(entry.id)) continue;
|
|
293
|
+
const { due, ...rest } = entry;
|
|
294
|
+
post.push({ ...rest, heldSlugs: [...rest.heldSlugs].sort() });
|
|
295
|
+
}
|
|
296
|
+
const withdraw = [...open].filter((id) => !held.has(id));
|
|
297
|
+
return { post, withdraw };
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
/**
|
|
301
|
+
* formatDepHoldNotice({ cwd, blockerSlug, blockerStatus, heldSlugs }) → { title, why }
|
|
302
|
+
* Pure. The Needs-you text: which rows are held, by which row in which
|
|
303
|
+
* state, and the one-click fix (reset it, or archive/dismiss it).
|
|
304
|
+
*/
|
|
305
|
+
function formatDepHoldNotice({ cwd, blockerSlug, blockerStatus, heldSlugs }) {
|
|
306
|
+
const project = path.basename(String(cwd)) || String(cwd);
|
|
307
|
+
const n = heldSlugs.length;
|
|
308
|
+
const title = `Scheduler: ${n} PRD${n === 1 ? '' : 's'} in ${project} held by ${blockerStatus} ${blockerSlug}`
|
|
309
|
+
.replace(/[\r\n]+/g, ' ').slice(0, 200);
|
|
310
|
+
const shown = heldSlugs.slice(0, 20).join(', ') + (n > 20 ? `, and ${n - 20} more` : '');
|
|
311
|
+
const why = [
|
|
312
|
+
`${n} pending PRD${n === 1 ? '' : 's'} in ${cwd} cannot run: ${shown} ${n === 1 ? 'waits' : 'wait'} `
|
|
313
|
+
+ `(directly or down the dependsOn chain) on ${blockerSlug}, which is ${blockerStatus}.`,
|
|
314
|
+
`Fix: in the Scheduler tab, Reset ${blockerSlug} to run it again, or archive/dismiss it `
|
|
315
|
+
+ 'so its dependents stop waiting on it. This item closes by itself once nothing is held by it.',
|
|
316
|
+
].join(' ').slice(0, 1000);
|
|
317
|
+
return { title, why };
|
|
318
|
+
}
|
|
319
|
+
|
|
104
320
|
/**
|
|
105
321
|
* findStaleQuarantinedJobs(jobs, now, thresholdMs) → [{ slug, cwd, ageMs }]
|
|
106
322
|
*
|
|
@@ -518,6 +734,11 @@ async function computeDepHistorySatisfaction(state) {
|
|
|
518
734
|
try {
|
|
519
735
|
for (const slug of await queueHistory.completedSlugsForCwd(cwd)) satisfied.add(slug);
|
|
520
736
|
for (const dir of listArchivedPrdDirs(cwd)) {
|
|
737
|
+
// Only prds-archived/ means "shipped". A dismissed cancelled PRD lives
|
|
738
|
+
// in the sibling prds-cancelled/ (queueOps.dismissCancelled) and must
|
|
739
|
+
// NEVER satisfy a dependsOn — guard by name so a future change to
|
|
740
|
+
// listArchivedPrdDirs cannot start counting it (PRD 3492).
|
|
741
|
+
if (path.basename(dir) !== 'prds-archived') continue;
|
|
521
742
|
let entries;
|
|
522
743
|
try { entries = await fsp.readdir(dir, { withFileTypes: true }); } catch { continue; }
|
|
523
744
|
for (const ent of entries) {
|
|
@@ -731,6 +952,15 @@ module.exports = {
|
|
|
731
952
|
JOB_BUDGET_FLOOR_MS,
|
|
732
953
|
JOB_BUDGET_CEILING_MS,
|
|
733
954
|
computeStallSummary,
|
|
955
|
+
isCancelledRow,
|
|
956
|
+
isNonProblemRow,
|
|
957
|
+
classifyPendingHolds,
|
|
958
|
+
findDependencyStalledProjects,
|
|
959
|
+
DEP_HOLD_NOTICE_MS,
|
|
960
|
+
DEP_HOLD_NOTICE_ID_PREFIX,
|
|
961
|
+
depHoldNoticeId,
|
|
962
|
+
selectDepHoldNotices,
|
|
963
|
+
formatDepHoldNotice,
|
|
734
964
|
findStaleQuarantinedJobs,
|
|
735
965
|
findOverrunningJobs,
|
|
736
966
|
computeJobBudgetMs,
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* cancelDependents.cjs — pure planning for remote.cancelJob's dependents
|
|
5
|
+
* choice (PRD 3499). Cancelling a row with pending dependents used to leave
|
|
6
|
+
* every dependent pointing at a dead (failed) row — the 2026-11-22 Self stall.
|
|
7
|
+
* cancelJob now refuses unless the caller says what happens to them:
|
|
8
|
+
*
|
|
9
|
+
* cascade — cancel every pending dependent, transitively
|
|
10
|
+
* repoint — replace the dep on the target with `to` (resolved to a full slug)
|
|
11
|
+
* clear — drop the dep on the target
|
|
12
|
+
*
|
|
13
|
+
* No I/O here: scheduler.cjs reads the queue, calls these, then applies the
|
|
14
|
+
* edits (updatePrd for repoint/clear, one mutate for cascade + target).
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
const { makeDepResolver, resolveDepSlug } = require('../lib/prd/depSlugResolve.cjs');
|
|
18
|
+
const { wouldCreateCycle } = require('../lib/prd/prdDisposition.cjs');
|
|
19
|
+
|
|
20
|
+
const DEPENDENTS_ACTIONS = Object.freeze(['cascade', 'repoint', 'clear']);
|
|
21
|
+
|
|
22
|
+
function projectRows(jobs, cwd) {
|
|
23
|
+
return (Array.isArray(jobs) ? jobs : []).filter((j) => j && (cwd == null || j.cwd === cwd));
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function findTarget(rows, slug) {
|
|
27
|
+
return rows.find((j) => j.slug === slug) ?? null;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* The deps of `dependent` that resolve to `target` under the shared run-time
|
|
32
|
+
* rule (exact slug, else bare name with Epic preference).
|
|
33
|
+
*/
|
|
34
|
+
function depsNamingTarget(resolver, dependent, target) {
|
|
35
|
+
const out = [];
|
|
36
|
+
for (const dep of Array.isArray(dependent.dependsOn) ? dependent.dependsOn : []) {
|
|
37
|
+
if (resolver.resolve(dep, dependent).rows.includes(target)) out.push(dep);
|
|
38
|
+
}
|
|
39
|
+
return out;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Pending rows of `cwd` whose dependsOn resolves to the row `slug`. Rows of
|
|
44
|
+
* other projects never count, even with a matching bare name. Returns
|
|
45
|
+
* [{ slug, deps }] in queue order; [] when the target is not in that cwd.
|
|
46
|
+
*/
|
|
47
|
+
function findPendingDependents(jobs, slug, cwd) {
|
|
48
|
+
const rows = projectRows(jobs, cwd);
|
|
49
|
+
const target = findTarget(rows, slug);
|
|
50
|
+
if (!target) return [];
|
|
51
|
+
const resolver = makeDepResolver(rows);
|
|
52
|
+
const out = [];
|
|
53
|
+
for (const j of rows) {
|
|
54
|
+
if (j === target || j.status !== 'pending') continue;
|
|
55
|
+
const deps = depsNamingTarget(resolver, j, target);
|
|
56
|
+
if (deps.length > 0) out.push({ slug: j.slug, deps });
|
|
57
|
+
}
|
|
58
|
+
return out;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/** Every pending dependent of `slug`, transitively (BFS order, target excluded). */
|
|
62
|
+
function findTransitiveDependents(jobs, slug, cwd) {
|
|
63
|
+
const seen = new Set([slug]);
|
|
64
|
+
const order = [];
|
|
65
|
+
const queue = [slug];
|
|
66
|
+
while (queue.length > 0) {
|
|
67
|
+
const cur = queue.shift();
|
|
68
|
+
for (const d of findPendingDependents(jobs, cur, cwd)) {
|
|
69
|
+
if (seen.has(d.slug)) continue;
|
|
70
|
+
seen.add(d.slug);
|
|
71
|
+
order.push(d.slug);
|
|
72
|
+
queue.push(d.slug);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
return order;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* planDependentsUpdate(jobs, slug, choice, cwd?) →
|
|
80
|
+
* { ok: true, action, to, dependents: string[], edits: [...] }
|
|
81
|
+
* | { ok: false, error }
|
|
82
|
+
* `choice` is { action, to? }; `cwd` defaults to `choice.cwd`, else the target
|
|
83
|
+
* row's own cwd. Edits:
|
|
84
|
+
* cascade → { slug, action: 'cancel', reason } (transitive set)
|
|
85
|
+
* repoint → { slug, action: 'setDependsOn', dependsOn, previous }
|
|
86
|
+
* clear → { slug, action: 'setDependsOn', dependsOn, previous }
|
|
87
|
+
*/
|
|
88
|
+
function planDependentsUpdate(jobs, slug, choice, cwd) {
|
|
89
|
+
const action = choice?.action;
|
|
90
|
+
if (!DEPENDENTS_ACTIONS.includes(action)) {
|
|
91
|
+
return { ok: false, error: `dependents.action must be one of ${DEPENDENTS_ACTIONS.join(', ')}` };
|
|
92
|
+
}
|
|
93
|
+
const all = Array.isArray(jobs) ? jobs : [];
|
|
94
|
+
const scopeCwd = cwd ?? choice?.cwd ?? all.find((j) => j?.slug === slug)?.cwd ?? null;
|
|
95
|
+
const rows = projectRows(all, scopeCwd);
|
|
96
|
+
const target = findTarget(rows, slug);
|
|
97
|
+
if (!target) return { ok: false, error: `unknown slug "${slug}"` };
|
|
98
|
+
|
|
99
|
+
if (action === 'cascade') {
|
|
100
|
+
const dependents = findTransitiveDependents(rows, slug, scopeCwd);
|
|
101
|
+
const reason = `cancelled via admin API (cascade: depends on cancelled ${slug})`;
|
|
102
|
+
return {
|
|
103
|
+
ok: true, action, to: null, dependents,
|
|
104
|
+
edits: dependents.map((s) => ({ slug: s, action: 'cancel', reason })),
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
const direct = findPendingDependents(rows, slug, scopeCwd);
|
|
109
|
+
const dependents = direct.map((d) => d.slug);
|
|
110
|
+
let resolvedTo = null;
|
|
111
|
+
if (action === 'repoint') {
|
|
112
|
+
const to = typeof choice.to === 'string' ? choice.to.trim() : '';
|
|
113
|
+
if (!to) return { ok: false, error: 'dependents.action "repoint" requires dependents.to' };
|
|
114
|
+
const matches = resolveDepSlug(to, rows.map((r) => r.slug));
|
|
115
|
+
if (matches.length === 0) {
|
|
116
|
+
return { ok: false, error: `dependents.to "${to}" does not resolve to any queued PRD in this project` };
|
|
117
|
+
}
|
|
118
|
+
if (matches.length > 1) {
|
|
119
|
+
return { ok: false, error: `dependents.to "${to}" is ambiguous (matches ${matches.join(', ')}) — pass the full NN-prefixed slug` };
|
|
120
|
+
}
|
|
121
|
+
resolvedTo = matches[0];
|
|
122
|
+
if (resolvedTo === slug) {
|
|
123
|
+
return { ok: false, error: `dependents.to "${to}" resolves to the job being cancelled (${slug})` };
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
const bySlug = new Map(rows.map((r) => [r.slug, r]));
|
|
128
|
+
const edits = [];
|
|
129
|
+
for (const d of direct) {
|
|
130
|
+
const row = bySlug.get(d.slug);
|
|
131
|
+
const previous = Array.isArray(row.dependsOn) ? [...row.dependsOn] : [];
|
|
132
|
+
const drop = new Set(d.deps);
|
|
133
|
+
const next = [];
|
|
134
|
+
for (const dep of previous) {
|
|
135
|
+
const replacement = drop.has(dep) ? resolvedTo : dep;
|
|
136
|
+
if (replacement != null && !next.includes(replacement)) next.push(replacement);
|
|
137
|
+
}
|
|
138
|
+
if (action === 'repoint') {
|
|
139
|
+
const cycleRows = rows.map((r) => ({ slug: r.slug, dependsOn: r.dependsOn ?? [] }));
|
|
140
|
+
if (wouldCreateCycle(cycleRows, d.slug, next)) {
|
|
141
|
+
return { ok: false, error: `repointing ${d.slug} to ${resolvedTo} would create a dependency cycle` };
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
edits.push({ slug: d.slug, action: 'setDependsOn', dependsOn: next, previous });
|
|
145
|
+
}
|
|
146
|
+
return { ok: true, action, to: resolvedTo, dependents, edits };
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
module.exports = {
|
|
150
|
+
DEPENDENTS_ACTIONS,
|
|
151
|
+
findPendingDependents,
|
|
152
|
+
findTransitiveDependents,
|
|
153
|
+
planDependentsUpdate,
|
|
154
|
+
};
|
|
@@ -17,7 +17,7 @@ const fs = require('node:fs');
|
|
|
17
17
|
const fsp = require('node:fs/promises');
|
|
18
18
|
const os = require('node:os');
|
|
19
19
|
const path = require('node:path');
|
|
20
|
-
const { splitFrontmatter, parseInlineList, PRD_EFFORT_LEVELS } = require('../lib/prd/prdFrontmatter.cjs');
|
|
20
|
+
const { splitFrontmatter, parseInlineList, parseFixes, PRD_EFFORT_LEVELS } = require('../lib/prd/prdFrontmatter.cjs');
|
|
21
21
|
const { deriveEpicIdFromPrdPath } = require('../lib/prd/prdLocations.cjs');
|
|
22
22
|
const { parseFilesSection } = require('../lib/prd/prdGateFiles.cjs');
|
|
23
23
|
const { reportDanglingAgentTypeOnce } = require('../lib/prd/prdAgentType.cjs');
|
|
@@ -112,6 +112,9 @@ async function parsePrdRaw(filePath) {
|
|
|
112
112
|
// queue row is completed (a slug with no row is treated as already
|
|
113
113
|
// done/archived, matching retireCompletedSlugs semantics).
|
|
114
114
|
dependsOn: parseDependsOn(fm.dependsOn),
|
|
115
|
+
// Earlier PRDs this one repairs ({ prd, missKind, reason }[]); null when
|
|
116
|
+
// absent/malformed/empty. reconcile() copies it onto the queue row.
|
|
117
|
+
fixes: (() => { const l = typeof fm.fixes === 'string' ? parseFixes(fm.fixes) : null; return l && l.length ? l : null; })(),
|
|
115
118
|
// Declared touch-list from the body's `# Files` section ([] when absent).
|
|
116
119
|
files: parseFilesSection(body),
|
|
117
120
|
// Provenance stamp (PRD-authoring lockdown): set only by prdCreate.cjs's
|
|
@@ -7,10 +7,15 @@
|
|
|
7
7
|
|
|
8
8
|
const launchFailure = require('../lib/scheduler/launchFailure.cjs');
|
|
9
9
|
const { findBlockingDep, DEP_HISTORY_FAIL_OPEN } = require('../lib/scheduler/schedulerBatch.cjs');
|
|
10
|
+
const { makeDepResolver, isSatisfiedDepRow } = require('../lib/prd/depSlugResolve.cjs');
|
|
10
11
|
const { STARVE_ESCALATION_MS } = require('../lib/scheduler/schedulerConfig.cjs');
|
|
11
12
|
|
|
12
13
|
/**
|
|
13
|
-
* computeBlockedChains(jobs) → [{ cwd, blockedBy, blocked }]
|
|
14
|
+
* computeBlockedChains(jobs, satisfiedSlugsByCwd?) → [{ cwd, blockedBy, blocked }]
|
|
15
|
+
*
|
|
16
|
+
* `satisfiedSlugsByCwd`: optional `Map<cwd, Set<string>|DEP_HISTORY_FAIL_OPEN>`
|
|
17
|
+
* of history/archive completion records (budget.computeDepHistorySatisfaction),
|
|
18
|
+
* fed to the shared dep resolver; default empty (no records known).
|
|
14
19
|
*
|
|
15
20
|
* Pure, no IO. The gap computeStallSummary above cannot see.
|
|
16
21
|
*
|
|
@@ -31,7 +36,7 @@ const { STARVE_ESCALATION_MS } = require('../lib/scheduler/schedulerConfig.cjs')
|
|
|
31
36
|
* Transitive by construction: a row blocked by a row that is itself blocked
|
|
32
37
|
* resolves through the same walk.
|
|
33
38
|
*/
|
|
34
|
-
function computeBlockedChains(jobs) {
|
|
39
|
+
function computeBlockedChains(jobs, satisfiedSlugsByCwd = new Map()) {
|
|
35
40
|
const rows = (Array.isArray(jobs) ? jobs : []).filter(Boolean);
|
|
36
41
|
const byCwd = new Map();
|
|
37
42
|
for (const j of rows) {
|
|
@@ -42,20 +47,14 @@ function computeBlockedChains(jobs) {
|
|
|
42
47
|
|
|
43
48
|
const out = [];
|
|
44
49
|
for (const [cwd, projectJobs] of byCwd) {
|
|
45
|
-
//
|
|
46
|
-
//
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}
|
|
54
|
-
const rowsForDep = (slug) => {
|
|
55
|
-
const exact = rowBySlug.get(slug);
|
|
56
|
-
if (exact) return [exact];
|
|
57
|
-
return rowsByBareSlug.get(String(slug ?? '').replace(/^\d+-/, '')) ?? [];
|
|
58
|
-
};
|
|
50
|
+
// The ONE run-time dep rule (depSlugResolve.cjs makeDepResolver) — the
|
|
51
|
+
// same resolver schedulerBatch.findBlockingDep dispatches with, so this
|
|
52
|
+
// monitor can never disagree with dispatch (exact row, exact satisfied
|
|
53
|
+
// record, Epic-scoped prefixed fallback, cancelled-duplicate drop).
|
|
54
|
+
const satisfied = satisfiedSlugsByCwd?.get?.(cwd) ?? new Set();
|
|
55
|
+
const { rowsForDep } = satisfied === DEP_HISTORY_FAIL_OPEN
|
|
56
|
+
? makeDepResolver(projectJobs, new Set(), { failOpen: true })
|
|
57
|
+
: makeDepResolver(projectJobs, satisfied);
|
|
59
58
|
|
|
60
59
|
// Memoised walk: does this row's dep closure hit a terminally-stuck row?
|
|
61
60
|
const TERMINAL_STUCK = new Set(['failed', 'skipped']);
|
|
@@ -68,9 +67,12 @@ function computeBlockedChains(jobs) {
|
|
|
68
67
|
visiting.add(job.slug);
|
|
69
68
|
const found = new Set();
|
|
70
69
|
for (const depSlug of job.dependsOn ?? []) {
|
|
71
|
-
for (const dep of rowsForDep(depSlug)) {
|
|
70
|
+
for (const dep of rowsForDep(depSlug, job)) {
|
|
71
|
+
// isSatisfiedDepRow: completed, or an auto-resolve skip — the
|
|
72
|
+
// dispatcher's own predicate, so neither is a terminal blocker.
|
|
73
|
+
if (isSatisfiedDepRow(dep)) continue;
|
|
72
74
|
if (TERMINAL_STUCK.has(dep.status)) found.add(dep.slug);
|
|
73
|
-
else
|
|
75
|
+
else for (const b of blockersFor(dep)) found.add(b);
|
|
74
76
|
}
|
|
75
77
|
}
|
|
76
78
|
visiting.delete(job.slug);
|