Skip to content

Commit 609f7f3

Browse files
Tibsfoxclaude
authored andcommitted
fix(workflows): prevent auto_advance config from persisting across sessions
Introduce ephemeral `workflow._auto_chain_active` flag to separate chain propagation from the user's persistent `workflow.auto_advance` preference. Previously, `workflow.auto_advance` was set to true by --auto chains and only cleared at milestone completion. If a chain was interrupted (context limit, crash, user abort), the flag persisted in .planning/config.json and caused all subsequent manual invocations to auto-advance unexpectedly. The fix adds a "sync chain flag with intent" step to discuss-phase, plan-phase, and execute-phase workflows: when --auto is NOT in arguments, the ephemeral _auto_chain_active flag is cleared. The persistent auto_advance setting (from /gsd:settings) is never touched, preserving the user's deliberate preference. Closes #857 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 1c6f4fe commit 609f7f3

File tree

7 files changed

+41
-17
lines changed

7 files changed

+41
-17
lines changed

agents/gsd-executor.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,13 +205,14 @@ Do NOT continue reading. Analysis without action is a stuck signal.
205205
</authentication_gates>
206206

207207
<auto_mode_detection>
208-
Check if auto mode is active at executor start:
208+
Check if auto mode is active at executor start (chain flag or user preference):
209209

210210
```bash
211+
AUTO_CHAIN=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" config-get workflow._auto_chain_active 2>/dev/null || echo "false")
211212
AUTO_CFG=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" config-get workflow.auto_advance 2>/dev/null || echo "false")
212213
```
213214

214-
Store the result for checkpoint handling below.
215+
Auto mode is active if either `AUTO_CHAIN` or `AUTO_CFG` is `"true"`. Store the result for checkpoint handling below.
215216
</auto_mode_detection>
216217

217218
<checkpoint_protocol>

get-shit-done/references/checkpoints.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Plans execute autonomously. Checkpoints formalize interaction points where human
88
2. **Claude sets up the verification environment** - Start dev servers, seed databases, configure env vars
99
3. **User only does what requires human judgment** - Visual checks, UX evaluation, "does this feel right?"
1010
4. **Secrets come from user, automation comes from Claude** - Ask for API keys, then Claude uses them via CLI
11-
5. **Auto-mode bypasses verification/decision checkpoints** — When `workflow.auto_advance` is true in config: human-verify auto-approves, decision auto-selects first option, human-action still stops (auth gates cannot be automated)
11+
5. **Auto-mode bypasses verification/decision checkpoints** — When `workflow._auto_chain_active` or `workflow.auto_advance` is true in config: human-verify auto-approves, decision auto-selects first option, human-action still stops (auth gates cannot be automated)
1212
</overview>
1313

1414
<checkpoint_types>

get-shit-done/workflows/discuss-phase.md

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -589,17 +589,24 @@ node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" commit "docs(state): record
589589
Check for auto-advance trigger:
590590

591591
1. Parse `--auto` flag from $ARGUMENTS
592-
2. Read `workflow.auto_advance` from config:
592+
2. **Sync chain flag with intent** — if user invoked manually (no `--auto`), clear the ephemeral chain flag from any previous interrupted `--auto` chain. This does NOT touch `workflow.auto_advance` (the user's persistent settings preference):
593593
```bash
594+
if [[ ! "$ARGUMENTS" =~ --auto ]]; then
595+
node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" config-set workflow._auto_chain_active false 2>/dev/null
596+
fi
597+
```
598+
3. Read both the chain flag and user preference:
599+
```bash
600+
AUTO_CHAIN=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" config-get workflow._auto_chain_active 2>/dev/null || echo "false")
594601
AUTO_CFG=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" config-get workflow.auto_advance 2>/dev/null || echo "false")
595602
```
596603

597-
**If `--auto` flag present AND `AUTO_CFG` is not true:** Persist auto-advance to config (handles direct `--auto` usage without new-project):
604+
**If `--auto` flag present AND `AUTO_CHAIN` is not true:** Persist chain flag to config (handles direct `--auto` usage without new-project):
598605
```bash
599-
node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" config-set workflow.auto_advance true
606+
node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" config-set workflow._auto_chain_active true
600607
```
601608

602-
**If `--auto` flag present OR `AUTO_CFG` is true:**
609+
**If `--auto` flag present OR `AUTO_CHAIN` is true OR `AUTO_CFG` is true:**
603610

604611
Display banner:
605612
```

get-shit-done/workflows/execute-phase.md

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,13 @@ Parse JSON for: `executor_model`, `verifier_model`, `commit_docs`, `parallelizat
2626
**If `state_exists` is false but `.planning/` exists:** Offer reconstruct or continue.
2727

2828
When `parallelization` is false, plans within a wave execute sequentially.
29+
30+
**Sync chain flag with intent** — if user invoked manually (no `--auto`), clear the ephemeral chain flag from any previous interrupted `--auto` chain. This does NOT touch `workflow.auto_advance` (the user's persistent settings preference). Must happen before any config reads (checkpoint handling also reads auto-advance flags):
31+
```bash
32+
if [[ ! "$ARGUMENTS" =~ --auto ]]; then
33+
node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" config-set workflow._auto_chain_active false 2>/dev/null
34+
fi
35+
```
2936
</step>
3037

3138
<step name="handle_branching">
@@ -179,12 +186,13 @@ Plans with `autonomous: false` require user interaction.
179186

180187
**Auto-mode checkpoint handling:**
181188

182-
Read auto-advance config:
189+
Read auto-advance config (chain flag + user preference):
183190
```bash
191+
AUTO_CHAIN=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" config-get workflow._auto_chain_active 2>/dev/null || echo "false")
184192
AUTO_CFG=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" config-get workflow.auto_advance 2>/dev/null || echo "false")
185193
```
186194

187-
When executor returns a checkpoint AND `AUTO_CFG` is `"true"`:
195+
When executor returns a checkpoint AND (`AUTO_CHAIN` is `"true"` OR `AUTO_CFG` is `"true"`):
188196
- **human-verify** → Auto-spawn continuation agent with `{user_response}` = `"approved"`. Log `⚡ Auto-approved checkpoint`.
189197
- **decision** → Auto-spawn continuation agent with `{user_response}` = first option from checkpoint details. Log `⚡ Auto-selected: [option]`.
190198
- **human-action** → Present to user (existing behavior below). Auth gates cannot be automated.
@@ -405,12 +413,13 @@ STOP. Do not proceed to auto-advance or transition.
405413
**Auto-advance detection:**
406414

407415
1. Parse `--auto` flag from $ARGUMENTS
408-
2. Read `workflow.auto_advance` from config:
416+
2. Read both the chain flag and user preference (chain flag already synced in init step):
409417
```bash
418+
AUTO_CHAIN=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" config-get workflow._auto_chain_active 2>/dev/null || echo "false")
410419
AUTO_CFG=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" config-get workflow.auto_advance 2>/dev/null || echo "false")
411420
```
412421

413-
**If `--auto` flag present OR `AUTO_CFG` is true (AND verification passed with no gaps):**
422+
**If `--auto` flag present OR `AUTO_CHAIN` is true OR `AUTO_CFG` is true (AND verification passed with no gaps):**
414423

415424
```
416425
╔══════════════════════════════════════════╗

get-shit-done/workflows/new-project.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,10 +191,10 @@ mkdir -p .planning
191191
node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" commit "chore: add project config" --files .planning/config.json
192192
```
193193

194-
**Persist auto-advance to config (survives context compaction):**
194+
**Persist auto-advance chain flag to config (survives context compaction):**
195195

196196
```bash
197-
node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" config-set workflow.auto_advance true
197+
node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" config-set workflow._auto_chain_active true
198198
```
199199

200200
Proceed to Step 4 (skip Steps 3 and 5).

get-shit-done/workflows/plan-phase.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -441,12 +441,19 @@ Route to `<offer_next>` OR `auto_advance` depending on flags/config.
441441
Check for auto-advance trigger:
442442

443443
1. Parse `--auto` flag from $ARGUMENTS
444-
2. Read `workflow.auto_advance` from config:
444+
2. **Sync chain flag with intent** — if user invoked manually (no `--auto`), clear the ephemeral chain flag from any previous interrupted `--auto` chain. This does NOT touch `workflow.auto_advance` (the user's persistent settings preference):
445445
```bash
446+
if [[ ! "$ARGUMENTS" =~ --auto ]]; then
447+
node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" config-set workflow._auto_chain_active false 2>/dev/null
448+
fi
449+
```
450+
3. Read both the chain flag and user preference:
451+
```bash
452+
AUTO_CHAIN=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" config-get workflow._auto_chain_active 2>/dev/null || echo "false")
446453
AUTO_CFG=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" config-get workflow.auto_advance 2>/dev/null || echo "false")
447454
```
448455

449-
**If `--auto` flag present OR `AUTO_CFG` is true:**
456+
**If `--auto` flag present OR `AUTO_CHAIN` is true OR `AUTO_CFG` is true:**
450457

451458
Display banner:
452459
```

get-shit-done/workflows/transition.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -451,9 +451,9 @@ Exit skill and invoke SlashCommand("/gsd:discuss-phase [X+1] --auto")
451451

452452
**Route B: Milestone complete (all phases done)**
453453

454-
**Clear auto-advance** — milestone boundary is the natural stopping point:
454+
**Clear auto-advance chain flag** — milestone boundary is the natural stopping point:
455455
```bash
456-
node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" config-set workflow.auto_advance false
456+
node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" config-set workflow._auto_chain_active false
457457
```
458458

459459
<if mode="yolo">

0 commit comments

Comments
 (0)