Files
msd-core/get-shit-done/workflows/discuss-phase/modes/chain.md
Tom Boucher c8ae6b3b4f fix(#2636): surface gsd-sdk query failures and add workflow↔handler parity check (#2656)
* fix(#2636): surface gsd-sdk query failures and add workflow↔handler parity check

Root cause: workflows invoked `gsd-sdk query agent-skills <slug>` with a
trailing `2>/dev/null`, swallowing stderr and exit code. When the installed
`@gsd-build/sdk` npm was stale (pre-query), the call resolved to an empty
string and `agent_skills.<slug>` config was never injected into spawn
prompts — silently. The handler exists on main (sdk/src/query/skills.ts),
so this is a publish-drift + silent-fallback bug, not a missing handler.

Fix:
- Remove bare `2>/dev/null` from every `gsd-sdk query agent-skills …`
  invocation in workflows so SDK failures surface to stderr.
- Apply the same rule to other no-fallback calls (audit-open, write-profile,
  generate-* profile handlers, frontmatter.get in commands). Best-effort
  cleanup calls (config-set workflow._auto_chain_active false) keep
  exit-code forgiveness via `|| true` but no longer suppress stderr.

Parity tests:
- New: tests/bug-2636-gsd-sdk-query-silent-swallow.test.cjs — fails if any
  `gsd-sdk query agent-skills … 2>/dev/null` is reintroduced.
- Existing: tests/gsd-sdk-query-registry-integration.test.cjs already
  asserts every workflow noun resolves to a registered handler; confirmed
  passing post-change.

Note: npm republish of @gsd-build/sdk is a separate release concern and is
not included in this PR.

* fix(#2636): address review — restore broken markdown fences and shell syntax

The previous commit's mass removal of '2>/dev/null' suffixes also
collapsed adjacent closing code fences and 'fi' tokens onto the
command line, producing malformed markdown blocks and 'truefi' /
'true   fi' shell syntax errors in the workflows.

Repaired sites:
- commands/gsd/quick.md, thread.md (frontmatter.get fences)
- workflows/complete-milestone.md (audit-open fence)
- workflows/profile-user.md (write-profile + generate-* fences)
- workflows/verify-work.md (audit-open --json fence)
- workflows/execute-phase.md (truefi -> true / fi)
- workflows/plan-phase.md, discuss-phase-assumptions.md,
  discuss-phase/modes/chain.md (true   fi -> true / fi)

All 5450 tests pass.
2026-04-24 18:10:45 -04:00

4.0 KiB

--chain mode — interactive discuss, then auto-advance

Lazy-loaded. Read this file from workflows/discuss-phase.md when --chain is present in $ARGUMENTS, or when the parent's auto_advance step needs to dispatch to plan-phase under --auto.

Effect

  • Discussion is fully interactive — questions, gray-area selection, and follow-ups behave exactly the same as default mode.
  • After discussion completes, auto-advance to plan-phase → execute-phase (same downstream behavior as --auto).
  • This is the middle ground: the user controls the discuss decisions, then plan and execute run autonomously.

auto_advance step (executed by the parent file)

  1. Parse --auto and --chain flags from $ARGUMENTS. Note: --all is NOT an auto-advance trigger — it only affects area selection. A session with --all but without --auto or --chain returns to manual next-steps after discussion completes.

  2. Sync chain flag with intent — if user invoked manually (no --auto and no --chain), clear the ephemeral chain flag from any previous interrupted --auto chain. This does NOT touch workflow.auto_advance (the user's persistent settings preference):

    if [[ ! "$ARGUMENTS" =~ --auto ]] && [[ ! "$ARGUMENTS" =~ --chain ]]; then
      gsd-sdk query config-set workflow._auto_chain_active false || true
    fi
    
  3. Read consolidated auto-mode (active = chain flag OR user preference):

    AUTO_MODE=$(gsd-sdk query check auto-mode --pick active 2>/dev/null || echo "false")
    
  4. If --auto or --chain flag present AND AUTO_MODE is not true: Persist chain flag to config (handles direct usage without new-project):

    gsd-sdk query config-set workflow._auto_chain_active true
    
  5. If --auto flag present OR --chain flag present OR AUTO_MODE is true: display banner and launch plan-phase.

    Banner:

    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
     GSD ► AUTO-ADVANCING TO PLAN
    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
    
    Context captured. Launching plan-phase...
    

    Launch plan-phase using the Skill tool to avoid nested Task sessions (which cause runtime freezes due to deep agent nesting — see #686):

    Skill(skill="gsd-plan-phase", args="${PHASE} --auto ${GSD_WS}")
    

    This keeps the auto-advance chain flat — discuss, plan, and execute all run at the same nesting level rather than spawning increasingly deep Task agents.

  6. Handle plan-phase return:

    • PHASE COMPLETE → Full chain succeeded. Display:
      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
       GSD ► PHASE ${PHASE} COMPLETE
      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
      
      Auto-advance pipeline finished: discuss → plan → execute
      
      /clear then:
      
      Next: /gsd:discuss-phase ${NEXT_PHASE} ${WAS_CHAIN ? "--chain" : "--auto"} ${GSD_WS}
      
    • PLANNING COMPLETE → Planning done, execution didn't complete:
      Auto-advance partial: Planning complete, execution did not finish.
      Continue: /gsd:execute-phase ${PHASE} ${GSD_WS}
      
    • PLANNING INCONCLUSIVE / CHECKPOINT → Stop chain:
      Auto-advance stopped: Planning needs input.
      Continue: /gsd:plan-phase ${PHASE} ${GSD_WS}
      
    • GAPS FOUND → Stop chain:
      Auto-advance stopped: Gaps found during execution.
      Continue: /gsd:plan-phase ${PHASE} --gaps ${GSD_WS}
      
  7. If none of --auto, --chain, nor config enabled: route to confirm_creation step (existing behavior — show manual next steps).