claude-code-session-manager 0.145.0 → 0.146.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-BR5b6oof.js → AppSettings-BXfkoKQq.js} +1 -1
- package/dist/assets/{History-B4U0mCdK.js → History-l7pBt_vO.js} +1 -1
- package/dist/assets/{HomeClaudeConfig-DQqG7lFE.js → HomeClaudeConfig-DtFwZxTx.js} +2 -2
- package/dist/assets/{Panel-CwsOJ0nI.js → Panel-C5hihgUD.js} +1 -1
- package/dist/assets/{ProjectClaudeConfig-BzRowu8x.js → ProjectClaudeConfig-B3pODrM-.js} +1 -1
- package/dist/assets/{Scheduler-dr7CNOcL.js → Scheduler-IU9wo8_u.js} +1 -1
- package/dist/assets/{SkillReferenceGraph-CroBPY4C.js → SkillReferenceGraph-Bmen0OOC.js} +1 -1
- package/dist/assets/{Skills-BiW2lCnD.js → Skills-jYVxqJr2.js} +1 -1
- package/dist/assets/{TiptapBody-CYTkQiva.js → TiptapBody-Dp2gtbb-.js} +1 -1
- package/dist/assets/{Toggle-WFBYo8JI.js → Toggle-C_0yUCS5.js} +1 -1
- package/dist/assets/{VoiceButton-DZu8dTpO.js → VoiceButton-BRPzqDa-.js} +1 -1
- package/dist/assets/{historyTotals-B7KeXLSE.js → historyTotals-pAv-MFnY.js} +1 -1
- package/dist/assets/{index-hXRNm0UJ.js → index-C6nhp7m_.js} +496 -496
- package/dist/index.html +1 -1
- package/dist-web/app.js +408 -408
- package/package.json +1 -1
- package/plugins/session-manager-dev/skills/send-feedback/SKILL.md +4 -2
- package/scripts/scheduler-mcp-server.cjs +4 -3
- package/src/main/adminRouteRegistry.cjs +1 -1
- package/src/main/build-info.json +4 -4
- package/src/main/lib/claude/claudeJsonApproval.cjs +129 -0
- package/src/main/lib/demo-video-kit/resumableRun.cjs +15 -1
- package/src/main/lib/demo-video-kit/seedKit.cjs +2 -2
- package/src/main/lib/epic/epicSpawnCwd.cjs +1 -0
- package/src/main/lib/epic/planReviewInput.cjs +3 -6
- package/src/main/lib/feedback-remote/crossProjectFeedback.cjs +136 -37
- package/src/main/lib/feedback-remote/serviceMcpTools.cjs +23 -3
- package/src/main/lib/git/gitWorktree.cjs +17 -0
- package/src/main/lib/mcpToolCatalog.cjs +2 -1
- package/src/main/lib/scheduler/planReleaseRoute.cjs +53 -5
- package/src/main/lib/scheduler/rcaReport.cjs +1 -0
- package/src/main/lib/scheduler/terminalRunOutcome.cjs +1 -0
- package/src/main/runVerify.cjs +30 -0
- package/src/main/scheduler.cjs +60 -9
|
@@ -23,6 +23,8 @@ const fs = require('node:fs');
|
|
|
23
23
|
const { assertOpsWrite, resolveProjectRoot } = require('../opsOwnership.cjs');
|
|
24
24
|
const { writeJsonAtomic } = require('../util/atomicFs.cjs');
|
|
25
25
|
const { EPIC_ID_RE } = require('./planRecordHarvest.cjs');
|
|
26
|
+
const path = require('node:path');
|
|
27
|
+
const { resolveEpicsRoot, ancestorEpicPrdDirs, ancestorEpicArchivedPrdDirs } = require('../prd/prdLocations.cjs');
|
|
26
28
|
|
|
27
29
|
const MAX_BODY_BYTES = 256 * 1024;
|
|
28
30
|
const SLUG_RE = /^[A-Za-z0-9][A-Za-z0-9._-]*$/;
|
|
@@ -44,6 +46,44 @@ function latestHasBlock(record) {
|
|
|
44
46
|
return prds.some((/** @type {any} */ p) => p && p.decision === 'block');
|
|
45
47
|
}
|
|
46
48
|
|
|
49
|
+
/**
|
|
50
|
+
* Resolve a planner-supplied validate slug to the Epic's real PRD slug. The
|
|
51
|
+
* scheduler keys the hold on the NUMBERED slug, so a bare `validate-x` maps to
|
|
52
|
+
* the one `<digits>-validate-x.md` in prds/ or prds-archived/ (one level of
|
|
53
|
+
* timestamped subfolders included).
|
|
54
|
+
* @param {string} cwd @param {string} epicId @param {string} slug
|
|
55
|
+
* @returns {{ slug: string } | { error: 'unknown_plan' } | { error: 'ambiguous_plan', candidates: string[] }}
|
|
56
|
+
*/
|
|
57
|
+
function resolveValidateSlug(cwd, epicId, slug) {
|
|
58
|
+
/** @type {string[]} */
|
|
59
|
+
const dirs = [];
|
|
60
|
+
try {
|
|
61
|
+
const own = path.join(resolveEpicsRoot(cwd), epicId);
|
|
62
|
+
dirs.push(path.join(own, 'prds'), path.join(own, 'prds-archived'));
|
|
63
|
+
} catch { /* no ops root */ }
|
|
64
|
+
dirs.push(...ancestorEpicPrdDirs(cwd, epicId), ...ancestorEpicArchivedPrdDirs(cwd, epicId));
|
|
65
|
+
/** @type {Set<string>} */
|
|
66
|
+
const names = new Set();
|
|
67
|
+
for (const dir of dirs) {
|
|
68
|
+
/** @type {fs.Dirent[]} */
|
|
69
|
+
let entries;
|
|
70
|
+
try { entries = fs.readdirSync(dir, { withFileTypes: true }); } catch { continue; }
|
|
71
|
+
for (const e of entries) {
|
|
72
|
+
if (e.isFile()) names.add(e.name);
|
|
73
|
+
else if (e.isDirectory()) {
|
|
74
|
+
try { for (const n of fs.readdirSync(path.join(dir, e.name))) names.add(n); } catch { /* skip */ }
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
if (names.has(`${slug}.md`)) return { slug };
|
|
79
|
+
const re = /^(\d+)-(.+)\.md$/;
|
|
80
|
+
const candidates = [...names].map((n) => re.exec(n)).filter((m) => m && m[2] === slug)
|
|
81
|
+
.map((m) => /** @type {RegExpExecArray} */ (m)[0].slice(0, -3)).sort();
|
|
82
|
+
if (candidates.length === 1) return { slug: candidates[0] };
|
|
83
|
+
if (candidates.length === 0) return { error: 'unknown_plan' };
|
|
84
|
+
return { error: 'ambiguous_plan', candidates };
|
|
85
|
+
}
|
|
86
|
+
|
|
47
87
|
/** @param {{ registerRoute: Function }} adminHttp */
|
|
48
88
|
function registerPlanReleaseRoute(adminHttp) {
|
|
49
89
|
adminHttp.registerRoute('POST', '/admin/scheduler/release-plan', async (/** @type {any} */ req, /** @type {any} */ res) => {
|
|
@@ -57,7 +97,8 @@ function registerPlanReleaseRoute(adminHttp) {
|
|
|
57
97
|
try { json = JSON.parse(raw || '{}'); } catch { bad('body is not valid JSON'); return; }
|
|
58
98
|
const parsed = bodySchema.safeParse(json);
|
|
59
99
|
if (!parsed.success) { bad(parsed.error.issues); return; }
|
|
60
|
-
const
|
|
100
|
+
const rawSlug = parsed.data.validateSlug;
|
|
101
|
+
const { epicId, rejected, accepted, rereview } = parsed.data;
|
|
61
102
|
/** @type {string} */
|
|
62
103
|
let cwd;
|
|
63
104
|
try {
|
|
@@ -67,10 +108,17 @@ function registerPlanReleaseRoute(adminHttp) {
|
|
|
67
108
|
sendJson(res, 400, { ok: false, error: 'bad_cwd' });
|
|
68
109
|
return;
|
|
69
110
|
}
|
|
70
|
-
if (!EPIC_ID_RE.test(epicId) || !SLUG_RE.test(
|
|
111
|
+
if (!EPIC_ID_RE.test(epicId) || !SLUG_RE.test(rawSlug) || rawSlug.includes('..')) {
|
|
71
112
|
bad('unsafe epicId or validateSlug');
|
|
72
113
|
return;
|
|
73
114
|
}
|
|
115
|
+
const resolved = resolveValidateSlug(cwd, epicId, rawSlug);
|
|
116
|
+
if ('error' in resolved) {
|
|
117
|
+
if (resolved.error === 'unknown_plan') sendJson(res, 404, { ok: false, error: 'unknown_plan' });
|
|
118
|
+
else sendJson(res, 400, { ok: false, error: 'ambiguous_plan', candidates: resolved.candidates });
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
const validateSlug = resolved.slug;
|
|
74
122
|
try {
|
|
75
123
|
const prior = readPlanReview(cwd, epicId, validateSlug);
|
|
76
124
|
|
|
@@ -85,7 +133,7 @@ function registerPlanReleaseRoute(adminHttp) {
|
|
|
85
133
|
const file = planReviewPath(cwd, epicId, validateSlug);
|
|
86
134
|
assertOpsWrite(file, 'scheduler');
|
|
87
135
|
await writeJsonAtomic(file, { ...prior, rereviewRequested: true });
|
|
88
|
-
sendJson(res, 200, { ok: true, rereviewRequested: true });
|
|
136
|
+
sendJson(res, 200, { ok: true, rereviewRequested: true, validateSlug });
|
|
89
137
|
return;
|
|
90
138
|
}
|
|
91
139
|
|
|
@@ -99,8 +147,8 @@ function registerPlanReleaseRoute(adminHttp) {
|
|
|
99
147
|
rejected: rejected.map((r) => ({ finding: r.finding, reason: r.reason.trim() })),
|
|
100
148
|
accepted,
|
|
101
149
|
});
|
|
102
|
-
if (out && out.alreadyReleased) { sendJson(res, 200, { ok: true, alreadyReleased: true }); return; }
|
|
103
|
-
sendJson(res, 200, { ok: true, released: true, accepted, rejected: rejected.length });
|
|
150
|
+
if (out && out.alreadyReleased) { sendJson(res, 200, { ok: true, alreadyReleased: true, validateSlug }); return; }
|
|
151
|
+
sendJson(res, 200, { ok: true, released: true, validateSlug, accepted, rejected: rejected.length });
|
|
104
152
|
} catch (e) {
|
|
105
153
|
sendJson(res, 500, { ok: false, error: 'release_failed', details: e instanceof Error ? e.message : String(e) });
|
|
106
154
|
}
|
|
@@ -60,6 +60,7 @@ const VERDICT_LABELS = {
|
|
|
60
60
|
sentinel_fail: 'executor reported SCHEDULER_VERDICT: FAIL',
|
|
61
61
|
pass_no_commit_already_shipped: 'PASS with no commit — deliverables already shipped',
|
|
62
62
|
pass_no_commit_prior_run_verified: 'PASS with no commit — prior run of this slug already landed the work',
|
|
63
|
+
pass_no_commit_plan_review: 'plan-reviewer returned its structured review — no commit expected',
|
|
63
64
|
silent_no_op: 'no commit, clean tree — no evidence of work',
|
|
64
65
|
blocked_by_foreign_wip_streak: 'blocked by a sibling job\'s foreign WIP 3x in a row',
|
|
65
66
|
};
|
|
@@ -22,6 +22,7 @@ const COMPLETED_EQUIVALENT_VERDICTS = new Set([
|
|
|
22
22
|
'pass_no_commit_already_shipped',
|
|
23
23
|
'pass_no_commit_prior_run_verified',
|
|
24
24
|
'pass_no_commit_artifact_verified',
|
|
25
|
+
'pass_no_commit_plan_review',
|
|
25
26
|
]);
|
|
26
27
|
|
|
27
28
|
// Bounds the scan: only the newest few run dirs are stat'd per slug, never
|
package/src/main/runVerify.cjs
CHANGED
|
@@ -30,6 +30,7 @@
|
|
|
30
30
|
* abandoned_background_task → 'needs_review'
|
|
31
31
|
* run_commit_not_landed → 'needs_review' (PASS but transcript SHA unreachable)
|
|
32
32
|
* pass_no_commit_already_shipped → historical rows only; no longer emitted
|
|
33
|
+
* pass_no_commit_plan_review → null (plan-reviewer's structured review is the deliverable)
|
|
33
34
|
*
|
|
34
35
|
* Time complexity: O(N·L) where N = log line count, L = avg content line count.
|
|
35
36
|
* The log is read once with readFileSync (700 KB typical; well within Node.js
|
|
@@ -377,6 +378,20 @@ function scanSentinel(resultEvent, events) {
|
|
|
377
378
|
return null;
|
|
378
379
|
}
|
|
379
380
|
|
|
381
|
+
/**
|
|
382
|
+
* Did a plan-reviewer run return its structured review? Shape only — a plain
|
|
383
|
+
* object carrying a `prds` array; the harvest validates the full schema.
|
|
384
|
+
* @param {{agentType?: string}|null|undefined} queueEntry
|
|
385
|
+
* @param {{structuredOutput?: unknown}|null|undefined} resultEvent
|
|
386
|
+
* @returns {boolean}
|
|
387
|
+
*/
|
|
388
|
+
function isPlanReviewStructured(queueEntry, resultEvent) {
|
|
389
|
+
if (queueEntry?.agentType !== 'plan-reviewer') return false;
|
|
390
|
+
const so = resultEvent?.structuredOutput;
|
|
391
|
+
if (!so || typeof so !== 'object' || Array.isArray(so)) return false;
|
|
392
|
+
return Array.isArray(/** @type {{prds?: unknown}} */ (so).prds);
|
|
393
|
+
}
|
|
394
|
+
|
|
380
395
|
/**
|
|
381
396
|
* 'pass' | 'fail' from a result event's structured_output.schedulerVerdict
|
|
382
397
|
* (validator runs under `--json-schema`), else null.
|
|
@@ -929,6 +944,21 @@ async function verifyRun({
|
|
|
929
944
|
// (abandoned_background_task) so the auto-fix investigation checks the
|
|
930
945
|
// working tree for already-written work first, instead of re-planning the
|
|
931
946
|
// whole PRD from a wrong "stopped on a clarifying question" premise.
|
|
947
|
+
// A plan-reviewer's ONLY deliverable is its PLAN_REVIEW_SCHEMA structured
|
|
948
|
+
// output (FINISH_PLAN_REVIEWER_LINE: no commit, no file, no verdict line);
|
|
949
|
+
// harvestPlanReview saves it. Shape check only (a `prds` array): the
|
|
950
|
+
// harvest's parsePlanReview validates the schema and saves a malformed
|
|
951
|
+
// review as a failed round, which only happens once the job completes.
|
|
952
|
+
// Missing output falls through to the no_verdict_sentinel path below.
|
|
953
|
+
if (sentinel === null && !commitEvidence && exitCode === 0 && isPlanReviewStructured(queueEntry, resultEvent)) {
|
|
954
|
+
return conclude(
|
|
955
|
+
'pass_no_commit_plan_review',
|
|
956
|
+
'plan-reviewer returned its structured review (PLAN_REVIEW_SCHEMA); no commit or verdict line is expected',
|
|
957
|
+
null,
|
|
958
|
+
extras,
|
|
959
|
+
);
|
|
960
|
+
}
|
|
961
|
+
|
|
932
962
|
if (sentinel === null && !commitEvidence) {
|
|
933
963
|
if (hasAbandonedBackgroundTask(events)) {
|
|
934
964
|
issues.push({
|
package/src/main/scheduler.cjs
CHANGED
|
@@ -560,6 +560,12 @@ const FINISH_VALIDATOR_VERDICT_LINE = `
|
|
|
560
560
|
|
|
561
561
|
// Plan-reviewer jobs (`--json-schema` PLAN_REVIEW_SCHEMA): the structured
|
|
562
562
|
// object is the whole deliverable; there is nothing to commit.
|
|
563
|
+
// Plan-reviewer COMMIT sentence: the reviewer is not artifact-only (its PRD
|
|
564
|
+
// declares no deliverable: artifact), but it still commits nothing — say so in
|
|
565
|
+
// the COMMIT step too, not only in the VERDICT bullet below.
|
|
566
|
+
const FINISH_PLAN_REVIEWER_COMMIT_LINE = `
|
|
567
|
+
PLAN REVIEWER: you edit no files, so there is nothing to stage. Skip the commit and go to the next step.`;
|
|
568
|
+
|
|
563
569
|
const FINISH_PLAN_REVIEWER_LINE = `
|
|
564
570
|
- PLAN REVIEWER: your deliverable is the structured output object (PLAN_REVIEW_SCHEMA) ONLY. Do not commit, do not edit files; the scheduler reads the object, not this verdict line.`;
|
|
565
571
|
|
|
@@ -589,7 +595,7 @@ ${commitStepNum}. COMMIT — stage only the exact paths you created or changed f
|
|
|
589
595
|
Never commit any file under these folders (except each folder's top-level README.md, the layout contract), even when the PRD names it:
|
|
590
596
|
${FINISH_RUNTIME_FOLDERS}
|
|
591
597
|
Why: those folders hold the app's live state. A commit of them breaks the
|
|
592
|
-
running scheduler for every checkout that pulls it.${isArtifactOnly ? FINISH_ARTIFACT_ONLY_COMMIT_LINE : ''}
|
|
598
|
+
running scheduler for every checkout that pulls it.${isArtifactOnly ? FINISH_ARTIFACT_ONLY_COMMIT_LINE : ''}${isPlanReviewer ? FINISH_PLAN_REVIEWER_COMMIT_LINE : ''}
|
|
593
599
|
${verdictStepNum}. VERDICT LINE — end your final report with exactly one of these lines.
|
|
594
600
|
Put nothing after it, except the FOREIGN_WIP_PATHS line described below.
|
|
595
601
|
SCHEDULER_VERDICT: PASS
|
|
@@ -654,6 +660,11 @@ function buildFinishProtocol({ reviewInRun = true, isFixPlan = false, isArtifact
|
|
|
654
660
|
+ buildFinishTail({ verifyStepNum: 2, commitStepNum: 3, verdictStepNum: 4, isFixPlan, isArtifactOnly, isValidator, isPlanReviewer });
|
|
655
661
|
}
|
|
656
662
|
|
|
663
|
+
/** Pure: role flags for buildFinishProtocol. isArtifactOnly comes from the PRD only. */
|
|
664
|
+
function finishProtocolFlagsFor(job, isArtifactOnly) {
|
|
665
|
+
return { isArtifactOnly: !!isArtifactOnly, isValidator: job.agentType === 'validator', isPlanReviewer: job.agentType === 'plan-reviewer' };
|
|
666
|
+
}
|
|
667
|
+
|
|
657
668
|
const FINISH_PROTOCOL = buildFinishProtocol({ reviewInRun: true });
|
|
658
669
|
|
|
659
670
|
// Machine-wide roots resolve lazily via lib/scheduler/schedulerPaths.cjs (SM_SCHEDULER_HOME
|
|
@@ -4819,7 +4830,7 @@ async function notifyOriginatingTab(job, {
|
|
|
4819
4830
|
console.error('[scheduler] notifyOriginatingTab verdicts file write error', job?.slug, e);
|
|
4820
4831
|
}
|
|
4821
4832
|
}
|
|
4822
|
-
if (job.agentType === 'plan-reviewer' && (job.status === 'completed' || job.status === 'failed')) {
|
|
4833
|
+
if (job.agentType === 'plan-reviewer' && (job.status === 'completed' || job.status === 'failed' || job.status === 'needs_review')) {
|
|
4823
4834
|
await harvestPlanReview(job, epicId, logPath, { readStructured: readStructuredFromLog, sendPrompt, rows: planReviewRows, store: planReviewStoreImpl });
|
|
4824
4835
|
}
|
|
4825
4836
|
if (epicId) {
|
|
@@ -4881,7 +4892,22 @@ async function notifyOriginatingTab(job, {
|
|
|
4881
4892
|
|
|
4882
4893
|
/** Digest text for one harvested plan review (pure). */
|
|
4883
4894
|
function buildPlanReviewDigest({ validateSlug, round, outcome, review, error }) {
|
|
4884
|
-
const head = `PLAN REVIEWED: ${validateSlug} (round ${round})`;
|
|
4895
|
+
const head = `PLAN REVIEWED${outcome === 'late' ? ' (late)' : ''}: ${validateSlug} (round ${round})`;
|
|
4896
|
+
if (outcome === 'late') {
|
|
4897
|
+
const lines = [head, 'The reviewer was healed after this round was released as review-failed. The plan stays released; apply what still matters with scheduler_update_prd.'];
|
|
4898
|
+
for (const p of review.prds) {
|
|
4899
|
+
lines.push('', `${p.prd}: ${p.decision}`);
|
|
4900
|
+
for (const f of p.findings) {
|
|
4901
|
+
lines.push(` - [${f.severity}] ${f.check}: ${f.text}`);
|
|
4902
|
+
if (f.suggestedEdit) lines.push(` suggested edit: ${f.suggestedEdit}`);
|
|
4903
|
+
}
|
|
4904
|
+
}
|
|
4905
|
+
if (review.planFindings.length) {
|
|
4906
|
+
lines.push('', 'Plan findings:');
|
|
4907
|
+
for (const f of review.planFindings) lines.push(` - [${f.severity}] ${f.check}: ${f.text}`);
|
|
4908
|
+
}
|
|
4909
|
+
return lines.join('\n');
|
|
4910
|
+
}
|
|
4885
4911
|
if (outcome === 'failed') {
|
|
4886
4912
|
return `${head}\nThe independent review failed (${error || 'no structured output'}) — the plan was released without review (review-failed). Its PRDs are free to dispatch.`;
|
|
4887
4913
|
}
|
|
@@ -4908,7 +4934,10 @@ function buildPlanReviewDigest({ validateSlug, round, outcome, review, error })
|
|
|
4908
4934
|
* harvestPlanReview — a finished plan-reviewer job: parse its structured output,
|
|
4909
4935
|
* save the round, auto-release an all-ok plan (an unusable review releases as
|
|
4910
4936
|
* 'review-failed'), and send the planner's Epic ONE digest per (validateSlug,
|
|
4911
|
-
* round).
|
|
4937
|
+
* round). Late path: a round whose digest was 'review-failed' may later get a
|
|
4938
|
+
* completed run with valid output; that run saves the review and sends ONE
|
|
4939
|
+
* second 'PLAN REVIEWED (late)' digest (no release — the plan already released).
|
|
4940
|
+
* The sent round + kind is persisted in the record (`digestSent`) so a restart
|
|
4912
4941
|
* does not resend. Never throws.
|
|
4913
4942
|
*/
|
|
4914
4943
|
async function harvestPlanReview(job, epicId, logPath, deps = {}) {
|
|
@@ -4927,22 +4956,37 @@ async function harvestPlanReview(job, epicId, logPath, deps = {}) {
|
|
|
4927
4956
|
}
|
|
4928
4957
|
const validateSlug = validator.slug;
|
|
4929
4958
|
const prior = store.readPlanReview(job.cwd, epicId, validateSlug);
|
|
4930
|
-
|
|
4931
|
-
|
|
4959
|
+
// digestSent entries: { round, kind: 'review-failed' | 'reviewed' | 'late' };
|
|
4960
|
+
// a bare number (old shape) reads as kind 'reviewed'.
|
|
4961
|
+
const sentBefore = (prior && Array.isArray(prior.digestSent) ? prior.digestSent : [])
|
|
4962
|
+
.map((e) => (typeof e === 'number' ? { round: e, kind: 'reviewed' } : e))
|
|
4963
|
+
.filter((e) => e && typeof e.round === 'number');
|
|
4964
|
+
const sentEntry = sentBefore.find((e) => e.round === round);
|
|
4965
|
+
if (sentEntry && sentEntry.kind !== 'review-failed') return;
|
|
4966
|
+
const late = !!sentEntry;
|
|
4932
4967
|
|
|
4933
4968
|
const members = planReviewHold.planMembers(validator, rows).map((r) => r.slug);
|
|
4934
4969
|
let structured = null;
|
|
4935
4970
|
try { structured = (deps.readStructured || extractStructuredOutputFromLog)(logPath); } catch { structured = null; }
|
|
4971
|
+
// Only a completed reviewer's output is parsed. A failed or needs_review
|
|
4972
|
+
// reviewer takes the review-failed branch below, which releases the plan
|
|
4973
|
+
// and sends the digest now instead of waiting for the hold timeout.
|
|
4936
4974
|
const checked = job.status === 'completed' && structured
|
|
4937
4975
|
? parsePlanReview(structured, { expected: members })
|
|
4938
4976
|
: { ok: false, error: job.status === 'completed' ? 'no structured output' : `reviewer ${job.status}` };
|
|
4939
4977
|
|
|
4978
|
+
// A review-failed round accepts only a later completed run with valid output.
|
|
4979
|
+
if (late && !checked.ok) return;
|
|
4940
4980
|
let outcome;
|
|
4941
|
-
if (checked.ok) {
|
|
4981
|
+
if (late || checked.ok) {
|
|
4942
4982
|
await store.savePlanReviewResult({
|
|
4943
4983
|
cwd: job.cwd, epicId, validateSlug, round, reviewer: job.slug,
|
|
4944
4984
|
runId: job.runId || null, model: job.model || null, review: checked.value,
|
|
4945
4985
|
});
|
|
4986
|
+
}
|
|
4987
|
+
if (late) {
|
|
4988
|
+
outcome = 'late';
|
|
4989
|
+
} else if (checked.ok) {
|
|
4946
4990
|
if (isAllOkPlanReview(checked.value)) {
|
|
4947
4991
|
outcome = 'ok';
|
|
4948
4992
|
await store.recordPlanRelease({ cwd: job.cwd, epicId, validateSlug, by: 'auto', accepted: 0 });
|
|
@@ -4963,7 +5007,10 @@ async function harvestPlanReview(job, epicId, logPath, deps = {}) {
|
|
|
4963
5007
|
if (rec) {
|
|
4964
5008
|
const file = store.planReviewPath(job.cwd, epicId, validateSlug);
|
|
4965
5009
|
assertOpsWrite(file, 'scheduler');
|
|
4966
|
-
await writeJsonAtomic(file, { ...rec, digestSent: [
|
|
5010
|
+
await writeJsonAtomic(file, { ...rec, digestSent: [
|
|
5011
|
+
...sentBefore.filter((e) => e.round !== round),
|
|
5012
|
+
{ round, kind: late ? 'late' : (checked.ok ? 'reviewed' : 'review-failed') },
|
|
5013
|
+
] });
|
|
4967
5014
|
}
|
|
4968
5015
|
const text = buildPlanReviewDigest({
|
|
4969
5016
|
validateSlug, round, outcome,
|
|
@@ -6539,7 +6586,7 @@ async function executeJob(job, runDir, defaultCwd, onPid, execCwd, resumeTarget
|
|
|
6539
6586
|
job.validatorCriteriaExpected = expected;
|
|
6540
6587
|
if (section) prompt = `${prompt}\n\n${section}`;
|
|
6541
6588
|
}
|
|
6542
|
-
prompt = composeExecutorPrompt({ prdBody: prompt, digestText, finishProtocol: buildFinishProtocol({ reviewInRun, isFixPlan: resolveIsFixPlan(job.slug, job.isFixPlan),
|
|
6589
|
+
prompt = composeExecutorPrompt({ prdBody: prompt, digestText, finishProtocol: buildFinishProtocol({ reviewInRun, isFixPlan: resolveIsFixPlan(job.slug, job.isFixPlan), ...finishProtocolFlagsFor(job, isArtifactOnly) }) });
|
|
6543
6590
|
|
|
6544
6591
|
// Foreign-WIP manifest (starry-night-ships PRD 148 postmortem): the
|
|
6545
6592
|
// scheduler already knows, at spawn time, which dirty paths this job did
|
|
@@ -15718,6 +15765,10 @@ queueOps.bindQueueAccess({
|
|
|
15718
15765
|
});
|
|
15719
15766
|
|
|
15720
15767
|
module.exports = {
|
|
15768
|
+
finishProtocolFlagsFor,
|
|
15769
|
+
FINISH_PLAN_REVIEWER_LINE,
|
|
15770
|
+
FINISH_ARTIFACT_ONLY_VERDICT_LINE,
|
|
15771
|
+
FINISH_PLAN_REVIEWER_COMMIT_LINE,
|
|
15721
15772
|
readQueue,
|
|
15722
15773
|
PARK_ERRORS,
|
|
15723
15774
|
applyPlanReviewHolds,
|