claude-code-session-manager 0.140.0 → 0.141.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/dist/assets/{AppSettings-CMFEM68R.js → AppSettings-DExeJhqQ.js} +1 -1
- package/dist/assets/{History--JwsFnbn.js → History-DJMiuXyK.js} +1 -1
- package/dist/assets/{HomeClaudeConfig-ijEXs--3.js → HomeClaudeConfig-CTp2tkZ4.js} +2 -2
- package/dist/assets/{Panel-CALyU0pe.js → Panel-Bf1Cf8UL.js} +1 -1
- package/dist/assets/{ProjectClaudeConfig-sdlA-fUb.js → ProjectClaudeConfig-BWPpypf9.js} +1 -1
- package/dist/assets/{Scheduler-YT3j8SUa.js → Scheduler-cyr61UAC.js} +1 -1
- package/dist/assets/{SkillReferenceGraph-CxAuwhNN.js → SkillReferenceGraph-Ba4TkX2C.js} +1 -1
- package/dist/assets/{Skills-DtRzghn5.js → Skills-C1v91GEO.js} +1 -1
- package/dist/assets/{TiptapBody-DApeu7x8.js → TiptapBody-BrcWVpiW.js} +1 -1
- package/dist/assets/{ViewTabs-B7qLXRAH.js → ViewTabs-DXhOWFG0.js} +1 -1
- package/dist/assets/{VoiceButton-DtStfv1H.js → VoiceButton-qivnDV6K.js} +1 -1
- package/dist/assets/{historyTotals-ydfnwepc.js → historyTotals-CMCPTKqC.js} +1 -1
- package/dist/assets/{index-CtxruO1L.js → index-B2TQz3nd.js} +3 -3
- package/dist/index.html +1 -1
- package/dist-web/app.js +1 -1
- package/package.json +1 -1
- package/plugins/session-manager-dev/skills/builder/SKILL.md +4 -2
- package/plugins/session-manager-dev/skills/develop/SKILL.md +3 -0
- package/scripts/scheduler-mcp-server.cjs +5 -0
- package/src/main/build-info.json +4 -4
- package/src/main/ipcSchemas.cjs +10 -0
- package/src/main/lib/mcpToolCatalog.cjs +11 -2
- package/src/main/lib/prd/prdCreate.cjs +27 -1
- package/src/main/lib/prd/prdFrontmatter.cjs +28 -3
- package/src/main/lib/scheduler/preflightCheck.cjs +97 -0
- package/src/main/lib/scheduler/reviewNotice.cjs +39 -0
- package/src/main/scheduler/prdParser.cjs +16 -1
- package/src/main/scheduler/reviewLadder.cjs +36 -3
- package/src/main/scheduler/starvation.cjs +69 -0
- package/src/main/scheduler.cjs +335 -25
- package/src/main/templates/PRD_AUTHORING.md +9 -1
package/src/main/scheduler.cjs
CHANGED
|
@@ -115,7 +115,7 @@ const prdPaths = require('./scheduler/prdPaths.cjs');
|
|
|
115
115
|
const sessionsStore = require('./sessionsStore.cjs');
|
|
116
116
|
const { enqueueExternalPrompt } = require('./chatRunner.cjs');
|
|
117
117
|
const { appendResponseEventIfKnown, appendResponseEventWithReason } = require('./promptSessionEvents.cjs');
|
|
118
|
-
const { buildReviewNotice, selectDueReviewNotices, formatReviewNotice, holdMsFromEnv } = require('./lib/scheduler/reviewNotice.cjs');
|
|
118
|
+
const { buildReviewNotice, selectDueReviewNotices, formatReviewNotice, holdMsFromEnv, buildPreflightHoldNotice, preflightHoldNoticeKey } = require('./lib/scheduler/reviewNotice.cjs');
|
|
119
119
|
const epicValidationHook = require('./lib/epic/epicValidationHook.cjs');
|
|
120
120
|
const prdCreate = require('./lib/prd/prdCreate.cjs');
|
|
121
121
|
const { resolveProjectContext } = require('./lib/projectRootResolve.cjs');
|
|
@@ -171,6 +171,7 @@ const { transitionJob, STATUS_HISTORY_CAP, LEGAL_TRANSITIONS } = require('./lib/
|
|
|
171
171
|
const { buildContextDigest, composeExecutorPrompt } = require('./lib/epic/epicContextDigest.cjs');
|
|
172
172
|
const { JOB_STATUSES } = require('./lib/scheduler/scheduleJobSchema.cjs');
|
|
173
173
|
const { appendAuditEvent } = require('./lib/telemetry/auditLog.cjs');
|
|
174
|
+
const preflightCheck = require('./lib/scheduler/preflightCheck.cjs');
|
|
174
175
|
const needsYouStore = require('./lib/feedback-remote/needsYouStore.cjs');
|
|
175
176
|
const { withTimeout } = require('./lib/util/withTimeout.cjs');
|
|
176
177
|
|
|
@@ -1177,8 +1178,9 @@ function heartbeatTick(deps = {}) {
|
|
|
1177
1178
|
projects: toAlert, total: summary.total, byProject: summary.byProject, heldByDependency,
|
|
1178
1179
|
});
|
|
1179
1180
|
if (mainWindow && !mainWindow.isDestroyed()) {
|
|
1181
|
+
const rootPhrases = toAlert.map((cwd) => rootBlockerPhrase(starveRootFor(projectRowsFor(s.jobs, cwd)).root)).join('');
|
|
1180
1182
|
sendIfAlive(mainWindow, 'schedule:stall', {
|
|
1181
|
-
message: `Scheduler stall in ${toAlert.length} project(s): ${toAlert.join(', ')}
|
|
1183
|
+
message: `Scheduler stall in ${toAlert.length} project(s): ${toAlert.join(', ')}.${rootPhrases} Check the Scheduler tab.`,
|
|
1182
1184
|
projects: toAlert,
|
|
1183
1185
|
total: summary.total,
|
|
1184
1186
|
byProject: summary.byProject,
|
|
@@ -1969,6 +1971,7 @@ async function reconcilePass(state) {
|
|
|
1969
1971
|
deliverable: p.deliverable ?? job.deliverable ?? null,
|
|
1970
1972
|
artifactPaths: p.artifactPaths ?? job.artifactPaths ?? null,
|
|
1971
1973
|
effort: p.effort ?? job.effort ?? null,
|
|
1974
|
+
preflight: p.preflight ?? null,
|
|
1972
1975
|
};
|
|
1973
1976
|
// Adopt path: a row parked 'quarantined' (no createdVia provenance when
|
|
1974
1977
|
// discovered) whose PRD file now carries a stamp — written via the
|
|
@@ -2096,6 +2099,7 @@ async function reconcilePass(state) {
|
|
|
2096
2099
|
deliverable: p.deliverable ?? inv.row?.deliverable ?? null,
|
|
2097
2100
|
artifactPaths: p.artifactPaths ?? inv.row?.artifactPaths ?? null,
|
|
2098
2101
|
effort: p.effort ?? inv.row?.effort ?? null,
|
|
2102
|
+
preflight: p.preflight ?? null,
|
|
2099
2103
|
};
|
|
2100
2104
|
const reason = `reconcile: repaired invalid status ${JSON.stringify(oldStatus)}`;
|
|
2101
2105
|
// A repair is not a lifecycle transition — the corrupted `status` was
|
|
@@ -2251,6 +2255,7 @@ async function reconcilePass(state) {
|
|
|
2251
2255
|
deliverable: p.deliverable ?? null,
|
|
2252
2256
|
artifactPaths: p.artifactPaths ?? null,
|
|
2253
2257
|
effort: p.effort ?? null,
|
|
2258
|
+
preflight: p.preflight ?? null,
|
|
2254
2259
|
status: 'pending',
|
|
2255
2260
|
// Enqueue time (PRD 1086/1087): the cross-project fairness tiebreak and
|
|
2256
2261
|
// the starvation escalation both need a provable age for a pending row;
|
|
@@ -2775,6 +2780,10 @@ let lastMemGate = null;
|
|
|
2775
2780
|
// predicate after pool → project cap → memory. Withholds launches only.
|
|
2776
2781
|
let loadGate = createLoadGate();
|
|
2777
2782
|
function _setLoadGateForTests(gate) { loadGate = gate; }
|
|
2783
|
+
// tickBody's dispatch goes through this indirection so a test can record launches
|
|
2784
|
+
// without forking a real child job (whose completion tick races the next test).
|
|
2785
|
+
let dispatchSpawnJob = (...args) => spawnJob(...args);
|
|
2786
|
+
function _setSpawnJobForTests(fn) { dispatchSpawnJob = fn || ((...args) => spawnJob(...args)); }
|
|
2778
2787
|
|
|
2779
2788
|
// Last tickQueue outcome, kept for the UI. tickQueue already computes a precise
|
|
2780
2789
|
// reason for every way a batch can come back empty (dependency holds, slot
|
|
@@ -3208,6 +3217,10 @@ function resetJobFields(job, errorMsg, opts = {}) {
|
|
|
3208
3217
|
// Durable cancel (2026-10-19 git-viewer incident): a human-cancelled row is
|
|
3209
3218
|
// revived only by an explicit human reset, never by an automated pass.
|
|
3210
3219
|
if (reviewLadder.isCancelledJob(job) && opts.source !== 'remote:resetJob' && opts.source !== 'ipc:schedule:reset-job') return false;
|
|
3220
|
+
// Reset means "re-check the precondition now": the hold is dropped even
|
|
3221
|
+
// when the row is already pending (pending→pending is not a transition).
|
|
3222
|
+
delete job.preflightHold;
|
|
3223
|
+
if (job.status === 'pending' && typeof job.heldReason === 'string' && job.heldReason.startsWith('waiting on precondition:')) delete job.heldReason;
|
|
3211
3224
|
if (!transitionJob(job, 'pending', { reason: errorMsg ?? 'reset to pending', source: opts.source ?? 'resetJobFields' })) return false;
|
|
3212
3225
|
delete job.cancelledAt;
|
|
3213
3226
|
delete job.cancelledRunId;
|
|
@@ -6208,6 +6221,12 @@ function readRunOutcomeSidecars(runDir, slug) {
|
|
|
6208
6221
|
const INVESTIGATION_LAUNCH_KEY = 'investigation';
|
|
6209
6222
|
|
|
6210
6223
|
async function spawnInvestigation(failedJob, runDir, { deadChild = null } = {}) {
|
|
6224
|
+
// A row waiting on its own red preflight spends nothing on the model
|
|
6225
|
+
// ladder: the precondition is the cause, not the work.
|
|
6226
|
+
if (reviewLadder.hasActivePreflightHold(failedJob)) {
|
|
6227
|
+
console.log(`[scheduler] skip investigation: ${failedJob.slug} is held on its preflight`);
|
|
6228
|
+
return { deferred: false };
|
|
6229
|
+
}
|
|
6211
6230
|
// The probe launches with the same CLI as the job it diagnoses. While
|
|
6212
6231
|
// that CLI cannot launch at all (launch circuit breaker, issue #11 list
|
|
6213
6232
|
// B1: probes e4f82da2/d374e6bf died on the same HTTP 400 as the runs
|
|
@@ -6385,7 +6404,7 @@ async function spawnInvestigation(failedJob, runDir, { deadChild = null } = {})
|
|
|
6385
6404
|
await mutate((s) => {
|
|
6386
6405
|
const j = s.jobs.find((x) => x.slug === failedJob.slug);
|
|
6387
6406
|
if (!j) return;
|
|
6388
|
-
const statusEligible = (j.status === 'needs_review' || j.status === 'failed') && !reviewLadder.isCancelledJob(j);
|
|
6407
|
+
const statusEligible = (j.status === 'needs_review' || j.status === 'failed') && !reviewLadder.isCancelledJob(j) && !reviewLadder.hasActivePreflightHold(j);
|
|
6389
6408
|
const transitioned = statusEligible && transitionJob(j, 'investigating', { reason: 'spawning investigation probe', source: 'spawnInvestigation:start' });
|
|
6390
6409
|
liveCheck = { ok: statusEligible && transitioned, status: j.status };
|
|
6391
6410
|
});
|
|
@@ -6529,7 +6548,9 @@ async function spawnInvestigation(failedJob, runDir, { deadChild = null } = {})
|
|
|
6529
6548
|
// status here) is otherwise reset-refused by design.
|
|
6530
6549
|
if (deadChild) {
|
|
6531
6550
|
const child = s.jobs.find((x) => x.slug === deadChild.slug);
|
|
6532
|
-
|
|
6551
|
+
// A child held on its own red preflight is left alone — the
|
|
6552
|
+
// reset would drop the hold and re-fire it into the same wall.
|
|
6553
|
+
if (child && !reviewLadder.hasActivePreflightHold(child)) {
|
|
6533
6554
|
resetJobFields(child, 'reset by dead-fix-plan reopen: parent investigation authored a new plan', {
|
|
6534
6555
|
force: true, source: 'spawnInvestigation:dead-fix-plan-reopen',
|
|
6535
6556
|
});
|
|
@@ -6891,6 +6912,151 @@ function guardedTick(fn, label) {
|
|
|
6891
6912
|
}
|
|
6892
6913
|
}
|
|
6893
6914
|
|
|
6915
|
+
/**
|
|
6916
|
+
* Pending rows whose preflight hold is not yet due → Map<slug, heldReason>,
|
|
6917
|
+
* in the same shape computeLaunchHolds returns, so the picker skips them
|
|
6918
|
+
* (and they never shadow a pickable sibling) while a dependent of a held
|
|
6919
|
+
* row still sees it as a blocking dep.
|
|
6920
|
+
*/
|
|
6921
|
+
function computePreflightHolds(jobs, now = Date.now()) {
|
|
6922
|
+
const held = new Map();
|
|
6923
|
+
for (const j of jobs || []) {
|
|
6924
|
+
if (!j || j.status !== 'pending' || !j.preflightHold) continue;
|
|
6925
|
+
const next = Date.parse(j.preflightHold.nextAt ?? '');
|
|
6926
|
+
if (Number.isFinite(next) && next > now) {
|
|
6927
|
+
held.set(j.slug, j.heldReason || `waiting on precondition: ${j.preflight} — re-check at ${j.preflightHold.nextAt}`);
|
|
6928
|
+
}
|
|
6929
|
+
}
|
|
6930
|
+
return held;
|
|
6931
|
+
}
|
|
6932
|
+
|
|
6933
|
+
/**
|
|
6934
|
+
* Run job.preflight (cwd = the job's project cwd, no shell) and record the
|
|
6935
|
+
* outcome on the queue row. Returns 'held' when the job must not launch
|
|
6936
|
+
* (check failed, or the hold is not yet due), else 'pass'.
|
|
6937
|
+
*/
|
|
6938
|
+
async function runPreflightGate(job, defaultCwd, { now = Date.now } = {}) {
|
|
6939
|
+
const command = job.preflight.trim();
|
|
6940
|
+
const prevHold = job.preflightHold || null;
|
|
6941
|
+
const dueAt = prevHold ? Date.parse(prevHold.nextAt ?? '') : NaN;
|
|
6942
|
+
if (Number.isFinite(dueAt) && dueAt > now()) return 'held';
|
|
6943
|
+
const result = await preflightCheck.runPreflight({ command, cwd: job.cwd || defaultCwd });
|
|
6944
|
+
if (result.ok) {
|
|
6945
|
+
const attempts = prevHold && Number.isFinite(prevHold.attempts) ? prevHold.attempts : 0;
|
|
6946
|
+
await mutate((s) => {
|
|
6947
|
+
const row = s.jobs.find((x) => x.slug === job.slug);
|
|
6948
|
+
if (!row) return;
|
|
6949
|
+
delete row.preflightHold;
|
|
6950
|
+
delete row.heldReason;
|
|
6951
|
+
});
|
|
6952
|
+
delete job.preflightHold;
|
|
6953
|
+
delete job.heldReason;
|
|
6954
|
+
try { appendAuditEvent('preflight_pass', { slug: job.slug, attempts }); } catch { /* audit must not break dispatch */ }
|
|
6955
|
+
return 'pass';
|
|
6956
|
+
}
|
|
6957
|
+
const heldAt = now();
|
|
6958
|
+
let hold = null;
|
|
6959
|
+
let projectRows = [];
|
|
6960
|
+
await mutate((s) => {
|
|
6961
|
+
const row = s.jobs.find((x) => x.slug === job.slug);
|
|
6962
|
+
hold = armPreflightHoldOnRow(row, prevHold, result, command, heldAt, `make \`${command}\` exit 0`);
|
|
6963
|
+
projectRows = snapshotProjectRows(s.jobs, row || job);
|
|
6964
|
+
});
|
|
6965
|
+
job.preflightHold = hold;
|
|
6966
|
+
auditPreflightHold(job.slug, command, result, hold);
|
|
6967
|
+
await broadcast({ flush: true });
|
|
6968
|
+
await sendPreflightHoldNotice(job, hold, projectRows);
|
|
6969
|
+
return 'held';
|
|
6970
|
+
}
|
|
6971
|
+
|
|
6972
|
+
/** Shallow copies of `job`'s project rows (for heldSlugs) — safe outside mutate(). */
|
|
6973
|
+
function snapshotProjectRows(jobs, job) {
|
|
6974
|
+
const cwd = job?.cwd || DEFAULT_PROJECT_CWD;
|
|
6975
|
+
return projectRowsFor(jobs, cwd).map((j) => ({ ...j }));
|
|
6976
|
+
}
|
|
6977
|
+
|
|
6978
|
+
// Preflight hold notices already sent this process, by preflightHoldNoticeKey.
|
|
6979
|
+
const preflightHoldNoticesSent = new Set();
|
|
6980
|
+
let preflightHoldNoticeSender = null;
|
|
6981
|
+
function _setPreflightHoldNoticeSenderForTests(fn) { preflightHoldNoticeSender = fn || null; }
|
|
6982
|
+
function _resetPreflightHoldNoticesForTests() { preflightHoldNoticesSent.clear(); }
|
|
6983
|
+
|
|
6984
|
+
/**
|
|
6985
|
+
* sendPreflightHoldNotice(job, hold, projectRows) → Promise<boolean>
|
|
6986
|
+
*
|
|
6987
|
+
* The ONE informational Epic notice for a preflight hold, sent the moment it
|
|
6988
|
+
* first arms (hold.attempts === 1) — not behind SM_REVIEW_NOTICE_HOLD_MINUTES.
|
|
6989
|
+
* Same Epic delivery as the grouped needs_review notice
|
|
6990
|
+
* (appendResponseEventWithReason, allowInactive), tagged notice:
|
|
6991
|
+
* 'preflight-hold' with no outcome, so it never asks for input. Deduped by
|
|
6992
|
+
* preflightHoldNoticeKey(slug, hold.since); a re-check failure (attempts > 1)
|
|
6993
|
+
* sends nothing. heldSlugs = the row itself plus every pending row whose root
|
|
6994
|
+
* blocker it is. Never throws.
|
|
6995
|
+
*/
|
|
6996
|
+
async function sendPreflightHoldNotice(job, hold, projectRows = []) {
|
|
6997
|
+
try {
|
|
6998
|
+
if (!job || !hold || hold.attempts !== 1) return false;
|
|
6999
|
+
const key = preflightHoldNoticeKey(job.slug, hold.since);
|
|
7000
|
+
if (preflightHoldNoticesSent.has(key)) return false;
|
|
7001
|
+
preflightHoldNoticesSent.add(key);
|
|
7002
|
+
const cwd = job.cwd || DEFAULT_PROJECT_CWD;
|
|
7003
|
+
const epicId = job.sourcePromptId || job.epicId || null;
|
|
7004
|
+
if (!epicId || !cwd) {
|
|
7005
|
+
console.log(`[scheduler] ${job.slug}: preflight hold notice — no authoring Epic, report only`);
|
|
7006
|
+
return false;
|
|
7007
|
+
}
|
|
7008
|
+
const roots = starvation.rootBlockersForProject(Array.isArray(projectRows) ? projectRows : []);
|
|
7009
|
+
const mine = roots.find((r) => r.slug === job.slug);
|
|
7010
|
+
const heldSlugs = [job.slug, ...(mine ? mine.heldSlugs.filter((x) => x !== job.slug) : [])];
|
|
7011
|
+
const text = buildPreflightHoldNotice({
|
|
7012
|
+
slug: job.slug,
|
|
7013
|
+
failText: hold.failText,
|
|
7014
|
+
preflight: typeof job.preflight === 'string' ? job.preflight.trim() : '',
|
|
7015
|
+
heldSlugs,
|
|
7016
|
+
nextAt: hold.nextAt,
|
|
7017
|
+
});
|
|
7018
|
+
const send = preflightHoldNoticeSender || appendResponseEventWithReason;
|
|
7019
|
+
const result = await send(cwd, epicId, text, {
|
|
7020
|
+
prdSlug: job.slug,
|
|
7021
|
+
validation: 'unvalidated',
|
|
7022
|
+
notice: 'preflight-hold',
|
|
7023
|
+
digestKey: key,
|
|
7024
|
+
allowInactive: true,
|
|
7025
|
+
});
|
|
7026
|
+
const ok = typeof result === 'boolean' ? result : !!result?.ok;
|
|
7027
|
+
if (!ok) console.warn(`[scheduler] ${job.slug}: preflight hold notice not delivered (${result?.reason ?? 'refused'})`);
|
|
7028
|
+
return ok;
|
|
7029
|
+
} catch (e) {
|
|
7030
|
+
console.error('[scheduler] sendPreflightHoldNotice error', job?.slug, e);
|
|
7031
|
+
return false;
|
|
7032
|
+
}
|
|
7033
|
+
}
|
|
7034
|
+
|
|
7035
|
+
/**
|
|
7036
|
+
* Arm (or climb) the preflight hold on a queue row from a red runPreflight
|
|
7037
|
+
* result. Sync — call inside mutate(). Shared by the dispatch gate and the
|
|
7038
|
+
* sentinel_fail park reroute so both write the same hold + heldReason shape.
|
|
7039
|
+
* Returns the hold (also when `row` is null, from `prevHold`).
|
|
7040
|
+
*/
|
|
7041
|
+
function armPreflightHoldOnRow(row, prevHold, result, command, heldAt, failText) {
|
|
7042
|
+
const code = result.exitCode ?? (result.timedOut ? 'timeout' : 'null');
|
|
7043
|
+
const base = row ? (row.preflightHold || null) : (prevHold || null);
|
|
7044
|
+
const hold = preflightCheck.armPreflightHold(base, result, heldAt, failText);
|
|
7045
|
+
if (row) {
|
|
7046
|
+
row.preflightHold = hold;
|
|
7047
|
+
row.heldReason = `waiting on precondition: ${command} exited ${code} — re-check at ${hold.nextAt}`;
|
|
7048
|
+
}
|
|
7049
|
+
return hold;
|
|
7050
|
+
}
|
|
7051
|
+
|
|
7052
|
+
function auditPreflightHold(slug, command, result, hold, extra = {}) {
|
|
7053
|
+
const code = result.exitCode ?? (result.timedOut ? 'timeout' : 'null');
|
|
7054
|
+
console.log(`[scheduler] ${slug}: preflight hold — ${command} exited ${code}; re-check at ${hold.nextAt}`);
|
|
7055
|
+
try {
|
|
7056
|
+
appendAuditEvent('preflight_hold', { slug, attempts: hold.attempts, nextAt: hold.nextAt, exitCode: result.exitCode, ...extra });
|
|
7057
|
+
} catch { /* audit must not break dispatch */ }
|
|
7058
|
+
}
|
|
7059
|
+
|
|
6894
7060
|
async function spawnJob(job, runId, runDir, defaultCwd, resumeTarget = null, siblingJobs = null) {
|
|
6895
7061
|
// PRD 1408: the queue rows in scope at dispatch (tickQueue's own
|
|
6896
7062
|
// state.jobs, threaded straight down — never re-read here or inside
|
|
@@ -6920,6 +7086,17 @@ async function spawnJob(job, runId, runDir, defaultCwd, resumeTarget = null, sib
|
|
|
6920
7086
|
// silently.
|
|
6921
7087
|
const quietLeaseAcquired = job.quietMachine === true && quietMachineLease.acquire(job.slug);
|
|
6922
7088
|
try {
|
|
7089
|
+
// Preflight hold (preflightCheck.cjs): a PRD whose work needs an external
|
|
7090
|
+
// precondition a person controls declares one cheap command. Checked
|
|
7091
|
+
// BEFORE the worktree is created and before the 'running' transition, so
|
|
7092
|
+
// a red precondition costs no claude -p run and no checkout — the row
|
|
7093
|
+
// stays 'pending' with a preflightHold and is re-checked on the
|
|
7094
|
+
// 10/20/40/60-min-then-hourly backoff. Exit 0 clears the hold and
|
|
7095
|
+
// dispatch continues unchanged, so dependents flow with no manual reset.
|
|
7096
|
+
if (!resumeTarget && typeof job.preflight === 'string' && job.preflight.trim()) {
|
|
7097
|
+
const gate = await runPreflightGate(job, defaultCwd);
|
|
7098
|
+
if (gate === 'held') return;
|
|
7099
|
+
}
|
|
6923
7100
|
// Worktree isolation cap check (PRD 1112) — probed BEFORE the job is
|
|
6924
7101
|
// marked 'running', so a job that can't get isolation right now is a
|
|
6925
7102
|
// DEFERRAL, not a fallback: it stays 'pending' and is retried on the
|
|
@@ -7816,6 +7993,25 @@ async function spawnJob(job, runId, runDir, defaultCwd, resumeTarget = null, sib
|
|
|
7816
7993
|
}
|
|
7817
7994
|
}
|
|
7818
7995
|
|
|
7996
|
+
// Preflight park reroute: a run with a `preflight` that ended in an
|
|
7997
|
+
// executor SCHEDULER_VERDICT: FAIL re-checks its precondition once. Red →
|
|
7998
|
+
// the precondition is the cause; the row goes back to pending with a
|
|
7999
|
+
// preflightHold (below, inside mutate) and spends nothing on the model
|
|
8000
|
+
// ladder. Green or check error → the ordinary park runs unchanged.
|
|
8001
|
+
// I/O here, outside mutate(), like every other pre-finalize check.
|
|
8002
|
+
let preflightRerouteResult = null;
|
|
8003
|
+
const preflightRerouteCmd = typeof job.preflight === 'string' ? job.preflight.trim() : '';
|
|
8004
|
+
if (preflightRerouteCmd && res.exitCode === 0 && !res.rateLimited && verifyResult?.verdict === 'sentinel_fail') {
|
|
8005
|
+
try {
|
|
8006
|
+
const r = await preflightCheck.runPreflight({ command: preflightRerouteCmd, cwd: job.cwd || defaultCwd });
|
|
8007
|
+
if (r && r.ok === false) preflightRerouteResult = r;
|
|
8008
|
+
} catch (e) {
|
|
8009
|
+
reportSchedulerError('preflight park re-check failed', job.slug, e);
|
|
8010
|
+
}
|
|
8011
|
+
}
|
|
8012
|
+
let preflightRerouteHold = null;
|
|
8013
|
+
let preflightRerouteRows = [];
|
|
8014
|
+
|
|
7819
8015
|
let actuallyFailed = false;
|
|
7820
8016
|
let failedJobSnapshot = null;
|
|
7821
8017
|
let needsInvestigationNow = false;
|
|
@@ -7996,6 +8192,23 @@ async function spawnJob(job, runId, runDir, defaultCwd, resumeTarget = null, sib
|
|
|
7996
8192
|
effectiveStatus = 'needs_review';
|
|
7997
8193
|
}
|
|
7998
8194
|
|
|
8195
|
+
if (
|
|
8196
|
+
preflightRerouteResult
|
|
8197
|
+
&& effectiveStatus === 'needs_review'
|
|
8198
|
+
&& !sigtermOverrideReason
|
|
8199
|
+
&& !capParkVerdict
|
|
8200
|
+
&& verifyResult?.verdict === 'sentinel_fail'
|
|
8201
|
+
) {
|
|
8202
|
+
const row = s.jobs[i2];
|
|
8203
|
+
const failText = String(verifyResult.reason || '').replace(/^executor reported\s+/, '') || 'SCHEDULER_VERDICT: FAIL';
|
|
8204
|
+
if (jobLandedCommitThisRun) row.landedCommit = jobLandedCommitThisRun;
|
|
8205
|
+
if (resetJobFields(row, `preflight red after SCHEDULER_VERDICT: FAIL — ${failText}`, { source: 'scheduler:preflight-hold' })) {
|
|
8206
|
+
preflightRerouteHold = armPreflightHoldOnRow(row, null, preflightRerouteResult, preflightRerouteCmd, Date.now(), failText);
|
|
8207
|
+
preflightRerouteRows = snapshotProjectRows(s.jobs, row);
|
|
8208
|
+
return; // row is pending + held; no park, no ladder
|
|
8209
|
+
}
|
|
8210
|
+
}
|
|
8211
|
+
|
|
7999
8212
|
// already_satisfied_on_main names the satisfying sha in its own
|
|
8000
8213
|
// reason — surface that on the completed row's statusHistory
|
|
8001
8214
|
// instead of the generic "run finished with exit 0" every other
|
|
@@ -8253,7 +8466,9 @@ async function spawnJob(job, runId, runDir, defaultCwd, resumeTarget = null, sib
|
|
|
8253
8466
|
for (const { slug, cwd } of newlyCompletedPrds) {
|
|
8254
8467
|
await prdPaths.archiveCompletedPrd(slug, cwd);
|
|
8255
8468
|
}
|
|
8469
|
+
if (preflightRerouteHold) auditPreflightHold(job.slug, preflightRerouteCmd, preflightRerouteResult, preflightRerouteHold, { after: 'sentinel_fail' });
|
|
8256
8470
|
await broadcast({ flush: true });
|
|
8471
|
+
if (preflightRerouteHold) await sendPreflightHoldNotice(job, preflightRerouteHold, preflightRerouteRows);
|
|
8257
8472
|
|
|
8258
8473
|
// Per-run outcome sidecar (issue #11 list B5): turns/tokens/verdict in one
|
|
8259
8474
|
// small JSON next to the log so fleet health never needs a transcript parse.
|
|
@@ -8708,6 +8923,7 @@ async function tickBody(gen, { bypassLoadGate, lastResort }) {
|
|
|
8708
8923
|
? Math.max(0, Math.min(sessionSlots.availableFor('job'), degradedConcurrencyCapValue - runningSet.size))
|
|
8709
8924
|
: sessionSlots.availableFor('job');
|
|
8710
8925
|
const heldSlugs = await computeLaunchHolds(state);
|
|
8926
|
+
for (const [slug, why] of computePreflightHolds(state.jobs)) if (!heldSlugs.has(slug)) heldSlugs.set(slug, why);
|
|
8711
8927
|
if (stale()) return STALE_TICK;
|
|
8712
8928
|
const satisfiedSlugsByCwd = await budget.computeDepHistorySatisfaction(state);
|
|
8713
8929
|
lastSatisfiedSlugsByCwd = satisfiedSlugsByCwd;
|
|
@@ -8897,7 +9113,7 @@ async function tickBody(gen, { bypassLoadGate, lastResort }) {
|
|
|
8897
9113
|
// state.jobs is the queue's rows in scope at THIS dispatch (PRD 1408) —
|
|
8898
9114
|
// threaded straight through so spawnJob's hasDownstreamValidator check
|
|
8899
9115
|
// never re-reads the queue itself.
|
|
8900
|
-
|
|
9116
|
+
dispatchSpawnJob(job, runId, runDir, state.config.defaultCwd, null, state.jobs).catch((e) => reportSchedulerError('spawnJob dispatch rejected', job.slug, e));
|
|
8901
9117
|
issued += 1;
|
|
8902
9118
|
}
|
|
8903
9119
|
if (issued > 0) {
|
|
@@ -9137,12 +9353,85 @@ const starveEscalated = new Set();
|
|
|
9137
9353
|
* gate. Exported for direct unit testing (attach a fake window via
|
|
9138
9354
|
* attachWindow() first to assert the toast send).
|
|
9139
9355
|
*/
|
|
9356
|
+
function projectRowsFor(jobs, cwd) {
|
|
9357
|
+
return (Array.isArray(jobs) ? jobs : []).filter((j) => j && (j.cwd || DEFAULT_PROJECT_CWD) === cwd);
|
|
9358
|
+
}
|
|
9359
|
+
|
|
9360
|
+
/**
|
|
9361
|
+
* starveRootFor(projectRows, oldestPendingSlug) → { root, knownWait }
|
|
9362
|
+
*
|
|
9363
|
+
* `root`: the root blocker (starvation.rootBlockersForProject) holding the
|
|
9364
|
+
* oldest pending row, else the first one found, else null. `knownWait`: every
|
|
9365
|
+
* pending row is either itself preflight-held or waits on a preflight-held
|
|
9366
|
+
* root — the scheduler re-checks those on its own backoff, so the project is
|
|
9367
|
+
* waiting on a precondition, not starved.
|
|
9368
|
+
*/
|
|
9369
|
+
function starveRootFor(projectRows, oldestPendingSlug = null) {
|
|
9370
|
+
const roots = starvation.rootBlockersForProject(projectRows);
|
|
9371
|
+
const root = roots.find((r) => r.heldSlugs.includes(oldestPendingSlug)) ?? roots[0] ?? null;
|
|
9372
|
+
let knownWait = false;
|
|
9373
|
+
if (roots.length > 0 && roots.every((r) => r.preflightHeld)) {
|
|
9374
|
+
const waiting = new Set(roots.flatMap((r) => r.heldSlugs));
|
|
9375
|
+
for (const r of roots) waiting.add(r.slug);
|
|
9376
|
+
knownWait = projectRows.every((j) => j.status !== 'pending' || waiting.has(j.slug) || (j.preflightHold && typeof j.preflightHold === 'object'));
|
|
9377
|
+
}
|
|
9378
|
+
return { root, knownWait };
|
|
9379
|
+
}
|
|
9380
|
+
|
|
9381
|
+
function rootBlockingFields(root) {
|
|
9382
|
+
return {
|
|
9383
|
+
rootBlockingSlug: root?.slug ?? null,
|
|
9384
|
+
rootBlockingStatus: root?.status ?? null,
|
|
9385
|
+
rootBlockingReason: root?.reason ?? null,
|
|
9386
|
+
};
|
|
9387
|
+
}
|
|
9388
|
+
|
|
9389
|
+
/** Toast/log phrase naming the root blocker, or '' when there is none. */
|
|
9390
|
+
function rootBlockerPhrase(root) {
|
|
9391
|
+
if (!root) return '';
|
|
9392
|
+
return ` Waiting on ${root.slug} (${root.status}${root.reason ? `: ${root.reason}` : ''}).`;
|
|
9393
|
+
}
|
|
9394
|
+
|
|
9395
|
+
/**
|
|
9396
|
+
* reportStarvedProjects(starvedProjects, jobs, launchBlocks) — the per-sweep
|
|
9397
|
+
* project_starved WARN + audit (each naming the root blocker), then the
|
|
9398
|
+
* bounded escalation. A known wait (starveRootFor) is skipped by both.
|
|
9399
|
+
*/
|
|
9400
|
+
function reportStarvedProjects(starvedProjects, jobs = [], launchBlocks = {}) {
|
|
9401
|
+
for (const sp of starvedProjects) {
|
|
9402
|
+
const { root, knownWait } = starveRootFor(projectRowsFor(jobs, sp.cwd), sp.oldestPendingSlug);
|
|
9403
|
+
if (knownWait) continue;
|
|
9404
|
+
console.warn(
|
|
9405
|
+
`[scheduler] PROJECT STARVED: project=${sp.cwd} pending=${sp.pendingCount} oldest=${sp.oldestPendingSlug} `
|
|
9406
|
+
+ `waiting=${Math.round(sp.ageMs / 60_000)}m (>= ${Math.round(STARVATION_ESCALATE_MS / 60_000)}m threshold) `
|
|
9407
|
+
+ `while other projects are running${root ? ` — root blocker ${root.slug} (${root.status}${root.reason ? `: ${root.reason}` : ''})` : ' — check the cross-project fairness rule in pickNextBatch'}`,
|
|
9408
|
+
);
|
|
9409
|
+
appendAuditEvent('project_starved', {
|
|
9410
|
+
cwd: sp.cwd, pendingCount: sp.pendingCount, oldestPendingSlug: sp.oldestPendingSlug, ageMs: sp.ageMs, ...rootBlockingFields(root),
|
|
9411
|
+
});
|
|
9412
|
+
}
|
|
9413
|
+
// Bounded, automated consequence for a starve that outlives the WARN
|
|
9414
|
+
// above (PRD: the 2026-09-12 19h Bilko starve had ~115 identical
|
|
9415
|
+
// project_starved rows and zero consequence). STARVE_ESCALATION_MS is
|
|
9416
|
+
// strictly later than STARVATION_ESCALATE_MS, so this only ever fires on
|
|
9417
|
+
// a subset of the rows already reported above — same verdict, no
|
|
9418
|
+
// re-derivation.
|
|
9419
|
+
runStarveEscalationSweep(starvedProjects, jobs, launchBlocks);
|
|
9420
|
+
}
|
|
9421
|
+
|
|
9140
9422
|
function runStarveEscalationSweep(starvedProjects, jobs = [], launchBlocks = {}) {
|
|
9141
|
-
const
|
|
9423
|
+
const rootByCwd = new Map();
|
|
9424
|
+
const reportable = starvedProjects.filter((sp) => {
|
|
9425
|
+
const r = starveRootFor(projectRowsFor(jobs, sp.cwd), sp.oldestPendingSlug);
|
|
9426
|
+
rootByCwd.set(sp.cwd, r.root);
|
|
9427
|
+
return !r.knownWait;
|
|
9428
|
+
});
|
|
9429
|
+
const { toEscalate, toClear } = starvation.selectStarveEscalations(reportable, starveEscalated, STARVE_ESCALATION_MS);
|
|
9142
9430
|
for (const cwd of toClear) starveEscalated.delete(cwd);
|
|
9143
9431
|
for (const sp of toEscalate) {
|
|
9144
9432
|
starveEscalated.add(sp.cwd);
|
|
9145
|
-
const projectRows = (
|
|
9433
|
+
const projectRows = projectRowsFor(jobs, sp.cwd);
|
|
9434
|
+
const root = rootByCwd.get(sp.cwd) ?? null;
|
|
9146
9435
|
const holdReason = starvation.describeStarveHold({ projectRows, launchBlocks, lastTick, lastHoldTick });
|
|
9147
9436
|
const mins = Math.round(sp.ageMs / 60_000);
|
|
9148
9437
|
console.error(
|
|
@@ -9151,11 +9440,11 @@ function runStarveEscalationSweep(starvedProjects, jobs = [], launchBlocks = {})
|
|
|
9151
9440
|
+ 'a bounded escalation only; nothing was auto-reset, cancelled, or dispatched',
|
|
9152
9441
|
);
|
|
9153
9442
|
appendAuditEvent('project_starve_escalated', {
|
|
9154
|
-
cwd: sp.cwd, pendingCount: sp.pendingCount, oldestPendingSlug: sp.oldestPendingSlug, ageMs: sp.ageMs, holdReason,
|
|
9443
|
+
cwd: sp.cwd, pendingCount: sp.pendingCount, oldestPendingSlug: sp.oldestPendingSlug, ageMs: sp.ageMs, holdReason, ...rootBlockingFields(root),
|
|
9155
9444
|
});
|
|
9156
9445
|
sendIfAlive(mainWindow, 'schedule:stall', {
|
|
9157
9446
|
message: `Project starved: ${sp.cwd} has ${sp.pendingCount} pending PRD(s), no dispatch for ~${mins}m `
|
|
9158
|
-
+ `(hold reason: ${holdReason})
|
|
9447
|
+
+ `(hold reason: ${holdReason}).${rootBlockerPhrase(root)} Check the Scheduler tab.`,
|
|
9159
9448
|
total: sp.pendingCount,
|
|
9160
9449
|
byProject: { [sp.cwd]: { starved: sp.pendingCount } },
|
|
9161
9450
|
});
|
|
@@ -11878,21 +12167,8 @@ function rescheduleIntervalTick() {
|
|
|
11878
12167
|
// started" — the 2026-09-01 NN-ordering starvation ran 3.5 h unnoticed.
|
|
11879
12168
|
// Escalation only, same shape as the quarantine/overrun warnings above.
|
|
11880
12169
|
const starvedProjects = findStarvedProjects(s.jobs, Date.now(), STARVATION_ESCALATE_MS, s.lastDispatchAtByCwd);
|
|
11881
|
-
|
|
11882
|
-
|
|
11883
|
-
`[scheduler] PROJECT STARVED: project=${sp.cwd} pending=${sp.pendingCount} oldest=${sp.oldestPendingSlug} `
|
|
11884
|
-
+ `waiting=${Math.round(sp.ageMs / 60_000)}m (>= ${Math.round(STARVATION_ESCALATE_MS / 60_000)}m threshold) `
|
|
11885
|
-
+ `while other projects are running — check the cross-project fairness rule in pickNextBatch`,
|
|
11886
|
-
);
|
|
11887
|
-
appendAuditEvent('project_starved', { cwd: sp.cwd, pendingCount: sp.pendingCount, oldestPendingSlug: sp.oldestPendingSlug, ageMs: sp.ageMs });
|
|
11888
|
-
}
|
|
11889
|
-
// Bounded, automated consequence for a starve that outlives the WARN
|
|
11890
|
-
// above (PRD: the 2026-09-12 19h Bilko starve had ~115 identical
|
|
11891
|
-
// project_starved rows and zero consequence). STARVE_ESCALATION_MS is
|
|
11892
|
-
// strictly later than STARVATION_ESCALATE_MS, so this only ever fires on
|
|
11893
|
-
// a subset of the rows already reported above — same verdict, no
|
|
11894
|
-
// re-derivation.
|
|
11895
|
-
runStarveEscalationSweep(starvedProjects, s.jobs, s.launchBlocks);
|
|
12170
|
+
// Each event names the root blocker; a known preflight wait is skipped.
|
|
12171
|
+
reportStarvedProjects(starvedProjects, s.jobs, s.launchBlocks);
|
|
11896
12172
|
|
|
11897
12173
|
// Bounded failed -> pending auto-reset (PRD 1151), plus the stuck-failed
|
|
11898
12174
|
// escalation now narrowed to only the rows that auto-reset gave up on.
|
|
@@ -12284,7 +12560,11 @@ async function init() {
|
|
|
12284
12560
|
// archivedStatus); `fields=full` restores them.
|
|
12285
12561
|
function toCompactPrdEntry(entry) {
|
|
12286
12562
|
const { slug, title, cwd, mtimeMs, archived, status, agentType } = entry;
|
|
12287
|
-
|
|
12563
|
+
const out = { slug, title, cwd, mtimeMs, archived, status, agentType };
|
|
12564
|
+
// Only when set, so the compact page stays small.
|
|
12565
|
+
if (entry.heldReason) out.heldReason = entry.heldReason;
|
|
12566
|
+
if (entry.waitingOn) out.waitingOn = entry.waitingOn;
|
|
12567
|
+
return out;
|
|
12288
12568
|
}
|
|
12289
12569
|
|
|
12290
12570
|
/**
|
|
@@ -12403,6 +12683,29 @@ async function listPrdsInternal({ cwd: rawCwd } = {}) {
|
|
|
12403
12683
|
queueHistory.historyTerminalBySlug().catch(() => new Map()),
|
|
12404
12684
|
]);
|
|
12405
12685
|
const liveStatusBySlug = new Map(state.jobs.map((j) => [j.slug, j.status]));
|
|
12686
|
+
// heldReason (the live row's own) + waitingOn (the root blocker slug of a
|
|
12687
|
+
// dependency-blocked pending row, starvation.rootBlockersForProject).
|
|
12688
|
+
const liveRowBySlug = new Map(state.jobs.map((j) => [j.slug, j]));
|
|
12689
|
+
const waitingOnBySlug = new Map();
|
|
12690
|
+
const jobsByCwd = new Map();
|
|
12691
|
+
for (const j of state.jobs) {
|
|
12692
|
+
if (!j) continue;
|
|
12693
|
+
const key = j.cwd || DEFAULT_PROJECT_CWD;
|
|
12694
|
+
if (!jobsByCwd.has(key)) jobsByCwd.set(key, []);
|
|
12695
|
+
jobsByCwd.get(key).push(j);
|
|
12696
|
+
}
|
|
12697
|
+
for (const rows of jobsByCwd.values()) {
|
|
12698
|
+
if (!rows.some((j) => j.status === 'pending' && Array.isArray(j.dependsOn) && j.dependsOn.length > 0)) continue;
|
|
12699
|
+
for (const r of starvation.rootBlockersForProject(rows)) {
|
|
12700
|
+
for (const held of r.heldSlugs) waitingOnBySlug.set(held, r.slug);
|
|
12701
|
+
}
|
|
12702
|
+
}
|
|
12703
|
+
for (let i = 0; i < archivedStart; i++) {
|
|
12704
|
+
const entry = out[i];
|
|
12705
|
+
const live = liveRowBySlug.get(entry.slug);
|
|
12706
|
+
entry.heldReason = live && typeof live.heldReason === 'string' && live.heldReason ? flatString(live.heldReason) : null;
|
|
12707
|
+
entry.waitingOn = waitingOnBySlug.get(entry.slug) ?? null;
|
|
12708
|
+
}
|
|
12406
12709
|
for (let i = 0; i < out.length; i++) {
|
|
12407
12710
|
const entry = out[i];
|
|
12408
12711
|
// `entry` is a freshly-synthesized PRD-listing row, not a persisted
|
|
@@ -13145,6 +13448,10 @@ module.exports = {
|
|
|
13145
13448
|
rescheduleIntervalTick,
|
|
13146
13449
|
runQueueStarvationWatchdog,
|
|
13147
13450
|
runStarveEscalationSweep,
|
|
13451
|
+
reportStarvedProjects,
|
|
13452
|
+
sendPreflightHoldNotice,
|
|
13453
|
+
_setPreflightHoldNoticeSenderForTests,
|
|
13454
|
+
_resetPreflightHoldNoticesForTests,
|
|
13148
13455
|
runJobLeftoverSweep,
|
|
13149
13456
|
stripAppOwnedChurn,
|
|
13150
13457
|
BUDGET_WARNING_FRACTION,
|
|
@@ -13158,6 +13465,7 @@ module.exports = {
|
|
|
13158
13465
|
writeQueue,
|
|
13159
13466
|
_setPeriodicReverifyEnabledForTests,
|
|
13160
13467
|
_setLoadGateForTests,
|
|
13468
|
+
_setSpawnJobForTests,
|
|
13161
13469
|
_mutateForTests: mutate, // mutate() has no other exported call site; test-only seam.
|
|
13162
13470
|
reconcile,
|
|
13163
13471
|
broadcast,
|
|
@@ -13266,6 +13574,8 @@ module.exports = {
|
|
|
13266
13574
|
performLeftoverQuarantine,
|
|
13267
13575
|
spawnInvestigation,
|
|
13268
13576
|
computeLaunchHolds,
|
|
13577
|
+
computePreflightHolds,
|
|
13578
|
+
runPreflightGate,
|
|
13269
13579
|
handleLaunchFailure,
|
|
13270
13580
|
applyLaunchFailure,
|
|
13271
13581
|
setPaused,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<!-- PRD_AUTHORING.md
|
|
1
|
+
<!-- PRD_AUTHORING.md v24 -->
|
|
2
2
|
# PRD Authoring Guide — Scheduler Safety Rules
|
|
3
3
|
|
|
4
4
|
Rule: every PRD you queue follows the rules below.
|
|
@@ -116,6 +116,13 @@ Both fields are required in every `scheduler_create_prd` call.
|
|
|
116
116
|
2. No absolute paths, no `~` at the start, no `..` or `.` segments, no `*` or `?`, no `\` or backticks, no leading `-`. Use `/` between folders.
|
|
117
117
|
3. The scheduler never runs two PRDs with overlapping files at once (held as `files-overlap`); `dependsOn` is for real output or order dependencies only.
|
|
118
118
|
|
|
119
|
+
### preflight
|
|
120
|
+
|
|
121
|
+
Optional. One read-only command in gate syntax (every §6 gate rule applies; one line, at most 500 chars, never `none`), run without a shell for at most 60 s. Exit 0 = the precondition holds.
|
|
122
|
+
Rule: declare it on a PRD whose work needs an external state a person controls — a store agreement, billing, DNS, OAuth consent, a device. While it exits non-zero the scheduler holds the PRD `pending` and re-checks on its own; the hold is described in Session Manager's `session-manager-operations/architecture/scheduler-operations.md` §4b.
|
|
123
|
+
Rule: the executor still ends `SCHEDULER_VERDICT: FAIL` naming what is missing when it meets the missing state; a red preflight at that point reroutes the run to the hold instead of a park.
|
|
124
|
+
Why: a human-only blocker used to park `needs_review` and spend the recovery ladder on work no model can do.
|
|
125
|
+
|
|
119
126
|
### What the API writes
|
|
120
127
|
|
|
121
128
|
The API writes the frontmatter and renders two body sections from the fields above: `# Files` (right after `# Acceptance criteria`) and `# Gate` (after `# Out of scope`, before `## Engineering standards`). Do not write those two sections yourself. Do not put a gate fence (three backticks + `gate`), a `# Gate` heading or a `# Files` heading in any text field — the API rejects that. For `["none"]`, the Gate section says the PRD has no runnable check and to verify each AC line by reading the files, with the fence holding the single word `none`.
|
|
@@ -240,6 +247,7 @@ Before queueing a new PRD, verify each of these:
|
|
|
240
247
|
- [ ] **§11 End green:** the gate runs last; any intentional failure runs early and is captured.
|
|
241
248
|
- [ ] **Gate baseline:** every gate command ran green once at HEAD in the main checkout; a red suite is scoped to the PRD's own test files and the PRD notes say why. Why: a gate already red on base parks as `sentinel_fail`.
|
|
242
249
|
- [ ] **No human-only gates:** no gate or criterion needs a human or the passage of time (cron install, live post wait, live payment, dashboard action); keep them out of the PRD at authoring time; an executor that meets one ends `SCHEDULER_VERDICT: FAIL` naming what is missing. Why: no executor can pass them.
|
|
250
|
+
- [ ] **§6 Preflight:** a PRD whose work needs an external state a person controls declares a read-only `preflight` (exit 0 = precondition holds); every other PRD omits it.
|
|
243
251
|
- [ ] **No interactive AC:** no criterion asks to launch the app, click through, capture a screenshot, run under xvfb or open a browser. Why: a headless run stalls on a rendered frame and is SIGTERM'd uncommitted; recommend manual visual confirmation in the report instead.
|
|
244
252
|
- [ ] **Contract consumers gated:** a PRD that changes a return shape, IPC payload or remote contract greps `tests/` (and `src/**/__tests__`) for every spec using it and puts each in its gate and files. Why: scoped gates let other specs go red unseen until the release gate.
|
|
245
253
|
- [ ] **Gate purity:** a gate command must not create or modify tracked files; outputs go to the per-gate TMPDIR or a gitignored path. Why: a dirtied tree fails the clean-tree check.
|