fix(workflow): use Skill instead of Task for auto-advance phase transitions

The auto-advance chain (discuss → plan → execute) was spawning each
subsequent phase as a Task(subagent_type="general-purpose"), creating
3-4 levels of nested agent sessions. At that nesting depth, the
Claude Code runtime hits resource limits or stdio contention, causing
the execute-phase to freeze or attempt to shell out to `claude` as a
subprocess (which is explicitly blocked).

The fix replaces Task spawns with Skill invocations for phase
transitions:
- discuss-phase auto-advance: Skill("gsd:plan-phase") instead of
  Task(general-purpose)
- plan-phase auto-advance: Skill("gsd:execute-phase") instead of
  Task(general-purpose)

The Skill tool runs in the same process context as the caller,
keeping the entire auto-advance chain flat at a single nesting level.
Each phase still spawns its own worker agents (gsd-executor,
gsd-planner, etc.) as Tasks, but the orchestration chain itself
no longer creates unnecessary depth.

Closes #686

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Tibsfox
2026-02-28 05:42:21 -08:00
parent 1c58e84eb3
commit b3e3e3ddc3
2 changed files with 10 additions and 64 deletions

View File

@@ -454,44 +454,16 @@ Display banner:
GSD ► AUTO-ADVANCING TO EXECUTE
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Plans ready. Spawning execute-phase...
Plans ready. Launching execute-phase...
```
Spawn execute-phase as Task with direct workflow file reference (do NOT use Skill tool — Skills don't resolve inside Task subagents):
Launch execute-phase using the Skill tool to avoid nested Task sessions (which cause runtime freezes due to deep agent nesting):
```
Task(
prompt="
<objective>
You are the execute-phase orchestrator. Execute all plans for Phase ${PHASE}: ${PHASE_NAME}.
</objective>
<execution_context>
@~/.claude/get-shit-done/workflows/execute-phase.md
@~/.claude/get-shit-done/references/checkpoints.md
@~/.claude/get-shit-done/references/tdd.md
@~/.claude/get-shit-done/references/model-profile-resolution.md
</execution_context>
<arguments>
PHASE=${PHASE}
ARGUMENTS='${PHASE} --auto --no-transition'
</arguments>
<instructions>
1. Read execute-phase.md from execution_context for your complete workflow
2. Follow ALL steps: initialize, handle_branching, validate_phase, discover_and_group_plans, execute_waves, aggregate_results, close_parent_artifacts, verify_phase_goal, update_roadmap
3. The --no-transition flag means: after verification + roadmap update, STOP and return status. Do NOT run transition.md.
4. When spawning executor agents, use subagent_type='gsd-executor' with the existing @file pattern from the workflow
5. When spawning verifier agents, use subagent_type='gsd-verifier'
6. Preserve the classifyHandoffIfNeeded workaround (spot-check on that specific error)
7. Do NOT use the Skill tool or /gsd: commands
</instructions>
",
subagent_type="general-purpose",
description="Execute Phase ${PHASE}"
)
Skill(skill="gsd:execute-phase", args="${PHASE} --auto --no-transition")
```
The `--no-transition` flag tells execute-phase to return status after verification instead of chaining further. This keeps the auto-advance chain flat — each phase runs at the same nesting level rather than spawning deeper Task agents.
**Handle execute-phase return:**
- **PHASE COMPLETE** → Display final summary:
```