@yemi33/minions 0.1.4 → 0.1.6
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/CHANGELOG.md +10 -0
- package/engine.js +32 -6
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/engine.js
CHANGED
|
@@ -1075,7 +1075,17 @@ function completeDispatch(id, result = 'success', reason = '', resultSummary = '
|
|
|
1075
1075
|
if (result === 'error' && item.meta?.dispatchKey && retryableFailure) setCooldownFailure(item.meta.dispatchKey);
|
|
1076
1076
|
|
|
1077
1077
|
if (processWorkItemFailure && result === 'error' && item.meta?.item?.id) {
|
|
1078
|
-
|
|
1078
|
+
let retries = (item.meta.item._retryCount || 0);
|
|
1079
|
+
try {
|
|
1080
|
+
const wiPath = item.meta.source === 'central-work-item' || item.meta.source === 'central-work-item-fanout'
|
|
1081
|
+
? path.join(MINIONS_DIR, 'work-items.json')
|
|
1082
|
+
: item.meta.project?.name ? projectWorkItemsPath({ name: item.meta.project.name, localPath: item.meta.project.localPath }) : null;
|
|
1083
|
+
if (wiPath) {
|
|
1084
|
+
const items = safeJson(wiPath) || [];
|
|
1085
|
+
const wi = items.find(i => i.id === item.meta.item.id);
|
|
1086
|
+
if (wi) retries = wi._retryCount || 0;
|
|
1087
|
+
}
|
|
1088
|
+
} catch {}
|
|
1079
1089
|
if (retryableFailure && retries < 3) {
|
|
1080
1090
|
log('info', `Dispatch error for ${item.meta.item.id} — auto-retry ${retries + 1}/3`);
|
|
1081
1091
|
updateWorkItemStatus(item.meta, 'pending', '');
|
|
@@ -1083,9 +1093,8 @@ function completeDispatch(id, result = 'success', reason = '', resultSummary = '
|
|
|
1083
1093
|
if (item.meta?.dispatchKey) {
|
|
1084
1094
|
try {
|
|
1085
1095
|
mutateDispatch((dp) => {
|
|
1086
|
-
const before = Array.isArray(dp.completed) ? dp.completed.length : 0;
|
|
1087
1096
|
dp.completed = Array.isArray(dp.completed) ? dp.completed.filter(d => d.meta?.dispatchKey !== item.meta.dispatchKey) : [];
|
|
1088
|
-
return dp
|
|
1097
|
+
return dp;
|
|
1089
1098
|
});
|
|
1090
1099
|
} catch {}
|
|
1091
1100
|
}
|
|
@@ -1176,7 +1185,7 @@ function areDependenciesMet(item, config) {
|
|
|
1176
1185
|
log('warn', `Dependency ${depId} not found for ${item.id} (plan: ${sourcePlan}) — treating as unmet`);
|
|
1177
1186
|
return false;
|
|
1178
1187
|
}
|
|
1179
|
-
if (depItem.status === 'failed'
|
|
1188
|
+
if (depItem.status === 'failed') return 'failed';
|
|
1180
1189
|
if (depItem.status !== 'done' && depItem.status !== 'in-pr') return false; // Pending, dispatched, or retrying — wait (in-pr accepted for backward compat)
|
|
1181
1190
|
}
|
|
1182
1191
|
return true;
|
|
@@ -2280,6 +2289,18 @@ function buildPrDispatch(agentId, config, project, pr, type, extraVars, taskLabe
|
|
|
2280
2289
|
};
|
|
2281
2290
|
}
|
|
2282
2291
|
|
|
2292
|
+
function clearPendingHumanFeedbackFlag(projectMeta, prId) {
|
|
2293
|
+
if (!prId) return;
|
|
2294
|
+
try {
|
|
2295
|
+
const prsPath = projectPrPath(projectMeta);
|
|
2296
|
+
const prs = safeJson(prsPath) || [];
|
|
2297
|
+
const target = prs.find(p => p.id === prId);
|
|
2298
|
+
if (!target?.humanFeedback?.pendingFix) return;
|
|
2299
|
+
target.humanFeedback.pendingFix = false;
|
|
2300
|
+
safeWrite(prsPath, prs);
|
|
2301
|
+
} catch {}
|
|
2302
|
+
}
|
|
2303
|
+
|
|
2283
2304
|
/**
|
|
2284
2305
|
* Scan pull-requests.json for PRs needing review or fixes
|
|
2285
2306
|
*/
|
|
@@ -2352,7 +2373,7 @@ function discoverFromPrs(config, project) {
|
|
|
2352
2373
|
reviewer: 'Human Reviewer',
|
|
2353
2374
|
review_note: pr.humanFeedback.feedbackContent || 'See PR thread comments',
|
|
2354
2375
|
}, `Fix PR ${pr.id} — human feedback`, { dispatchKey: key, source: 'pr-human-feedback', pr, branch: pr.branch, project: projMeta });
|
|
2355
|
-
if (item) { newWork.push(item);
|
|
2376
|
+
if (item) { newWork.push(item); setCooldown(key); }
|
|
2356
2377
|
}
|
|
2357
2378
|
|
|
2358
2379
|
// PRs with build failures
|
|
@@ -2386,6 +2407,7 @@ function discoverFromWorkItems(config, project) {
|
|
|
2386
2407
|
const items = safeJson(projectWorkItemsPath(project)) || [];
|
|
2387
2408
|
const cooldownMs = (src.cooldownMinutes || 0) * 60 * 1000;
|
|
2388
2409
|
const newWork = [];
|
|
2410
|
+
const prdSyncQueue = [];
|
|
2389
2411
|
const skipped = { gated: 0, noAgent: 0 };
|
|
2390
2412
|
let needsWrite = false;
|
|
2391
2413
|
|
|
@@ -2492,7 +2514,7 @@ function discoverFromWorkItems(config, project) {
|
|
|
2492
2514
|
item.status = 'dispatched';
|
|
2493
2515
|
item.dispatched_at = ts();
|
|
2494
2516
|
item.dispatched_to = agentId;
|
|
2495
|
-
|
|
2517
|
+
prdSyncQueue.push({ id: item.id, sourcePlan: item.sourcePlan });
|
|
2496
2518
|
|
|
2497
2519
|
newWork.push({
|
|
2498
2520
|
type: workType,
|
|
@@ -2511,6 +2533,7 @@ function discoverFromWorkItems(config, project) {
|
|
|
2511
2533
|
if (newWork.length > 0) {
|
|
2512
2534
|
const workItemsPath = projectWorkItemsPath(project);
|
|
2513
2535
|
safeWrite(workItemsPath, items);
|
|
2536
|
+
for (const s of prdSyncQueue) syncPrdItemStatus(s.id, 'dispatched', s.sourcePlan);
|
|
2514
2537
|
}
|
|
2515
2538
|
|
|
2516
2539
|
if (needsWrite) safeWrite(projectWorkItemsPath(project), items);
|
|
@@ -2950,6 +2973,9 @@ function discoverWork(config) {
|
|
|
2950
2973
|
|
|
2951
2974
|
for (const item of allWork) {
|
|
2952
2975
|
addToDispatch(item);
|
|
2976
|
+
if (item.meta?.source === 'pr-human-feedback') {
|
|
2977
|
+
clearPendingHumanFeedbackFlag(item.meta.project, item.meta.pr?.id);
|
|
2978
|
+
}
|
|
2953
2979
|
}
|
|
2954
2980
|
|
|
2955
2981
|
if (allWork.length > 0) {
|
package/package.json
CHANGED