fix(workflow): use Skill instead of Task for auto-advance phase transitions#826
Open
Tibsfox wants to merge 1 commit intogsd-build:mainfrom
Open
fix(workflow): use Skill instead of Task for auto-advance phase transitions#826Tibsfox wants to merge 1 commit intogsd-build:mainfrom
Tibsfox wants to merge 1 commit intogsd-build:mainfrom
Conversation
…itions
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 gsd-build#686
Co-Authored-By: Claude Opus 4.6 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The auto-advance chain (
discuss → plan → executetriggered by--auto) was spawning each subsequent phase as aTask(subagent_type="general-purpose"), creating 3-4 levels of nested agent sessions. At that depth, the Claude Code runtime hits resource limits or stdio contention, causing the execute-phase to either freeze indefinitely or attempt to shell out toclaudeas a subprocess — which is explicitly blocked with "Claude Code cannot be launched inside another Claude Code session."The nesting looks like this:
By level 2-3, the
general-purposeagent loses context about the execute-phase orchestration protocol and falls back to shelling out toclaude --print, which triggers the nested session error.The Fix
Replace
Task(general-purpose)withSkill()invocations for phase transitions:The
Skilltool runs in the same process context as the caller — it doesn't create a subprocess or new agent session. This keeps the entire orchestration chain flat at level 0, with only the actual worker agents (gsd-executor, gsd-verifier, etc.) spawning as Task subagents at level 1.Changes
workflows/plan-phase.md(step 14): Replace 30-lineTask(general-purpose)block withSkill("gsd:execute-phase", args="${PHASE} --auto --no-transition")workflows/discuss-phase.md(auto_advance step): Replace 30-lineTask(general-purpose)block withSkill("gsd:plan-phase", args="${PHASE} --auto")Net effect: -67 lines of complex Task prompt engineering, +13 lines of clean Skill invocations.
Verification
/gsd:discuss-phase <phase> --autoWhy Skill Instead of Task?
The previous code had a comment: "do NOT use Skill tool — Skills don't resolve inside Task subagents". This was correct for the original architecture where each phase ran inside a Task. But the fix here changes the architecture: phases now chain via Skill at the top level, so the resolution concern doesn't apply. Each Skill invocation runs with full access to the command registry.
Closes #686
🤖 Generated with Claude Code