@yemi33/minions 0.1.615 → 0.1.617
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 +8 -0
- package/engine/cleanup.js +10 -5
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/engine/cleanup.js
CHANGED
|
@@ -43,10 +43,8 @@ function worktreeDirMatchesBranch(dirLower, branch) {
|
|
|
43
43
|
* Kill orphaned processes whose dispatch ID appears in the worktree dir name.
|
|
44
44
|
* Only kills processes NOT in the active dispatch queue — never kills live agents.
|
|
45
45
|
*/
|
|
46
|
-
function _killProcessInWorktree(dir, activeProcesses) {
|
|
46
|
+
function _killProcessInWorktree(dir, activeProcesses, activeIds) {
|
|
47
47
|
const dirLower = dir.toLowerCase();
|
|
48
|
-
const dispatch = getDispatch();
|
|
49
|
-
const activeIds = new Set((dispatch.active || []).map(d => d.id));
|
|
50
48
|
|
|
51
49
|
// Check tracked in-memory processes — only kill if dispatch is no longer active
|
|
52
50
|
for (const [id, info] of activeProcesses.entries()) {
|
|
@@ -65,7 +63,8 @@ function _killProcessInWorktree(dir, activeProcesses) {
|
|
|
65
63
|
const pidFileName = f.replace(/^pid-/, '').replace(/\.pid$/, '');
|
|
66
64
|
if (!dirLower.includes(pidFileName.slice(-8))) continue;
|
|
67
65
|
// Verify this PID file's dispatch is not active
|
|
68
|
-
|
|
66
|
+
let isActive = false;
|
|
67
|
+
for (const id of activeIds) { if (pidFileName.includes(id.slice(-8))) { isActive = true; break; } }
|
|
69
68
|
if (isActive) continue; // still active — do not kill
|
|
70
69
|
const pid = parseInt(fs.readFileSync(path.join(tmpDir, f), 'utf8').trim(), 10);
|
|
71
70
|
if (pid > 0) {
|
|
@@ -76,6 +75,11 @@ function _killProcessInWorktree(dir, activeProcesses) {
|
|
|
76
75
|
if (!taskInfo.toLowerCase().includes('node')) continue; // not a node process — skip
|
|
77
76
|
exec(`taskkill /F /PID ${pid}`, { stdio: 'pipe', timeout: 5000, windowsHide: true });
|
|
78
77
|
} else {
|
|
78
|
+
// Verify it's a node process before killing (prevent recycled PID kill)
|
|
79
|
+
try {
|
|
80
|
+
const psOut = exec(`ps -p ${pid} -o comm=`, { encoding: 'utf8', timeout: 3000 }).trim();
|
|
81
|
+
if (!psOut.includes('node') && !psOut.includes('claude')) continue;
|
|
82
|
+
} catch { continue; } // process dead or ps failed
|
|
79
83
|
process.kill(pid, 'SIGKILL');
|
|
80
84
|
}
|
|
81
85
|
log('info', `Killed orphaned PID ${pid} (${f}) before worktree removal`);
|
|
@@ -200,6 +204,7 @@ function runCleanup(config, verbose = false) {
|
|
|
200
204
|
|
|
201
205
|
const wtEntries = []; // { dir, wtPath, mtime, shouldClean, isProtected }
|
|
202
206
|
const dispatch = getDispatch();
|
|
207
|
+
const activeDispatchIds = new Set((dispatch.active || []).map(d => d.id));
|
|
203
208
|
|
|
204
209
|
for (const { dir, wtPath } of allDirs) {
|
|
205
210
|
|
|
@@ -312,7 +317,7 @@ function runCleanup(config, verbose = false) {
|
|
|
312
317
|
if (_attemptedWorktreePaths.has(entry.wtPath)) continue;
|
|
313
318
|
_attemptedWorktreePaths.add(entry.wtPath);
|
|
314
319
|
// Kill any process still running in this worktree before removal
|
|
315
|
-
_killProcessInWorktree(entry.dir, activeProcesses);
|
|
320
|
+
_killProcessInWorktree(entry.dir, activeProcesses, activeDispatchIds);
|
|
316
321
|
if (shared.removeWorktree(entry.wtPath, root, worktreeRoot)) {
|
|
317
322
|
cleaned.worktrees++;
|
|
318
323
|
if (verbose) console.log(` Removed worktree: ${entry.wtPath}`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yemi33/minions",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.617",
|
|
4
4
|
"description": "Multi-agent AI dev team that runs from ~/.minions/ — five autonomous agents share a single engine, dashboard, and knowledge base",
|
|
5
5
|
"bin": {
|
|
6
6
|
"minions": "bin/minions.js"
|