steroids-cli 0.9.30 → 0.9.32
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/commands/loop-phases.d.ts +1 -1
- package/dist/commands/loop-phases.d.ts.map +1 -1
- package/dist/commands/loop-phases.js +404 -67
- package/dist/commands/loop-phases.js.map +1 -1
- package/dist/database/queries.d.ts +20 -0
- package/dist/database/queries.d.ts.map +1 -1
- package/dist/database/queries.js +63 -0
- package/dist/database/queries.js.map +1 -1
- package/dist/git/status.d.ts +10 -0
- package/dist/git/status.d.ts.map +1 -1
- package/dist/git/status.js +66 -0
- package/dist/git/status.js.map +1 -1
- package/dist/git/submission-resolution.d.ts +26 -0
- package/dist/git/submission-resolution.d.ts.map +1 -0
- package/dist/git/submission-resolution.js +213 -0
- package/dist/git/submission-resolution.js.map +1 -0
- package/dist/orchestrator/coordinator.d.ts +2 -0
- package/dist/orchestrator/coordinator.d.ts.map +1 -1
- package/dist/orchestrator/coordinator.js +17 -1
- package/dist/orchestrator/coordinator.js.map +1 -1
- package/dist/orchestrator/post-coder.d.ts.map +1 -1
- package/dist/orchestrator/post-coder.js +82 -5
- package/dist/orchestrator/post-coder.js.map +1 -1
- package/dist/orchestrator/reviewer.d.ts.map +1 -1
- package/dist/orchestrator/reviewer.js +69 -41
- package/dist/orchestrator/reviewer.js.map +1 -1
- package/dist/orchestrator/schemas.d.ts.map +1 -1
- package/dist/orchestrator/schemas.js +12 -0
- package/dist/orchestrator/schemas.js.map +1 -1
- package/dist/orchestrator/types.d.ts +3 -0
- package/dist/orchestrator/types.d.ts.map +1 -1
- package/dist/prompts/coder.d.ts.map +1 -1
- package/dist/prompts/coder.js +65 -2
- package/dist/prompts/coder.js.map +1 -1
- package/dist/prompts/prompt-helpers.d.ts.map +1 -1
- package/dist/prompts/prompt-helpers.js +15 -4
- package/dist/prompts/prompt-helpers.js.map +1 -1
- package/dist/prompts/reviewer.d.ts +4 -3
- package/dist/prompts/reviewer.d.ts.map +1 -1
- package/dist/prompts/reviewer.js +75 -14
- package/dist/prompts/reviewer.js.map +1 -1
- package/dist/runners/global-db.d.ts.map +1 -1
- package/dist/runners/global-db.js +7 -3
- package/dist/runners/global-db.js.map +1 -1
- package/dist/runners/orchestrator-loop.d.ts.map +1 -1
- package/dist/runners/orchestrator-loop.js +2 -2
- package/dist/runners/orchestrator-loop.js.map +1 -1
- package/dist/runners/wakeup.d.ts.map +1 -1
- package/dist/runners/wakeup.js +142 -2
- package/dist/runners/wakeup.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"submission-resolution.d.ts","sourceRoot":"","sources":["../../src/git/submission-resolution.ts"],"names":[],"mappings":"AAaA,KAAK,gBAAgB,GACjB,eAAe,GACf,eAAe,GACf,6BAA6B,CAAC;AAElC,MAAM,MAAM,wBAAwB,GAChC;IACA,MAAM,EAAE,UAAU,CAAC;IACnB,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,iBAAiB,GAAG,kBAAkB,CAAC;IACjD,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB,GACC;IACA,MAAM,EAAE,YAAY,CAAC;IACrB,MAAM,EAAE,gBAAgB,CAAC;IACzB,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB,CAAC;AAEJ,MAAM,WAAW,iCAAiC;IAChD,kBAAkB,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,wBAAwB,EAAE,MAAM,EAAE,CAAC;IACnC,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,MAAM,CAAC,EAAE,gBAAgB,CAAC;CAC3B;AAoHD;;;GAGG;AACH,wBAAgB,mCAAmC,CACjD,WAAW,EAAE,MAAM,EACnB,aAAa,EAAE,MAAM,EAAE,GACtB,wBAAwB,CAgB1B;AAED,wBAAgB,0CAA0C,CACxD,WAAW,EAAE,MAAM,EACnB,aAAa,EAAE,MAAM,EAAE,GACtB,iCAAiC,CA0FnC"}
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.resolveSubmissionCommitWithRecovery = resolveSubmissionCommitWithRecovery;
|
|
4
|
+
exports.resolveSubmissionCommitHistoryWithRecovery = resolveSubmissionCommitHistoryWithRecovery;
|
|
5
|
+
const node_child_process_1 = require("node:child_process");
|
|
6
|
+
const node_crypto_1 = require("node:crypto");
|
|
7
|
+
const node_fs_1 = require("node:fs");
|
|
8
|
+
const node_path_1 = require("node:path");
|
|
9
|
+
const global_db_js_1 = require("../runners/global-db.js");
|
|
10
|
+
const status_js_1 = require("./status.js");
|
|
11
|
+
function getProjectRepoId(projectPath) {
|
|
12
|
+
try {
|
|
13
|
+
return (0, node_fs_1.realpathSync)(projectPath);
|
|
14
|
+
}
|
|
15
|
+
catch {
|
|
16
|
+
return (0, node_path_1.resolve)(projectPath);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
function getParallelWorkstreamSources(projectPath) {
|
|
20
|
+
const normalizedProjectPath = getProjectRepoId(projectPath);
|
|
21
|
+
const projectRepoId = getProjectRepoId(projectPath);
|
|
22
|
+
const { db, close } = (0, global_db_js_1.openGlobalDatabase)();
|
|
23
|
+
try {
|
|
24
|
+
const rows = db
|
|
25
|
+
.prepare(`
|
|
26
|
+
SELECT ws.clone_path, ws.branch_name
|
|
27
|
+
FROM workstreams ws
|
|
28
|
+
JOIN parallel_sessions ps ON ps.id = ws.session_id
|
|
29
|
+
WHERE (ps.project_path = ? OR ps.project_repo_id = ?)
|
|
30
|
+
AND ps.status NOT IN ('failed', 'aborted')
|
|
31
|
+
AND ws.clone_path IS NOT NULL
|
|
32
|
+
`)
|
|
33
|
+
.all(normalizedProjectPath, projectRepoId);
|
|
34
|
+
const seen = new Set();
|
|
35
|
+
const sources = [];
|
|
36
|
+
for (const row of rows) {
|
|
37
|
+
if (!row.clone_path)
|
|
38
|
+
continue;
|
|
39
|
+
const resolvedClonePath = (0, node_path_1.resolve)(row.clone_path);
|
|
40
|
+
if (resolvedClonePath === normalizedProjectPath)
|
|
41
|
+
continue;
|
|
42
|
+
if (!(0, node_fs_1.existsSync)(row.clone_path))
|
|
43
|
+
continue;
|
|
44
|
+
const key = `${row.clone_path}::${row.branch_name}`;
|
|
45
|
+
if (seen.has(key))
|
|
46
|
+
continue;
|
|
47
|
+
seen.add(key);
|
|
48
|
+
sources.push({
|
|
49
|
+
clonePath: row.clone_path,
|
|
50
|
+
branchName: row.branch_name,
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
return sources;
|
|
54
|
+
}
|
|
55
|
+
finally {
|
|
56
|
+
close();
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
function safeRecoveryRef(pathLike) {
|
|
60
|
+
return pathLike.replace(/[^\w.-]/g, '_');
|
|
61
|
+
}
|
|
62
|
+
function isGitRepoPath(pathValue) {
|
|
63
|
+
try {
|
|
64
|
+
(0, node_child_process_1.execSync)('git rev-parse --is-inside-work-tree', {
|
|
65
|
+
cwd: pathValue,
|
|
66
|
+
encoding: 'utf-8',
|
|
67
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
68
|
+
timeout: 5_000,
|
|
69
|
+
});
|
|
70
|
+
return true;
|
|
71
|
+
}
|
|
72
|
+
catch {
|
|
73
|
+
return false;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
function cleanupRecoveryRefs(projectPath, refs) {
|
|
77
|
+
for (const ref of refs) {
|
|
78
|
+
try {
|
|
79
|
+
(0, node_child_process_1.execSync)(`git update-ref -d ${ref}`, {
|
|
80
|
+
cwd: projectPath,
|
|
81
|
+
encoding: 'utf-8',
|
|
82
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
83
|
+
timeout: 5_000,
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
catch {
|
|
87
|
+
// best effort
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
function fetchWorkstreamBranch(projectPath, clonePath, branchName, suffix, attempts) {
|
|
92
|
+
if (!(0, node_fs_1.existsSync)(clonePath) || !isGitRepoPath(clonePath)) {
|
|
93
|
+
attempts.push(`workstream_skip:${clonePath}:invalid_repo`);
|
|
94
|
+
return { success: false };
|
|
95
|
+
}
|
|
96
|
+
const fetchRef = `refs/steroids/recovery/${safeRecoveryRef(branchName)}-${suffix}`;
|
|
97
|
+
attempts.push(`workstream_fetch:${clonePath}:${branchName}`);
|
|
98
|
+
try {
|
|
99
|
+
(0, node_child_process_1.execSync)(`git fetch ${clonePath} +${branchName}:${fetchRef}`, {
|
|
100
|
+
cwd: projectPath,
|
|
101
|
+
encoding: 'utf-8',
|
|
102
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
103
|
+
timeout: 30_000,
|
|
104
|
+
});
|
|
105
|
+
attempts.push(`workstream_fetch_ok:${clonePath}:${branchName}`);
|
|
106
|
+
return { success: true, recoveryRef: fetchRef };
|
|
107
|
+
}
|
|
108
|
+
catch {
|
|
109
|
+
attempts.push(`workstream_fetch_fail:${clonePath}:${branchName}`);
|
|
110
|
+
return { success: false };
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Resolve the latest reachable commit among historical submission candidates.
|
|
115
|
+
* Falls back to parallel workstream clone fetches if the commit is missing locally.
|
|
116
|
+
*/
|
|
117
|
+
function resolveSubmissionCommitWithRecovery(projectPath, candidateShas) {
|
|
118
|
+
const history = resolveSubmissionCommitHistoryWithRecovery(projectPath, candidateShas);
|
|
119
|
+
if (history.latestReachableSha) {
|
|
120
|
+
return {
|
|
121
|
+
status: 'resolved',
|
|
122
|
+
sha: history.latestReachableSha,
|
|
123
|
+
strategy: history.unreachableShas.length > 0 ? 'workstream_fetch' : 'local_or_remote',
|
|
124
|
+
attempts: history.attempts,
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
return {
|
|
128
|
+
status: 'unresolved',
|
|
129
|
+
reason: history.reason ?? 'not_reachable',
|
|
130
|
+
attempts: history.attempts,
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
function resolveSubmissionCommitHistoryWithRecovery(projectPath, candidateShas) {
|
|
134
|
+
const normalizedShas = Array.from(new Set(candidateShas
|
|
135
|
+
.map(sha => sha.trim())
|
|
136
|
+
.filter(sha => sha.length > 0)));
|
|
137
|
+
const attempts = [];
|
|
138
|
+
if (normalizedShas.length === 0) {
|
|
139
|
+
return {
|
|
140
|
+
latestReachableSha: null,
|
|
141
|
+
reachableShasOldestFirst: [],
|
|
142
|
+
unreachableShas: [],
|
|
143
|
+
attempts,
|
|
144
|
+
reason: 'no_candidates',
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
const reachableSet = new Set();
|
|
148
|
+
let unreachableShas = [...normalizedShas];
|
|
149
|
+
for (const sha of normalizedShas) {
|
|
150
|
+
attempts.push(`local_or_remote_check:${sha}`);
|
|
151
|
+
if ((0, status_js_1.isCommitReachableWithFetch)(projectPath, sha, { forceFetch: true })) {
|
|
152
|
+
reachableSet.add(sha);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
unreachableShas = normalizedShas.filter(sha => !reachableSet.has(sha));
|
|
156
|
+
if (unreachableShas.length === 0) {
|
|
157
|
+
const reachableShasOldestFirst = [...normalizedShas].reverse();
|
|
158
|
+
return {
|
|
159
|
+
latestReachableSha: normalizedShas[0],
|
|
160
|
+
reachableShasOldestFirst,
|
|
161
|
+
unreachableShas: [],
|
|
162
|
+
attempts,
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
let sources = [];
|
|
166
|
+
try {
|
|
167
|
+
sources = getParallelWorkstreamSources(projectPath);
|
|
168
|
+
}
|
|
169
|
+
catch {
|
|
170
|
+
return {
|
|
171
|
+
latestReachableSha: normalizedShas.find(sha => reachableSet.has(sha)) ?? null,
|
|
172
|
+
reachableShasOldestFirst: [...normalizedShas].reverse().filter(sha => reachableSet.has(sha)),
|
|
173
|
+
unreachableShas,
|
|
174
|
+
attempts,
|
|
175
|
+
reason: reachableSet.size > 0 ? undefined : 'workstream_discovery_failed',
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
if (sources.length === 0) {
|
|
179
|
+
return {
|
|
180
|
+
latestReachableSha: normalizedShas.find(sha => reachableSet.has(sha)) ?? null,
|
|
181
|
+
reachableShasOldestFirst: [...normalizedShas].reverse().filter(sha => reachableSet.has(sha)),
|
|
182
|
+
unreachableShas,
|
|
183
|
+
attempts,
|
|
184
|
+
reason: reachableSet.size > 0 ? undefined : 'not_reachable',
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
const nonce = (0, node_crypto_1.randomUUID)();
|
|
188
|
+
const createdRecoveryRefs = [];
|
|
189
|
+
for (const source of sources) {
|
|
190
|
+
const fetched = fetchWorkstreamBranch(projectPath, source.clonePath, source.branchName, nonce, attempts);
|
|
191
|
+
if (fetched.recoveryRef) {
|
|
192
|
+
createdRecoveryRefs.push(fetched.recoveryRef);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
for (const sha of unreachableShas) {
|
|
196
|
+
attempts.push(`post_workstream_check:${sha}`);
|
|
197
|
+
if ((0, status_js_1.isCommitReachable)(projectPath, sha)) {
|
|
198
|
+
reachableSet.add(sha);
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
cleanupRecoveryRefs(projectPath, createdRecoveryRefs);
|
|
202
|
+
unreachableShas = normalizedShas.filter(sha => !reachableSet.has(sha));
|
|
203
|
+
const reachableShasOldestFirst = [...normalizedShas].reverse().filter(sha => reachableSet.has(sha));
|
|
204
|
+
const latestReachableSha = normalizedShas.find(sha => reachableSet.has(sha)) ?? null;
|
|
205
|
+
return {
|
|
206
|
+
latestReachableSha,
|
|
207
|
+
reachableShasOldestFirst,
|
|
208
|
+
unreachableShas,
|
|
209
|
+
attempts,
|
|
210
|
+
reason: latestReachableSha ? undefined : 'not_reachable',
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
//# sourceMappingURL=submission-resolution.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"submission-resolution.js","sourceRoot":"","sources":["../../src/git/submission-resolution.ts"],"names":[],"mappings":";;AA6JA,kFAmBC;AAED,gGA6FC;AA/QD,2DAA8C;AAC9C,6CAAyC;AACzC,qCAAmD;AACnD,yCAAoC;AAEpC,0DAA6D;AAC7D,2CAA4E;AAiC5E,SAAS,gBAAgB,CAAC,WAAmB;IAC3C,IAAI,CAAC;QACH,OAAO,IAAA,sBAAY,EAAC,WAAW,CAAC,CAAC;IACnC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAA,mBAAO,EAAC,WAAW,CAAC,CAAC;IAC9B,CAAC;AACH,CAAC;AAED,SAAS,4BAA4B,CAAC,WAAmB;IACvD,MAAM,qBAAqB,GAAG,gBAAgB,CAAC,WAAW,CAAC,CAAC;IAC5D,MAAM,aAAa,GAAG,gBAAgB,CAAC,WAAW,CAAC,CAAC;IACpD,MAAM,EAAE,EAAE,EAAE,KAAK,EAAE,GAAG,IAAA,iCAAkB,GAAE,CAAC;IAC3C,IAAI,CAAC;QACH,MAAM,IAAI,GAAG,EAAE;aACZ,OAAO,CACN;;;;;;;SAOC,CACF;aACA,GAAG,CAAC,qBAAqB,EAAE,aAAa,CAGzC,CAAC;QAEH,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAC;QAC/B,MAAM,OAAO,GAAuB,EAAE,CAAC;QACvC,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;YACvB,IAAI,CAAC,GAAG,CAAC,UAAU;gBAAE,SAAS;YAC9B,MAAM,iBAAiB,GAAG,IAAA,mBAAO,EAAC,GAAG,CAAC,UAAU,CAAC,CAAC;YAClD,IAAI,iBAAiB,KAAK,qBAAqB;gBAAE,SAAS;YAC1D,IAAI,CAAC,IAAA,oBAAU,EAAC,GAAG,CAAC,UAAU,CAA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,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;IACpG,MAAM,kBAAkB,GAAG,cAAc,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,YAAY,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,IAAI,IAAI,CAAC;IAErF,OAAO;QACL,kBAAkB;QAClB,wBAAwB;QACxB,eAAe;QACf,QAAQ;QACR,MAAM,EAAE,kBAAkB,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,eAAe;KACzD,CAAC;AACJ,CAAC"}
|
|
@@ -14,6 +14,8 @@ export interface CoordinatorContext {
|
|
|
14
14
|
submissionNotes?: string | null;
|
|
15
15
|
gitDiffSummary?: string;
|
|
16
16
|
previousGuidance?: string;
|
|
17
|
+
lockedMustImplementGuidance?: string;
|
|
18
|
+
lockedMustImplementWatermark?: number;
|
|
17
19
|
}
|
|
18
20
|
export interface CoordinatorResult {
|
|
19
21
|
success: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coordinator.d.ts","sourceRoot":"","sources":["../../src/orchestrator/coordinator.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,OAAO,KAAK,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAMnE,MAAM,WAAW,kBAAkB;IACjC,YAAY,CAAC,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAC/D,eAAe,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,gBAAgB,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"coordinator.d.ts","sourceRoot":"","sources":["../../src/orchestrator/coordinator.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,OAAO,KAAK,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAMnE,MAAM,WAAW,kBAAkB;IACjC,YAAY,CAAC,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAC/D,eAAe,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,2BAA2B,CAAC,EAAE,MAAM,CAAC;IACrC,4BAA4B,CAAC,EAAE,MAAM,CAAC;CACvC;AAED,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,aAAa,GAAG,mBAAmB,GAAG,cAAc,CAAC;CAChE;AAqND;;;GAGG;AACH,wBAAsB,iBAAiB,CACrC,IAAI,EAAE,IAAI,EACV,gBAAgB,EAAE,cAAc,EAAE,EAClC,WAAW,EAAE,MAAM,EACnB,KAAK,CAAC,EAAE,kBAAkB,GACzB,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAAC,CA0EnC"}
|
|
@@ -69,6 +69,21 @@ You previously provided this guidance for this task:
|
|
|
69
69
|
> ${extra.previousGuidance.substring(0, 500)}${extra.previousGuidance.length > 500 ? '...' : ''}
|
|
70
70
|
|
|
71
71
|
**Do NOT repeat the same guidance.** If the previous guidance didn't work, provide a DIFFERENT approach.
|
|
72
|
+
`
|
|
73
|
+
: '';
|
|
74
|
+
const lockedMustImplementSection = extra?.lockedMustImplementGuidance
|
|
75
|
+
? `
|
|
76
|
+
---
|
|
77
|
+
|
|
78
|
+
## NON-NEGOTIABLE MUST_IMPLEMENT OVERRIDE
|
|
79
|
+
|
|
80
|
+
This guidance was set by the orchestrator after rejecting a weak WONT_FIX claim.
|
|
81
|
+
You MUST preserve these mandatory items in your guidance and you MAY add clarifications,
|
|
82
|
+
but you must NOT weaken, contradict, or remove them.
|
|
83
|
+
|
|
84
|
+
**Override watermark (rejection count):** ${extra.lockedMustImplementWatermark ?? 'unknown'}
|
|
85
|
+
|
|
86
|
+
${extra.lockedMustImplementGuidance}
|
|
72
87
|
`
|
|
73
88
|
: '';
|
|
74
89
|
return `# COORDINATOR INTERVENTION
|
|
@@ -108,7 +123,7 @@ ${agentsMd}
|
|
|
108
123
|
## Full Rejection History
|
|
109
124
|
|
|
110
125
|
${rejectionSummary}
|
|
111
|
-
${sectionTasksSection}${submissionNotesSection}${diffSection}${previousGuidanceSection}
|
|
126
|
+
${sectionTasksSection}${submissionNotesSection}${diffSection}${previousGuidanceSection}${lockedMustImplementSection}
|
|
112
127
|
---
|
|
113
128
|
|
|
114
129
|
## Your Decision Framework
|
|
@@ -158,6 +173,7 @@ GUIDANCE:
|
|
|
158
173
|
- If there's a design disagreement, PICK the approach that matches the project's architecture and tell the coder to follow it
|
|
159
174
|
- If the same feedback appeared 3+ times unchanged, the coder needs a fundamentally different approach - describe it
|
|
160
175
|
- Always ask: "Will this be usable for the end user?" - if the current approach works for users, don't block on technicalities
|
|
176
|
+
- If NON-NEGOTIABLE MUST_IMPLEMENT override is present, you must keep those items mandatory
|
|
161
177
|
- Never tell the reviewer to auto-approve based on a fixed checklist (e.g., "these are the only items required for approval")
|
|
162
178
|
- Never claim reviewer guidance is binding over security, correctness, or specification requirements
|
|
163
179
|
- Keep guidance under 500 words
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coordinator.js","sourceRoot":"","sources":["../../src/orchestrator/coordinator.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;
|
|
1
|
+
{"version":3,"file":"coordinator.js","sourceRoot":"","sources":["../../src/orchestrator/coordinator.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;AAiPH,8CA+EC;AA9TD,qCAAgE;AAChE,qCAAiC;AACjC,yCAAiC;AAEjC,mDAAiD;AACjD,0DAA+D;AAC/D,4EAAkE;AAClE,oEAAmF;AAiB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CAAC,6DAA6D,CAAC,CAAC;YAC5E,OAAO,IAAI,CAAC;QACd,CAAC;QAED,MAAM,MAAM,GAAG,wBAAwB,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QAEvD,OAAO,CAAC,GAAG,CAAC,KAAK,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;QACnC,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC;QAClC,OAAO,CAAC,GAAG,CAAC,aAAa,MAAM,CAAC,QAAQ,EAAE,CAAC,CAAC;QAC5C,OAAO,CAAC,GAAG,CAAC,oBAAoB,MAAM,CAAC,QAAQ,CAAC,MAAM,QAAQ,CAAC,CAAC;QAChE,OAAO,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC;QAEnC,OAAO,MAAM,CAAC;IAChB,CAAC;YAAS,CAAC;QACT,IAAI,IAAA,oBAAU,EAAC,QAAQ,CAAC,EAAE,CAAC;YACzB,IAAA,oBAAU,EAAC,QAAQ,CAAC,CAAC;QACvB,CAAC;IACH,CAAC;AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"post-coder.d.ts","sourceRoot":"","sources":["../../src/orchestrator/post-coder.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"post-coder.d.ts","sourceRoot":"","sources":["../../src/orchestrator/post-coder.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAkB1C;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,YAAY,GAAG,MAAM,CA2QlE"}
|
|
@@ -5,19 +5,33 @@
|
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
exports.buildPostCoderPrompt = buildPostCoderPrompt;
|
|
8
|
+
const CONTEXT_TAIL_CHARS = 6000;
|
|
9
|
+
function escapeRegExp(value) {
|
|
10
|
+
return value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
11
|
+
}
|
|
12
|
+
function extractMarkdownSection(output, heading) {
|
|
13
|
+
const pattern = new RegExp(`(^|\\n)##\\s*${escapeRegExp(heading)}\\s*[\\r\\n]+([\\s\\S]*?)(?=\\n##\\s|$)`, 'i');
|
|
14
|
+
const match = output.match(pattern);
|
|
15
|
+
if (!match)
|
|
16
|
+
return null;
|
|
17
|
+
return `## ${heading}\n${match[2].trim()}`.trim();
|
|
18
|
+
}
|
|
8
19
|
/**
|
|
9
20
|
* Generate post-coder orchestrator prompt
|
|
10
21
|
*/
|
|
11
22
|
function buildPostCoderPrompt(context) {
|
|
12
23
|
const { task, coder_output: { stdout, stderr, exit_code, timed_out, duration_ms }, git_state: { commits, files_changed, has_uncommitted_changes } } = context;
|
|
13
24
|
const duration_seconds = (duration_ms / 1000).toFixed(1);
|
|
14
|
-
const stdout_tail = stdout.slice(-
|
|
15
|
-
const stderr_tail = stderr.slice(-
|
|
25
|
+
const stdout_tail = stdout.length > CONTEXT_TAIL_CHARS ? stdout.slice(-CONTEXT_TAIL_CHARS) : stdout;
|
|
26
|
+
const stderr_tail = stderr.length > CONTEXT_TAIL_CHARS ? stderr.slice(-CONTEXT_TAIL_CHARS) : stderr;
|
|
27
|
+
const selfReviewChecklist = extractMarkdownSection(stdout, 'SELF_REVIEW_CHECKLIST');
|
|
28
|
+
const rejectionResponse = extractMarkdownSection(stdout, 'REJECTION_RESPONSE');
|
|
16
29
|
let rejectionSection = '';
|
|
17
30
|
if (task.rejection_notes) {
|
|
18
31
|
rejectionSection = `
|
|
19
32
|
**Previous Rejection:** ${task.rejection_notes}
|
|
20
33
|
**Rejection Count:** ${task.rejection_count || 0}
|
|
34
|
+
**Open Rejection Items (latest):** ${task.rejection_item_count ?? 0}
|
|
21
35
|
`;
|
|
22
36
|
}
|
|
23
37
|
let commitsSection = '';
|
|
@@ -31,12 +45,28 @@ function buildPostCoderPrompt(context) {
|
|
|
31
45
|
let stderrSection = '';
|
|
32
46
|
if (stderr) {
|
|
33
47
|
stderrSection = `
|
|
34
|
-
**Errors:**
|
|
48
|
+
**Errors (tail ${CONTEXT_TAIL_CHARS} chars):**
|
|
35
49
|
\`\`\`
|
|
36
50
|
${stderr_tail}
|
|
37
51
|
\`\`\`
|
|
38
52
|
`;
|
|
39
53
|
}
|
|
54
|
+
const extractedBlocks = [];
|
|
55
|
+
if (selfReviewChecklist) {
|
|
56
|
+
extractedBlocks.push(`### Extracted SELF_REVIEW_CHECKLIST\n\`\`\`\n${selfReviewChecklist}\n\`\`\``);
|
|
57
|
+
}
|
|
58
|
+
if (rejectionResponse) {
|
|
59
|
+
extractedBlocks.push(`### Extracted REJECTION_RESPONSE\n\`\`\`\n${rejectionResponse}\n\`\`\``);
|
|
60
|
+
}
|
|
61
|
+
const extractedBlocksSection = extractedBlocks.length > 0
|
|
62
|
+
? `
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
## Extracted Required Blocks (from full output)
|
|
66
|
+
|
|
67
|
+
${extractedBlocks.join('\n\n')}
|
|
68
|
+
`
|
|
69
|
+
: '';
|
|
40
70
|
return `# POST-CODER ORCHESTRATOR
|
|
41
71
|
|
|
42
72
|
You are a state machine that analyzes coder output and determines the next action.
|
|
@@ -59,11 +89,12 @@ ${rejectionSection}
|
|
|
59
89
|
**Timed Out:** ${timed_out}
|
|
60
90
|
**Duration:** ${duration_seconds}s
|
|
61
91
|
|
|
62
|
-
**Output (
|
|
92
|
+
**Output (tail ${CONTEXT_TAIL_CHARS} chars):**
|
|
63
93
|
\`\`\`
|
|
64
94
|
${stdout_tail}
|
|
65
95
|
\`\`\`
|
|
66
96
|
${stderrSection}
|
|
97
|
+
${extractedBlocksSection}
|
|
67
98
|
---
|
|
68
99
|
|
|
69
100
|
## Git State
|
|
@@ -98,7 +129,42 @@ ${filesSection}
|
|
|
98
129
|
- Exit 0 + commits exist → \`submit\`
|
|
99
130
|
- Most common happy path
|
|
100
131
|
|
|
101
|
-
### 5.
|
|
132
|
+
### 5. First-Submission Self-Checklist
|
|
133
|
+
- If \`Rejection Count\` is 0, require a \`SELF_REVIEW_CHECKLIST\` block in coder output
|
|
134
|
+
- Checklist must include a final self-review confirmation item
|
|
135
|
+
- If missing, return:
|
|
136
|
+
- \`action: "retry"\`
|
|
137
|
+
- \`next_status: "in_progress"\`
|
|
138
|
+
- \`reasoning\` starting with \`CHECKLIST_REQUIRED:\` (short)
|
|
139
|
+
- \`contract_violation: "checklist_required"\`
|
|
140
|
+
|
|
141
|
+
### 6. Rejection Response Contract (Required on Resubmissions)
|
|
142
|
+
- If \`Rejection Count\` is > 0, require a \`REJECTION_RESPONSE\` block
|
|
143
|
+
- The block must contain one line per rejection item using:
|
|
144
|
+
- \`ITEM-<n> | IMPLEMENTED | ...\`
|
|
145
|
+
- or \`ITEM-<n> | WONT_FIX | ...\`
|
|
146
|
+
- If missing or clearly incomplete, return:
|
|
147
|
+
- \`action: "retry"\`
|
|
148
|
+
- \`next_status: "in_progress"\`
|
|
149
|
+
- \`reasoning\` starting with \`REJECTION_RESPONSE_REQUIRED:\` (short)
|
|
150
|
+
- \`contract_violation: "rejection_response_required"\`
|
|
151
|
+
- \`REJECTION_RESPONSE\` completeness check must use \`Open Rejection Items (latest)\` from task context
|
|
152
|
+
- Require sequential responses: \`ITEM-1\` through \`ITEM-N\`
|
|
153
|
+
|
|
154
|
+
### 7. WONT_FIX Claims (High Priority on Rejected Tasks)
|
|
155
|
+
- If task has prior rejections and coder output includes \`WONT_FIX\`, apply strict scrutiny
|
|
156
|
+
- A \`WONT_FIX\` is acceptable ONLY when all are present:
|
|
157
|
+
- Clear technical reason (impossible/unsafe/out-of-scope conflict)
|
|
158
|
+
- Concrete evidence the task still works without that item
|
|
159
|
+
- No conflict with any mandatory override guidance
|
|
160
|
+
- If any of the above is missing, return:
|
|
161
|
+
- \`action: "retry"\`
|
|
162
|
+
- \`next_status: "in_progress"\`
|
|
163
|
+
- \`reasoning\` that starts with \`WONT_FIX_OVERRIDE:\` (short)
|
|
164
|
+
- \`wont_fix_override_items\` containing specific mandatory fixes
|
|
165
|
+
- If evidence is strong and functionality is complete, \`submit\` is allowed
|
|
166
|
+
|
|
167
|
+
### 8. Uncertainty Default
|
|
102
168
|
- When signals conflict → \`retry\` (safer than error)
|
|
103
169
|
|
|
104
170
|
---
|
|
@@ -111,6 +177,8 @@ ${filesSection}
|
|
|
111
177
|
"reasoning": "One sentence why (max 100 chars)",
|
|
112
178
|
"commits": ["sha1", "sha2"],
|
|
113
179
|
"commit_message": "Only if stage_commit_submit",
|
|
180
|
+
"contract_violation": "checklist_required" | "rejection_response_required" | null,
|
|
181
|
+
"wont_fix_override_items": ["specific required fix", "another required fix"],
|
|
114
182
|
"next_status": "review" | "in_progress" | "failed",
|
|
115
183
|
"metadata": {
|
|
116
184
|
"files_changed": 0,
|
|
@@ -129,6 +197,15 @@ ${filesSection}
|
|
|
129
197
|
- \`stage_commit_submit\` → Work complete but not committed
|
|
130
198
|
- \`error\` → Fatal issue, needs human intervention
|
|
131
199
|
|
|
200
|
+
**contract_violation:**
|
|
201
|
+
- \`checklist_required\` when first submission missing required self-checklist
|
|
202
|
+
- \`rejection_response_required\` when resubmission misses required ITEM responses
|
|
203
|
+
- \`null\` when no contract violation
|
|
204
|
+
|
|
205
|
+
**wont_fix_override_items:**
|
|
206
|
+
- Optional list of mandatory fixes when WONT_FIX is rejected by orchestrator
|
|
207
|
+
- Use this field for detailed override items (do NOT put long detail in reasoning)
|
|
208
|
+
|
|
132
209
|
**next_status:**
|
|
133
210
|
- \`review\` for submit and stage_commit_submit
|
|
134
211
|
- \`in_progress\` for retry
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"post-coder.js","sourceRoot":"","sources":["../../src/orchestrator/post-coder.ts"],"names":[],"mappings":";AAAA;;;GAGG;;
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B,eAAe,CAAC,IAAI,CAAC,6CAA6C,iBAAiB,UAAU,CAAC,CAAC;IACjG,CAAC;IAED,MAAM,sBAAsB,GAAG,eAAe,CAAC,MAAM,GAAG,CAAC;QACvD,CAAC,CAAC;;;;;EAKJ,eAAe,CAAC,IAAI,CAAC,MAAM,CAAC;CAC7B;QACG,CAAC,CAAC,EAAE,CAAC;IAEP,OAAO;;;;;;;;;;eAUM,IAAI,CAAC,EAAE;kBACJ,IAAI,CAAC,KAAK;;EAE1B,gBAAgB;;;;;iBAKD,SAAS;iBACT,SAAS;gBACV,gBAAgB;;iBAEf,kBAAkB;;EAEjC,WAAW;;EAEX,aAAa;EACb,sBAAsB;;;;;oBAKJ,OAAO,CAAC,MAAM;EAChC,cAAc;;qBAEK,aAAa,CAAC,MAAM;EACvC,YAAY;;2BAEa,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iDAwKD,CAAC;AAClD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reviewer.d.ts","sourceRoot":"","sources":["../../src/orchestrator/reviewer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"reviewer.d.ts","sourceRoot":"","sources":["../../src/orchestrator/reviewer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAkBnD,OAAO,EAAc,KAAK,cAAc,EAAE,KAAK,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAK3F,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,OAAO,CAAC;IACjB,Q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C,IAAI,EAAE,IAAI,EACV,WAAW,EAAE,MAAM,EACnB,mBAAmB,CAAC,EAAE,MAAM,EAC5B,mBAAmB,CAAC,EAAE,MAAM,EAC5B,cAAc,CAAC,EAAE,cAAc,GAC9B,OAAO,CAAC,cAAc,CAAC,CAkKzB;AAED;;;;;;GAMG;AACH,wBAAsB,mBAAmB,CACvC,KAAK,EAAE,IAAI,EAAE,EACb,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,MAAM,EACnB,cAAc,CAAC,EAAE,cAAc,GAC9B,OAAO,CAAC,mBAAmB,CAAC,CAgE9B"}
|
|
@@ -16,10 +16,10 @@ const node_path_1 = require("node:path");
|
|
|
16
16
|
const queries_js_1 = require("../database/queries.js");
|
|
17
17
|
const connection_js_1 = require("../database/connection.js");
|
|
18
18
|
const reviewer_js_1 = require("../prompts/reviewer.js");
|
|
19
|
-
const status_js_1 = require("../git/status.js");
|
|
20
19
|
const loader_js_1 = require("../config/loader.js");
|
|
21
20
|
const registry_js_1 = require("../providers/registry.js");
|
|
22
21
|
const invocation_logger_js_1 = require("../providers/invocation-logger.js");
|
|
22
|
+
const submission_resolution_js_1 = require("../git/submission-resolution.js");
|
|
23
23
|
/**
|
|
24
24
|
* Deterministic policy engine for multi-reviewer decisions
|
|
25
25
|
*/
|
|
@@ -204,51 +204,63 @@ async function invokeReviewer(task, projectPath, coordinatorGuidance, coordinato
|
|
|
204
204
|
console.log(`Provider: ${effectiveReviewerConfig?.provider ?? 'not configured'}`);
|
|
205
205
|
console.log(`Model: ${effectiveReviewerConfig?.model ?? 'not configured'}`);
|
|
206
206
|
console.log(`${'='.repeat(60)}\n`);
|
|
207
|
-
const submissionCommitHash = (0, status_js_1.findTaskCommit)(projectPath, task.title);
|
|
208
|
-
const fallbackCommitHash = 'HEAD~1';
|
|
209
|
-
if (submissionCommitHash) {
|
|
210
|
-
console.log(`Found task commit: ${submissionCommitHash}`);
|
|
211
|
-
}
|
|
212
|
-
else {
|
|
213
|
-
console.log(`No matching commit found for task title. Reviewer will use fallback commit: ${fallbackCommitHash}`);
|
|
214
|
-
}
|
|
215
207
|
// Fetch other tasks in the same section for context
|
|
216
208
|
let sectionTasks = [];
|
|
217
209
|
let rejectionHistory = [];
|
|
218
210
|
let submissionNotes = null;
|
|
219
211
|
let resumeSessionId = null;
|
|
212
|
+
let submissionCommitHash = null;
|
|
213
|
+
let submissionCommitHashes = [];
|
|
214
|
+
let unresolvedSubmissionCommits = [];
|
|
220
215
|
try {
|
|
221
216
|
const { db, close } = (0, connection_js_1.openDatabase)(projectPath);
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
217
|
+
try {
|
|
218
|
+
// Get section tasks
|
|
219
|
+
if (task.section_id) {
|
|
220
|
+
const allSectionTasks = (0, queries_js_1.listTasks)(db, { sectionId: task.section_id });
|
|
221
|
+
sectionTasks = allSectionTasks.map(t => ({
|
|
222
|
+
id: t.id,
|
|
223
|
+
title: t.title,
|
|
224
|
+
status: t.status,
|
|
225
|
+
}));
|
|
226
|
+
}
|
|
227
|
+
// Get rejection history - ALWAYS fetch this so reviewer can see past attempts
|
|
228
|
+
rejectionHistory = (0, queries_js_1.getTaskRejections)(db, task.id);
|
|
229
|
+
if (rejectionHistory.length > 0) {
|
|
230
|
+
console.log(`Found ${rejectionHistory.length} previous rejection(s) for this task`);
|
|
231
|
+
}
|
|
232
|
+
// Get coder's submission notes (if any)
|
|
233
|
+
submissionNotes = (0, queries_js_1.getLatestSubmissionNotes)(db, task.id);
|
|
234
|
+
if (submissionNotes) {
|
|
235
|
+
console.log(`Coder included notes with submission`);
|
|
236
|
+
}
|
|
237
|
+
const submissionHistory = (0, submission_resolution_js_1.resolveSubmissionCommitHistoryWithRecovery)(projectPath, (0, queries_js_1.getSubmissionCommitShas)(db, task.id));
|
|
238
|
+
if (!submissionHistory.latestReachableSha) {
|
|
239
|
+
const attemptsText = submissionHistory.attempts.join(' | ') || 'none';
|
|
240
|
+
throw new Error(`No reachable submission commit hash found for task ${task.id} (${submissionHistory.reason ?? 'not_reachable'}; attempts: ${attemptsText})`);
|
|
241
|
+
}
|
|
242
|
+
submissionCommitHash = submissionHistory.latestReachableSha;
|
|
243
|
+
submissionCommitHashes = submissionHistory.reachableShasOldestFirst;
|
|
244
|
+
unresolvedSubmissionCommits = submissionHistory.unreachableShas;
|
|
245
|
+
console.log(`Using submission commit chain (${submissionCommitHashes.length} reachable), latest: ${submissionCommitHash}`);
|
|
246
|
+
if (unresolvedSubmissionCommits.length > 0) {
|
|
247
|
+
console.log(`Warning: ${unresolvedSubmissionCommits.length} historical submission commit(s) unresolved`);
|
|
248
|
+
}
|
|
249
|
+
// Check for resumable session (same provider/model/role)
|
|
250
|
+
if (effectiveReviewerConfig?.provider && effectiveReviewerConfig?.model) {
|
|
251
|
+
resumeSessionId = (0, queries_js_1.findResumableSession)(db, task.id, 'reviewer', effectiveReviewerConfig.provider, effectiveReviewerConfig.model);
|
|
252
|
+
if (resumeSessionId) {
|
|
253
|
+
console.log(`Found resumable session: ${resumeSessionId.substring(0, 8)}... (resuming with delta prompt)`);
|
|
254
|
+
}
|
|
246
255
|
}
|
|
247
256
|
}
|
|
248
|
-
|
|
257
|
+
finally {
|
|
258
|
+
close();
|
|
259
|
+
}
|
|
249
260
|
}
|
|
250
261
|
catch (error) {
|
|
251
|
-
|
|
262
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
263
|
+
throw new Error(`Could not fetch reviewer context: ${message}`);
|
|
252
264
|
}
|
|
253
265
|
// Reuse config loaded earlier, get reviewer model
|
|
254
266
|
const reviewerModel = effectiveReviewerConfig?.model || 'unknown';
|
|
@@ -256,8 +268,9 @@ async function invokeReviewer(task, projectPath, coordinatorGuidance, coordinato
|
|
|
256
268
|
task,
|
|
257
269
|
projectPath,
|
|
258
270
|
reviewerModel,
|
|
259
|
-
submissionCommitHash,
|
|
260
|
-
|
|
271
|
+
submissionCommitHash: submissionCommitHash,
|
|
272
|
+
submissionCommitHashes,
|
|
273
|
+
unresolvedSubmissionCommits,
|
|
261
274
|
sectionTasks,
|
|
262
275
|
rejectionHistory,
|
|
263
276
|
submissionNotes,
|
|
@@ -328,10 +341,25 @@ async function invokeReviewerBatch(tasks, sectionName, projectPath, reviewerConf
|
|
|
328
341
|
console.log(`Provider: ${effectiveReviewerConfig?.provider ?? 'not configured'}`);
|
|
329
342
|
console.log(`Model: ${effectiveReviewerConfig?.model ?? 'not configured'}`);
|
|
330
343
|
console.log(`${'='.repeat(60)}\n`);
|
|
331
|
-
const
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
344
|
+
const { db, close } = (0, connection_js_1.openDatabase)(projectPath);
|
|
345
|
+
let taskCommits = [];
|
|
346
|
+
try {
|
|
347
|
+
const unresolved = [];
|
|
348
|
+
taskCommits = tasks.map(task => {
|
|
349
|
+
const submissionResolution = (0, submission_resolution_js_1.resolveSubmissionCommitWithRecovery)(projectPath, (0, queries_js_1.getSubmissionCommitShas)(db, task.id));
|
|
350
|
+
if (submissionResolution.status !== 'resolved') {
|
|
351
|
+
const attemptsText = submissionResolution.attempts.join(' | ') || 'none';
|
|
352
|
+
unresolved.push(`${task.id} (${submissionResolution.reason}; attempts: ${attemptsText})`);
|
|
353
|
+
}
|
|
354
|
+
return { taskId: task.id, commitHash: submissionResolution.status === 'resolved' ? submissionResolution.sha : '' };
|
|
355
|
+
});
|
|
356
|
+
if (unresolved.length > 0) {
|
|
357
|
+
throw new Error(`Missing reachable submission commit hash for batch review tasks: ${unresolved.join(', ')}`);
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
finally {
|
|
361
|
+
close();
|
|
362
|
+
}
|
|
335
363
|
const context = {
|
|
336
364
|
tasks,
|
|
337
365
|
projectPath,
|