claude-code-session-manager 0.125.1 → 0.127.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/.claude-plugin/marketplace.json +1 -1
- package/bin/cli.cjs +71 -9
- package/bin/supervise.cjs +84 -0
- package/dist/assets/{AgentLibrary-DjEH5SoY.js → AgentLibrary-DKQznr7o.js} +1 -1
- package/dist/assets/{Button-B8NLivk-.js → Button-CZXqmIiM.js} +1 -1
- package/dist/assets/{DataModel-CHiBk8m_.js → DataModel-piyV33To.js} +1 -1
- package/dist/assets/{History-DttgrJO0.js → History-BxwtrKF2.js} +1 -1
- package/dist/assets/{Hooks-Bvy0BH1u.js → Hooks-DogeSPII.js} +1 -1
- package/dist/assets/{Library-UbBOgkkP.js → Library-BDt6EeQQ.js} +1 -1
- package/dist/assets/{ListDetail-xOyOpVZX.js → ListDetail-CwS-LKar.js} +1 -1
- package/dist/assets/{McpServers-CoGL0ddv.js → McpServers-D2HVljgS.js} +1 -1
- package/dist/assets/{Memory-Cise856d.js → Memory-hNzuOGn8.js} +1 -1
- package/dist/assets/{Panel-Cj72VO5s.js → Panel-BLDrsUeq.js} +1 -1
- package/dist/assets/{Permissions-BoJ9AB-G.js → Permissions-DzZ5vaJW.js} +1 -1
- package/dist/assets/{Plugins-DfT24sAZ.js → Plugins-Cz9yaxzG.js} +2 -2
- package/dist/assets/{ProvenanceBadge-ChkIslT4.js → ProvenanceBadge-CCgLO4m9.js} +1 -1
- package/dist/assets/{SaveBar-RCXr0jey.js → SaveBar-Shmn699J.js} +1 -1
- package/dist/assets/{Scheduler-B70tknnx.js → Scheduler-Bqr0WHNd.js} +1 -1
- package/dist/assets/{ScopeSwitcher-p_tgO5Sa.js → ScopeSwitcher-CBx1fB5g.js} +1 -1
- package/dist/assets/{Settings-wHiAxTfI.js → Settings-Ci8in-yF.js} +1 -1
- package/dist/assets/{SkillReferenceGraph-D_Pt35vb.js → SkillReferenceGraph-BWwljba8.js} +1 -1
- package/dist/assets/{Skills-DUvOrgw9.js → Skills-BON6o-c4.js} +1 -1
- package/dist/assets/{SystemPrompt-BrNIdy68.js → SystemPrompt-D5epIYYs.js} +1 -1
- package/dist/assets/{TagLibrary-CDRatxXG.js → TagLibrary-C2qDZROJ.js} +1 -1
- package/dist/assets/{TiptapBody-BF8PxUDj.js → TiptapBody-SZhI3-bW.js} +1 -1
- package/dist/assets/{Toggle-CQH8NGXW.js → Toggle-C_qFDG0g.js} +1 -1
- package/dist/assets/{ViewTabs-DwnxqCVs.js → ViewTabs-C9q5WCEd.js} +1 -1
- package/dist/assets/{historyTotals-KINLTHQ4.js → historyTotals-BCl7IOhY.js} +1 -1
- package/dist/assets/{index-CfR3NU2t.js → index-CMIYLbPb.js} +581 -581
- package/dist/assets/{settingsSchema-BUcHqLnt.js → settingsSchema-BBrRBrBr.js} +1 -1
- package/dist/assets/{skillFrontmatter-BwwkyuMD.js → skillFrontmatter-B01qJk6N.js} +1 -1
- package/dist/assets/{useAgentsDirWatch-Coem9Wg-.js → useAgentsDirWatch-CuR3GSjS.js} +1 -1
- package/dist/index.html +1 -1
- package/dist-web/{assets/app.js → app.js} +351 -351
- package/dist-web/index.html +2 -2
- package/package.json +2 -2
- package/plugins/session-manager-dev/.claude-plugin/plugin.json +1 -1
- package/plugins/session-manager-dev/skills/develop/SKILL.md +3 -2
- package/plugins/session-manager-dev/skills/send-feedback/SKILL.md +10 -2
- package/scripts/scheduler-mcp-server.cjs +56 -5
- package/src/main/build-info.json +4 -4
- package/src/main/chatRunner.cjs +73 -6
- package/src/main/crashDiagnostics.cjs +83 -8
- package/src/main/health.cjs +16 -5
- package/src/main/index.cjs +32 -0
- package/src/main/lib/chatBootRecovery.cjs +136 -0
- package/src/main/lib/chatInflight.cjs +88 -0
- package/src/main/lib/epic/epicDelegationStats.cjs +1 -0
- package/src/main/lib/epic/epicMint.cjs +6 -0
- package/src/main/lib/epic/epicSweepValidator.cjs +60 -6
- package/src/main/lib/epic/epicValidationHook.cjs +14 -2
- package/src/main/lib/epic/epicWorktreeMerge.cjs +9 -1
- package/src/main/lib/feedback-remote/autoStartedSession.cjs +102 -0
- package/src/main/lib/feedback-remote/crossProjectFeedback.cjs +130 -15
- package/src/main/lib/feedback-remote/macroAdminRoutes.cjs +71 -15
- package/src/main/lib/feedback-remote/remoteAssets.cjs +25 -1
- package/src/main/lib/feedback-remote/remoteIpcDispatch.cjs +13 -2
- package/src/main/lib/git/gitExec.cjs +11 -1
- package/src/main/lib/git/gitWorktree.cjs +255 -9
- package/src/main/lib/git/jobWorktree.cjs +5 -0
- package/src/main/lib/mcpToolCatalog.cjs +27 -5
- package/src/main/lib/persona-macro/builtinMacros.cjs +12 -1
- package/src/main/lib/persona-macro/macroLibrary.cjs +78 -3
- package/src/main/lib/persona-macro/shippedPersonaSeeds.cjs +11 -0
- package/src/main/lib/prd/prdCreate.cjs +5 -1
- package/src/main/lib/prd/prdDeclaredPaths.cjs +29 -2
- package/src/main/lib/process/childWithLog.cjs +38 -95
- package/src/main/lib/process/memoryScope.cjs +140 -0
- package/src/main/lib/process/ozonePlatform.cjs +15 -0
- package/src/main/lib/process/procIdentity.cjs +10 -3
- package/src/main/lib/process/scopeOomPolicy.cjs +69 -0
- package/src/main/lib/promptSessionSchema.cjs +6 -1
- package/src/main/lib/scheduler/cpuSample.cjs +147 -0
- package/src/main/lib/scheduler/definitionOfDone.cjs +40 -0
- package/src/main/lib/scheduler/jobLeftovers.cjs +204 -0
- package/src/main/lib/scheduler/jobSupervisorRecord.cjs +2 -1
- package/src/main/lib/scheduler/landedSinceRun.cjs +13 -5
- package/src/main/lib/scheduler/loadGate.cjs +116 -45
- package/src/main/lib/scheduler/queueStore.cjs +5 -2
- package/src/main/lib/scheduler/rcaReport.cjs +1 -0
- package/src/main/lib/scheduler/reviewNotice.cjs +1 -0
- package/src/main/lib/scheduler/schedulerBatch.cjs +10 -3
- package/src/main/lib/scheduler/schedulerConfig.cjs +7 -2
- package/src/main/lib/telemetry/crashTelemetry.cjs +8 -4
- package/src/main/runVerify.cjs +59 -110
- package/src/main/scheduler/budget.cjs +31 -0
- package/src/main/scheduler/gitTreeGuard.cjs +51 -1
- package/src/main/scheduler/prdPaths.cjs +54 -0
- package/src/main/scheduler/reviewLadder.cjs +28 -5
- package/src/main/scheduler/starvation.cjs +22 -0
- package/src/main/scheduler.cjs +662 -90
- package/src/main/templates/PRD_AUTHORING.md +10 -3
- package/src/main/usage.cjs +4 -2
- package/src/main/webRemote.cjs +3 -0
- package/src/preload/api.d.ts +19 -3
- package/src/seed/agents/demo-video-builder.md +62 -14
- /package/dist-web/{assets/app.css → app.css} +0 -0
|
@@ -240,6 +240,16 @@ function shouldKillForBudget(elapsedMs, budgetMs) {
|
|
|
240
240
|
return elapsedMs >= budgetMs;
|
|
241
241
|
}
|
|
242
242
|
|
|
243
|
+
/**
|
|
244
|
+
* resolveBudgetEstimate({ estimateMinutes, validatorEstimate, personaEstimate }) → number | null
|
|
245
|
+
* An explicit estimate wins; otherwise the larger of the validator-derived and
|
|
246
|
+
* persona-default estimates (persona stays a lower bound); null if neither.
|
|
247
|
+
*/
|
|
248
|
+
function resolveBudgetEstimate({ estimateMinutes, validatorEstimate, personaEstimate } = {}) {
|
|
249
|
+
if (estimateMinutes != null) return estimateMinutes;
|
|
250
|
+
return Math.max(validatorEstimate ?? 0, personaEstimate ?? 0) || null;
|
|
251
|
+
}
|
|
252
|
+
|
|
243
253
|
/**
|
|
244
254
|
* resolveBudgetKillOutcome({ killedByWatchdog, killedBySignal, durationMs, jobBudgetMs, estimateMinutes })
|
|
245
255
|
* → { killedByWatchdog: 'budget'|null, budgetKillReason: string|null }
|
|
@@ -544,7 +554,27 @@ function selectLeftoverQuarantineTarget(job) {
|
|
|
544
554
|
return { slug: job.slug, cwd: job.cwd, paths };
|
|
545
555
|
}
|
|
546
556
|
|
|
557
|
+
/**
|
|
558
|
+
* Why a tick found zero free slots. Pure. A degraded usage-meter cap that
|
|
559
|
+
* binds while the pool still has room is its own reason; a truly full pool
|
|
560
|
+
* stays 'slots-exhausted' even when the meter is also degraded.
|
|
561
|
+
*/
|
|
562
|
+
function describeSlotHold({ total, inUse, holders = [], degradedCap = null, running = 0, deferredCount = 0 } = {}) {
|
|
563
|
+
if (degradedCap != null && inUse < total) {
|
|
564
|
+
return {
|
|
565
|
+
reason: 'usage-meter-degraded',
|
|
566
|
+
detail: `usage meter down: running capped at ${degradedCap} (${running} running, ${inUse} of ${total} slots in use)`,
|
|
567
|
+
};
|
|
568
|
+
}
|
|
569
|
+
const owners = (holders || []).map((h) => h.owner).join(', ');
|
|
570
|
+
return {
|
|
571
|
+
reason: 'slots-exhausted',
|
|
572
|
+
detail: `${inUse} of ${total} session slots busy${owners ? ` (${owners})` : ''}`,
|
|
573
|
+
};
|
|
574
|
+
}
|
|
575
|
+
|
|
547
576
|
module.exports = {
|
|
577
|
+
describeSlotHold,
|
|
548
578
|
BACKOFF_MAX_MS,
|
|
549
579
|
FAILURE_STREAK_WARN_THRESHOLD,
|
|
550
580
|
FAILURE_STREAK_ESCALATION_MS,
|
|
@@ -571,6 +601,7 @@ module.exports = {
|
|
|
571
601
|
isJobBudgetExempt,
|
|
572
602
|
shouldKillForBudget,
|
|
573
603
|
resolveBudgetKillOutcome,
|
|
604
|
+
resolveBudgetEstimate,
|
|
574
605
|
findStrandedInvestigations,
|
|
575
606
|
computeDepHistorySatisfaction,
|
|
576
607
|
};
|
|
@@ -11,6 +11,7 @@ const { execFile, execFileSync } = require('node:child_process');
|
|
|
11
11
|
const gitWorktree = require('../lib/git/gitWorktree.cjs');
|
|
12
12
|
const sharedGitExec = require('../lib/git/gitExec.cjs');
|
|
13
13
|
const { resolveProjectRoot } = require('../lib/opsOwnership.cjs');
|
|
14
|
+
const { COMPLETED_EQUIVALENT_VERDICTS } = require('../lib/scheduler/terminalRunOutcome.cjs');
|
|
14
15
|
|
|
15
16
|
// Unquote a single git porcelain v1 path token. Defined once in
|
|
16
17
|
// gitWorktree.cjs (which this file already requires — the reverse would be
|
|
@@ -417,7 +418,7 @@ async function committedInWindow(cwd, startedAt, finishedAt) {
|
|
|
417
418
|
: new Date().toISOString();
|
|
418
419
|
execFile(
|
|
419
420
|
'git',
|
|
420
|
-
['-C', cwd, 'log', '--all', '--format=%H', `--since=${startedAt}`, `--until=${until}`],
|
|
421
|
+
['-C', cwd, 'log', `--exclude=${sharedGitExec.STRANDED_REF_PREFIX}*`, '--all', '--format=%H', `--since=${startedAt}`, `--until=${until}`],
|
|
421
422
|
{ timeout: 10_000, windowsHide: true },
|
|
422
423
|
(err, stdout) => { resolve(!err && String(stdout || '').trim().length > 0); },
|
|
423
424
|
);
|
|
@@ -448,6 +449,24 @@ async function computeCommittedDuringRun(cwd, headBefore, headAfter, startedAt,
|
|
|
448
449
|
return module.exports.committedInWindow(cwd, startedAt, untilIso);
|
|
449
450
|
}
|
|
450
451
|
|
|
452
|
+
/**
|
|
453
|
+
* A worktree run whose commit could not land (diverged HEAD, cancelled,
|
|
454
|
+
* integration refused) leaves pinned commits behind. Pure.
|
|
455
|
+
* @param {{worktreeHead?: {stranded?: Array<{sha: string, ref: string}>}|null, landedCommit?: string|null}} a
|
|
456
|
+
* @returns {{verdict: string, reason: string, downgradeTo: string}|null}
|
|
457
|
+
*/
|
|
458
|
+
function strandedCommitVerdict({ worktreeHead, landedCommit } = {}) {
|
|
459
|
+
if (landedCommit) return null;
|
|
460
|
+
const stranded = Array.isArray(worktreeHead?.stranded) ? worktreeHead.stranded.filter((s) => s && s.sha) : [];
|
|
461
|
+
if (stranded.length === 0) return null;
|
|
462
|
+
const list = stranded.map((s) => `${String(s.sha).slice(0, 8)} (pinned at ${s.ref || 'no pin ref'})`).join(', ');
|
|
463
|
+
return {
|
|
464
|
+
verdict: 'run_commit_not_landed',
|
|
465
|
+
reason: `run made ${stranded.length} commit(s) that did not land on the base branch: ${list}`,
|
|
466
|
+
downgradeTo: 'needs_review',
|
|
467
|
+
};
|
|
468
|
+
}
|
|
469
|
+
|
|
451
470
|
/**
|
|
452
471
|
* Which commit does this run get credit for? A worktree-isolated run shares the
|
|
453
472
|
* main checkout with concurrent jobs, so a HEAD move there may be someone else's
|
|
@@ -644,6 +663,35 @@ async function landedCommitIsAncestorOfHead(cwd, sha) {
|
|
|
644
663
|
}
|
|
645
664
|
}
|
|
646
665
|
|
|
666
|
+
/**
|
|
667
|
+
* Should spawnJob skip the commit guard for this run? Pure.
|
|
668
|
+
* Skips when the job is about to re-fire (downgradeTo pending), when the
|
|
669
|
+
* verdict is run_commit_not_landed (the stranded-commit verdict owns the row;
|
|
670
|
+
* the guard must not replace it with silent_no_op), and for completed-equivalent
|
|
671
|
+
* verdicts — EXCEPT pass_no_commit_artifact_verified (guard still runs), and
|
|
672
|
+
* except a pass_no_commit_* verdict in a worktree with newly dirty files: a
|
|
673
|
+
* worktree's dirt is attributable to the job, so it is real dropped work.
|
|
674
|
+
* Also a `clean` verdict in a worktree with dirt and no landedCommit (a
|
|
675
|
+
* fix-plan PASS whose edits would be dropped) is not skipped; with a landed
|
|
676
|
+
* commit it still skips.
|
|
677
|
+
* @param {{verifyResult?: {verdict?: string, downgradeTo?: string|null}|null, ranInWorktree?: boolean, newlyDirty?: string[]|null}} a
|
|
678
|
+
* @returns {boolean}
|
|
679
|
+
*/
|
|
680
|
+
function commitGuardSkipped({ verifyResult, ranInWorktree, newlyDirty, landedCommit } = {}) {
|
|
681
|
+
if (!verifyResult) return false;
|
|
682
|
+
if (verifyResult.downgradeTo === 'pending') return true;
|
|
683
|
+
const verdict = verifyResult.verdict;
|
|
684
|
+
if (verdict === 'run_commit_not_landed') return true;
|
|
685
|
+
if (verdict === 'pass_no_commit_artifact_verified') return false;
|
|
686
|
+
const dirty = Array.isArray(newlyDirty) && newlyDirty.length > 0;
|
|
687
|
+
// A fix-plan PASS gets verdict `clean`; in a worktree with own dirt and no
|
|
688
|
+
// landed commit its edits would be dropped, so the guard must run.
|
|
689
|
+
if (verdict === 'clean' && ranInWorktree && dirty && !landedCommit) return false;
|
|
690
|
+
if (!COMPLETED_EQUIVALENT_VERDICTS.has(verdict)) return false;
|
|
691
|
+
if (ranInWorktree && dirty && String(verdict).startsWith('pass_no_commit')) return false;
|
|
692
|
+
return true;
|
|
693
|
+
}
|
|
694
|
+
|
|
647
695
|
module.exports = {
|
|
648
696
|
splitRenamePorcelainField,
|
|
649
697
|
parsePorcelainEntries,
|
|
@@ -662,6 +710,7 @@ module.exports = {
|
|
|
662
710
|
committedInWindow,
|
|
663
711
|
computeCommittedDuringRun,
|
|
664
712
|
resolveRunCommitAttribution,
|
|
713
|
+
strandedCommitVerdict,
|
|
665
714
|
gitRangeCommits,
|
|
666
715
|
isBranchAlreadyIntegrated,
|
|
667
716
|
classifySigtermWithCommit,
|
|
@@ -669,4 +718,5 @@ module.exports = {
|
|
|
669
718
|
evaluateDispatchSidecarReconcile,
|
|
670
719
|
isQueueRowRegression,
|
|
671
720
|
landedCommitIsAncestorOfHead,
|
|
721
|
+
commitGuardSkipped,
|
|
672
722
|
};
|
|
@@ -313,6 +313,59 @@ async function resolveBareSlugFile(slug, cwd) {
|
|
|
313
313
|
return { ok: true, path: safe, dir: only.dir };
|
|
314
314
|
}
|
|
315
315
|
|
|
316
|
+
/**
|
|
317
|
+
* Text of each named PRD of one Epic, wherever it lives now: its prds/, its
|
|
318
|
+
* prds-archived/, each direct subfolder of prds-archived/ (newest name first),
|
|
319
|
+
* then the same for ancestor-folder copies of the Epic. First match wins; an
|
|
320
|
+
* exact `<slug>.md` beats a bare-slug match (`fix-x` finds `872-fix-x.md`).
|
|
321
|
+
* Slugs are only compared with readdir names, never joined into a path; only
|
|
322
|
+
* regular `.md` files are read. Never rejects. Returns Map<inputSlug, text>.
|
|
323
|
+
*/
|
|
324
|
+
async function readEpicPrdTexts(cwd, epicId, slugs) {
|
|
325
|
+
const out = new Map();
|
|
326
|
+
try {
|
|
327
|
+
if (typeof cwd !== 'string' || !cwd || !Array.isArray(slugs) || slugs.length === 0) return out;
|
|
328
|
+
if (!isSafeEpicId(epicId)) return out;
|
|
329
|
+
const root = projectRootOf(cwd);
|
|
330
|
+
const live = resolveEpicPrdWriteDir(root, epicId);
|
|
331
|
+
const archived = path.join(path.dirname(live), 'prds-archived');
|
|
332
|
+
const dirs = [];
|
|
333
|
+
const addWithSubs = async (dir) => {
|
|
334
|
+
dirs.push(dir);
|
|
335
|
+
const ents = await fsp.readdir(dir, { withFileTypes: true }).catch(() => []);
|
|
336
|
+
const subs = ents.filter((e) => e.isDirectory()).map((e) => e.name).sort().reverse();
|
|
337
|
+
for (const s of subs) dirs.push(path.join(dir, s));
|
|
338
|
+
};
|
|
339
|
+
dirs.push(live);
|
|
340
|
+
await addWithSubs(archived);
|
|
341
|
+
for (const d of ancestorEpicPrdDirs(root, epicId)) dirs.push(d);
|
|
342
|
+
for (const d of ancestorEpicArchivedPrdDirs(root, epicId)) await addWithSubs(d);
|
|
343
|
+
const index = new Map();
|
|
344
|
+
for (const dir of dirs) {
|
|
345
|
+
let ents;
|
|
346
|
+
try { ents = await fsp.readdir(dir, { withFileTypes: true }); } catch { continue; }
|
|
347
|
+
for (const e of ents) {
|
|
348
|
+
if (!e.isFile() || !e.name.endsWith('.md')) continue;
|
|
349
|
+
const key = e.name.slice(0, -3);
|
|
350
|
+
if (!index.has(key)) index.set(key, path.join(dir, e.name));
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
for (const slug of slugs) {
|
|
354
|
+
if (typeof slug !== 'string' || !slug || out.has(slug)) continue;
|
|
355
|
+
let file = index.get(slug);
|
|
356
|
+
if (!file) {
|
|
357
|
+
const bare = bareSlug(slug);
|
|
358
|
+
for (const [key, p] of index) {
|
|
359
|
+
if (bareSlug(key) === bare) { file = p; break; }
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
if (!file) continue;
|
|
363
|
+
try { out.set(slug, await fsp.readFile(file, 'utf8')); } catch { /* unreadable — no entry */ }
|
|
364
|
+
}
|
|
365
|
+
} catch { /* never rejects */ }
|
|
366
|
+
return out;
|
|
367
|
+
}
|
|
368
|
+
|
|
316
369
|
/**
|
|
317
370
|
* The two distinct failure modes safeSlugPath collapses into one nullable
|
|
318
371
|
* return (the defect this fixes — see the PRD that added this helper's
|
|
@@ -568,6 +621,7 @@ module.exports = {
|
|
|
568
621
|
realPrdsDir,
|
|
569
622
|
safeSlugPath,
|
|
570
623
|
resolveBareSlugFile,
|
|
624
|
+
readEpicPrdTexts,
|
|
571
625
|
resolveSlugOrReason,
|
|
572
626
|
jobMatchesSlugAndCwd,
|
|
573
627
|
unknownSlugMessage,
|
|
@@ -94,12 +94,16 @@ function selectResumeRecoveryTarget(job) {
|
|
|
94
94
|
const MECHANICALLY_RESOLVABLE_VERDICTS = new Set(['worktree_integration_failed']);
|
|
95
95
|
|
|
96
96
|
/**
|
|
97
|
-
* True when a retry is provably futile: a content_conflict whose base HEAD is
|
|
97
|
+
* True when a retry is provably futile: a content_conflict or hook_rejected whose base HEAD is
|
|
98
98
|
* the same as at failure time. Unknown state (no stamp, null current HEAD)
|
|
99
99
|
* is NOT futile — falls back to attempting the retry.
|
|
100
100
|
*/
|
|
101
|
+
function isHeadSensitiveFailureKind(kind) {
|
|
102
|
+
return kind === 'content_conflict' || kind === 'hook_rejected';
|
|
103
|
+
}
|
|
104
|
+
|
|
101
105
|
function isMechanicalRecoveryFutile(job, currentHeadSha) {
|
|
102
|
-
return job.integrationFailureKind
|
|
106
|
+
return isHeadSensitiveFailureKind(job.integrationFailureKind)
|
|
103
107
|
&& !!job.integrationBaseHeadSha
|
|
104
108
|
&& !!currentHeadSha
|
|
105
109
|
&& job.integrationBaseHeadSha === currentHeadSha;
|
|
@@ -161,8 +165,9 @@ function fixSlugFor(job) {
|
|
|
161
165
|
// fix-plan job flagged before that exemption shipped gets a genuinely
|
|
162
166
|
// different verdict on rescan (2026-07-12: false-positive cascade where
|
|
163
167
|
// investigation jobs correctly found "nothing to fix" but were flagged
|
|
164
|
-
// anyway). For non-fix-plan jobs the exemption never applies, so
|
|
165
|
-
//
|
|
168
|
+
// anyway). For non-fix-plan jobs the exemption never applies, so a rescan
|
|
169
|
+
// reaches the same verdict, and healRefusalReason refuses to heal a
|
|
170
|
+
// pass_no_commit row off a repo-wide commit that is not this job's own.
|
|
166
171
|
const RESCANNABLE_VERDICTS = new Set(['transcript_errors', 'verify_unavailable', 'no_verdict_sentinel', 'abandoned_background_task', 'pass_no_commit', 'pass_no_commit_already_shipped']);
|
|
167
172
|
// RESCANNABLE_VERDICTS is a HINT, not a gate: it names the verdicts whose
|
|
168
173
|
// recovery rung is a transcript re-verification (verifyRun). Every other
|
|
@@ -487,7 +492,7 @@ function isFixPlanDead(job, jobsInProject) {
|
|
|
487
492
|
// committedDuringRun repo-wide-not-per-job attribution problem) — the PRD 983
|
|
488
493
|
// incident mechanism above applies identically, so it gets the same guard
|
|
489
494
|
// rather than a carve-out that would silently reopen the same false-heal hole.
|
|
490
|
-
const NO_ATTRIBUTABLE_COMMIT_VERDICTS = new Set(['no_verdict_sentinel', 'abandoned_background_task']);
|
|
495
|
+
const NO_ATTRIBUTABLE_COMMIT_VERDICTS = new Set(['no_verdict_sentinel', 'abandoned_background_task', 'pass_no_commit']);
|
|
491
496
|
|
|
492
497
|
function healRefusalReason(job, verdict, committedDuringRun) {
|
|
493
498
|
if (!job || !verdict) return null;
|
|
@@ -1004,12 +1009,30 @@ function selectGateShadowTarget(jobs, headByCwd, { authorityDisabled = false, ba
|
|
|
1004
1009
|
return eligible.find((j) => !j.gateShadow) ?? null;
|
|
1005
1010
|
}
|
|
1006
1011
|
|
|
1012
|
+
/**
|
|
1013
|
+
* Resume-recovery rows a periodic pass may launch: every row
|
|
1014
|
+
* selectResumeRecoveryTarget accepts, or only the first when the CPU is
|
|
1015
|
+
* saturated (the rest stay eligible for the next pass).
|
|
1016
|
+
*/
|
|
1017
|
+
function selectResumeRecoveryBatch(jobs, { saturated = false } = {}) {
|
|
1018
|
+
const batch = [];
|
|
1019
|
+
for (const job of jobs ?? []) {
|
|
1020
|
+
const target = selectResumeRecoveryTarget(job);
|
|
1021
|
+
if (!target) continue;
|
|
1022
|
+
batch.push({ job, target });
|
|
1023
|
+
if (saturated) break;
|
|
1024
|
+
}
|
|
1025
|
+
return batch;
|
|
1026
|
+
}
|
|
1027
|
+
|
|
1007
1028
|
module.exports = {
|
|
1029
|
+
selectResumeRecoveryBatch,
|
|
1008
1030
|
isRefireCapped,
|
|
1009
1031
|
isCancelledJob,
|
|
1010
1032
|
selectResumeRecoveryTarget,
|
|
1011
1033
|
MECHANICALLY_RESOLVABLE_VERDICTS,
|
|
1012
1034
|
isMechanicalRecoveryFutile,
|
|
1035
|
+
isHeadSensitiveFailureKind,
|
|
1013
1036
|
selectMechanicalRecoveryTarget,
|
|
1014
1037
|
isStaleSharedTreeRevertedPark,
|
|
1015
1038
|
fixSlugFor,
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
'use strict';
|
|
7
7
|
|
|
8
8
|
const launchFailure = require('../lib/scheduler/launchFailure.cjs');
|
|
9
|
+
const { findBlockingDep, DEP_HISTORY_FAIL_OPEN } = require('../lib/scheduler/schedulerBatch.cjs');
|
|
9
10
|
const { STARVE_ESCALATION_MS } = require('../lib/scheduler/schedulerConfig.cjs');
|
|
10
11
|
|
|
11
12
|
/**
|
|
@@ -132,6 +133,26 @@ function launchBlockedSlugs(jobs, launchBlocks) {
|
|
|
132
133
|
return out;
|
|
133
134
|
}
|
|
134
135
|
|
|
136
|
+
/**
|
|
137
|
+
* describeStarveHold({ projectRows, launchBlocks, lastTick, lastHoldTick }) → string
|
|
138
|
+
*
|
|
139
|
+
* Pure. Names the real limiter for a starved project: its own dependency wait,
|
|
140
|
+
* then a launch breaker, then the last tick's reason (or the last hold carried
|
|
141
|
+
* past a fired tick). 'unknown' only when the scheduler has not ticked.
|
|
142
|
+
*/
|
|
143
|
+
function describeStarveHold({ projectRows = [], launchBlocks = {}, lastTick = null, lastHoldTick = null } = {}) {
|
|
144
|
+
const rows = Array.isArray(projectRows) ? projectRows : [];
|
|
145
|
+
const pending = rows.filter((j) => j && j.status === 'pending');
|
|
146
|
+
if (pending.length) {
|
|
147
|
+
if (pending.every((j) => findBlockingDep(j, rows, DEP_HISTORY_FAIL_OPEN))) return 'dependency-blocked';
|
|
148
|
+
const blocked = launchBlockedSlugs(pending, launchBlocks);
|
|
149
|
+
if (pending.every((j) => blocked.has(j.slug))) return 'launch-blocked';
|
|
150
|
+
}
|
|
151
|
+
if (!lastTick) return 'unknown';
|
|
152
|
+
if (!lastTick.fired && lastTick.reason) return lastTick.reason;
|
|
153
|
+
return lastHoldTick?.reason ?? 'dispatching-elsewhere';
|
|
154
|
+
}
|
|
155
|
+
|
|
135
156
|
/**
|
|
136
157
|
* classifyQueueStarvation({ jobs, paused, runningCount, lastRunAtMs, now, thresholdMs })
|
|
137
158
|
* → null | { kind: 'starved' | 'blocked', pending, dispatchable, blockedChains, idleMs }
|
|
@@ -383,6 +404,7 @@ module.exports = {
|
|
|
383
404
|
STARVE_ESCALATION_MS,
|
|
384
405
|
dispatchIdleMs,
|
|
385
406
|
launchBlockedSlugs,
|
|
407
|
+
describeStarveHold,
|
|
386
408
|
classifyQueueStarvation,
|
|
387
409
|
classifyQueueStarvationByProject,
|
|
388
410
|
classifyQueueHealth,
|