multi-agents-cli 1.1.51 → 1.1.52

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.
@@ -221,6 +221,51 @@ async function sync(opts = {}) {
221
221
  }
222
222
  });
223
223
 
224
+ // Check 3b staleness / stuck-push detection
225
+ const STALE_THRESHOLD_MS = 4 * 60 * 60 * 1000; // 4 hours - single constant, tune here
226
+ eachSlot(tracking, (scope, agent, slot) => {
227
+ if (!slot.branch) return;
228
+ if (!isActive(slot) && slot.status !== 'MISSING') return;
229
+ if (mergedBranches.includes(slot.branch)) return; // already handled by check 3
230
+
231
+ // Primary signal: TASK.md says [x] COMPLETED but branch not merged -> stalled push
232
+ const wt = worktrees.find(w => w.branch === slot.branch);
233
+ const wtPath = wt ? wt.path : slot.worktreePath;
234
+ if (wtPath && worktreeHealthy(wtPath)) {
235
+ const taskPath = findTaskMd(wtPath, scope);
236
+ if (taskPath) {
237
+ try {
238
+ const taskContent = fs.readFileSync(taskPath, 'utf8');
239
+ if (taskContent.includes('[x] COMPLETED')) {
240
+ decisions.push(
241
+ `${scope}/${agent}: TASK.md marked COMPLETED but branch not merged - push/merge likely failed. \n` +
242
+ ` Run: git push origin ${slot.branch} && npm run complete`
243
+ );
244
+ return;
245
+ }
246
+ } catch {}
247
+ }
248
+ }
249
+
250
+ // Secondary signal: no commits in > STALE_THRESHOLD_MS since launch (softer advisory)
251
+ if (slot.launchedAt) {
252
+ try {
253
+ const lastCommitTs = parseInt(
254
+ execSync(`git log -1 --format=%ct ${slot.branch}`, { cwd: ROOT, stdio: 'pipe', encoding: 'utf8' }).trim(),
255
+ 10
256
+ ) * 1000;
257
+ const launchedAt = new Date(slot.launchedAt).getTime();
258
+ const elapsed = Date.now() - Math.max(lastCommitTs, launchedAt);
259
+ if (elapsed > STALE_THRESHOLD_MS) {
260
+ const hours = Math.round(elapsed / 1000 / 60 / 60);
261
+ decisions.push(
262
+ `${scope}/${agent}: no new commits in ~${hours}h - may be stalled or still running, check manually`
263
+ );
264
+ }
265
+ } catch {}
266
+ }
267
+ });
268
+
224
269
  // Check 4 BUILD_STATE vs tracking drift
225
270
  eachSlot(tracking, (scope, agent, slot) => {
226
271
  if (slot.status !== 'COMPLETED' || !slot.branch) return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "multi-agents-cli",
3
- "version": "1.1.51",
3
+ "version": "1.1.52",
4
4
  "description": "Multi-agent workflow orchestration for Claude Code — isolated git worktrees, structured state tracking, autonomous task chaining",
5
5
  "keywords": [
6
6
  "claude-code",