@yemi33/minions 0.1.615 → 0.1.616

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 CHANGED
@@ -1,5 +1,10 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.1.616 (2026-04-08)
4
+
5
+ ### Fixes
6
+ - audit fixes for _killProcessInWorktree
7
+
3
8
  ## 0.1.615 (2026-04-08)
4
9
 
5
10
  ### Features
package/engine/cleanup.js CHANGED
@@ -43,10 +43,9 @@ 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, activeDispatchIds) {
47
47
  const dirLower = dir.toLowerCase();
48
- const dispatch = getDispatch();
49
- const activeIds = new Set((dispatch.active || []).map(d => d.id));
48
+ const activeIds = activeDispatchIds;
50
49
 
51
50
  // Check tracked in-memory processes — only kill if dispatch is no longer active
52
51
  for (const [id, info] of activeProcesses.entries()) {
@@ -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.615",
3
+ "version": "0.1.616",
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"