@yemi33/minions 0.1.24 → 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 +9 -0
- package/engine/lifecycle.js +2 -1
- package/engine.js +6 -3
- 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 {}
|
package/package.json
CHANGED