Skip to content

feat: improve taskMaestro watch mode status detection accuracy #864

@JeremyDev87

Description

@JeremyDev87

Purpose

The current taskMaestro watch mode misclassifies stuck/errored workers as "working" because it only checks the last 5-8 lines of capture-pane output and relies on the OMC status bar's "thinking" indicator. This leads to workers remaining stuck without intervention.

Background

Observed in 2026-03-22 Wave 4 execution:

  • Pane 2 (feat(mcp): session-isolated context documents to prevent multi-session overwrites #843) had a test failure (Cannot find package '@nestjs/common') due to missing node_modules in worktree
  • The error message was at the TOP of the visible pane (line ~10-15), but the status check only read the BOTTOM 5-8 lines
  • OMC status bar showed thinking (Claude generating error recovery response), which the watch classified as "working"
  • Result: worker was stuck for multiple watch cycles before manual intervention

Root Cause Chain

capture-pane tail -8  →  Only sees: OMC status bar + prompt (❯)
                     →  Sees "thinking" in status bar
                     →  Classifies as "working" ✗
                     →  Misses "FAIL" / "Error:" on line 10-15
                     →  No nudge sent
                     →  Worker stays stuck

Changes

  • .claude/skills/taskmaestro/SKILL.md — Enhance status detection in watch and status subcommands

Solution: Two-Pass Status Detection

Current (broken)

# Only checks last 8 lines
CAPTURED=$(tmux capture-pane -t "$PANE" -p -S -30 | tail -8)
if echo "$CAPTURED" | grep -q "thinking"; then STATUS="working"; fi

Proposed (two-pass)

# Pass 1: Error scan (broad range — last 30 lines)
FULL_CAPTURE=$(tmux capture-pane -t "$PANE" -p -S -30)
ERROR_SCAN=$(echo "$FULL_CAPTURE" | grep -iE "FAIL|Error:|Cannot find|fatal:|AssertionError|panic|ENOENT")

# Pass 2: Activity check (last 8 lines for prompt/thinking)
TAIL_CAPTURE=$(echo "$FULL_CAPTURE" | tail -8)
HAS_THINKING=$(echo "$TAIL_CAPTURE" | grep -c "thinking\|Running\|Inferring\|Brewing")
HAS_PROMPT=$(echo "$TAIL_CAPTURE" | grep -cE "⏵⏵|❯")

# Classification logic
if [ -n "$ERROR_SCAN" ] && [ "$HAS_PROMPT" -gt 0 ] && [ "$HAS_THINKING" -eq 0 ]; then
  STATUS="error_idle"   # Error visible + at prompt + not thinking → STUCK
elif [ -n "$ERROR_SCAN" ] && [ "$HAS_THINKING" -gt 0 ]; then
  STATUS="error_recovering"  # Error visible + thinking → give it one more cycle
elif [ "$HAS_THINKING" -gt 0 ]; then
  STATUS="working"      # Thinking, no errors → normal
elif [ "$HAS_PROMPT" -gt 0 ]; then
  STATUS="idle"          # At prompt, not thinking, no errors → idle
else
  STATUS="unknown"
fi

Status Classification Table

Error Visible Thinking At Prompt Classification Action
No Yes - working None
No No Yes idle Nudge if 2+ cycles
Yes No Yes error_idle Nudge immediately
Yes Yes - error_recovering Wait 1 cycle, then nudge
No No No crashed Alert conductor

Additional: Worktree Dependency Pre-check

Add to start subcommand after worktree creation:

# Pre-install dependencies in worktrees that have package.json
for WT in $WORKTREES; do
  if [ -f "$WT/package.json" ] && [ ! -d "$WT/node_modules" ]; then
    # Symlink node_modules from main repo if monorepo
    ln -s "$REPO/node_modules" "$WT/node_modules" 2>/dev/null || true
    # Or for monorepos with workspaces:
    cd "$WT" && yarn install --frozen-lockfile 2>/dev/null &
  fi
done

Acceptance Criteria

  • Two-pass status detection: error scan (30 lines) + activity check (8 lines)
  • error_idle state detected and nudged immediately (not waiting 2 cycles)
  • error_recovering state given 1 extra cycle grace period before nudge
  • Error patterns include: FAIL, Error:, Cannot find, fatal:, AssertionError, ENOENT
  • OMC "thinking" alone no longer sufficient to classify as "working" when errors present
  • Optional: worktree dependency pre-check (symlink or install node_modules)
  • SKILL.md watch and status subcommands updated
  • Existing non-error behavior unchanged

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    featpriority:shouldShould Have - 중요하지만 필수는 아님skillNew skill addition to .ai-rules/skills/

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions