@yemi33/minions 0.1.23 → 0.1.25
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 +14 -0
- package/engine/lifecycle.js +2 -1
- package/engine.js +8 -5
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/engine/lifecycle.js
CHANGED
|
@@ -1011,7 +1011,8 @@ function runPostCompletionHooks(dispatchItem, agentId, code, stdout, config) {
|
|
|
1011
1011
|
if (isSuccess && sessionId && agentId && !agentId.startsWith('temp-')) {
|
|
1012
1012
|
try {
|
|
1013
1013
|
shared.safeWrite(path.join(AGENTS_DIR, agentId, 'session.json'), {
|
|
1014
|
-
sessionId, dispatchId: dispatchItem.id, savedAt: new Date().toISOString()
|
|
1014
|
+
sessionId, dispatchId: dispatchItem.id, savedAt: new Date().toISOString(),
|
|
1015
|
+
branch: dispatchItem.meta?.branch || null,
|
|
1015
1016
|
});
|
|
1016
1017
|
} catch {}
|
|
1017
1018
|
}
|
package/engine.js
CHANGED
|
@@ -939,15 +939,18 @@ function spawnAgent(dispatchItem, config) {
|
|
|
939
939
|
args.push('--allowedTools', claudeConfig.allowedTools);
|
|
940
940
|
}
|
|
941
941
|
|
|
942
|
-
// Session resume: reuse last session if recent enough (< 2 hours)
|
|
942
|
+
// Session resume: reuse last session if same branch and recent enough (< 2 hours)
|
|
943
|
+
// Only resume when the context is relevant — same branch means the agent is
|
|
944
|
+
// continuing work on the same PR/feature (e.g., author fixing their own build failure)
|
|
943
945
|
if (!agentId.startsWith('temp-')) {
|
|
944
946
|
try {
|
|
945
947
|
const sessionFile = safeJson(path.join(AGENTS_DIR, agentId, 'session.json'));
|
|
946
948
|
if (sessionFile?.sessionId && sessionFile.savedAt) {
|
|
947
949
|
const sessionAge = Date.now() - new Date(sessionFile.savedAt).getTime();
|
|
948
|
-
|
|
950
|
+
const sameBranch = branchName && sessionFile.branch && sessionFile.branch === branchName;
|
|
951
|
+
if (sessionAge < 2 * 60 * 60 * 1000 && sameBranch) {
|
|
949
952
|
args.push('--resume', sessionFile.sessionId);
|
|
950
|
-
log('info', `Resuming session ${sessionFile.sessionId} for ${agentId} (age: ${Math.round(sessionAge / 60000)}min)`);
|
|
953
|
+
log('info', `Resuming session ${sessionFile.sessionId} for ${agentId} on branch ${branchName} (age: ${Math.round(sessionAge / 60000)}min)`);
|
|
951
954
|
}
|
|
952
955
|
}
|
|
953
956
|
} catch {}
|
|
@@ -2522,11 +2525,11 @@ function discoverFromPrs(config, project) {
|
|
|
2522
2525
|
if (item) { newWork.push(item); setCooldown(key); }
|
|
2523
2526
|
}
|
|
2524
2527
|
|
|
2525
|
-
// PRs with build failures —
|
|
2528
|
+
// PRs with build failures — route to author (has session context from implementing)
|
|
2526
2529
|
if (pr.status === 'active' && pr.buildStatus === 'failing') {
|
|
2527
2530
|
const key = `build-fix-${project?.name || 'default'}-${pr.id}`;
|
|
2528
2531
|
if (isAlreadyDispatched(key) || isOnCooldown(key, cooldownMs)) continue;
|
|
2529
|
-
const agentId = resolveAgent('fix', config);
|
|
2532
|
+
const agentId = resolveAgent('fix', config, pr.agent);
|
|
2530
2533
|
if (!agentId) continue;
|
|
2531
2534
|
|
|
2532
2535
|
const item = buildPrDispatch(agentId, config, project, pr, 'fix', {
|
package/package.json
CHANGED