garrytan / garrytan/gstack

/autoplan: no workspace safeguards (git stash / branch isolation) around 15-30 min in-place plan edits

Open
#1,959 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
133k
Forks
19.9k
Avg merge
18h 46m
Merged PRs (30d)
26

Description

Filed downstream at aviraldua93/gstack-copilot#11. Bug in canonical upstream gstack — exposed by considering failure modes of a 15-30 min skill that edits the plan file in-place.

## Summary

`/autoplan` Phase 0 captures a restore point of the PLAN file before starting (good). But the surrounding workspace is unprotected:
- Uncommitted changes to other files are at the mercy of any phase that edits PLAN.md / TODOS.md / CLAUDE.md.
- Ctrl+C mid-Phase-3 leaves the plan file with partial review report sections. Recovery requires manually opening the restore file and copy-pasting.
- Decision Audit Trail rows are appended row-by-row via Edit. Mid-flight interruption = half-edited state.

Only safeguard today is the PLAN.md snapshot at `~/.gstack/projects/$SLUG/${BRANCH}-autoplan-restore-${DATETIME}.md` — a snapshot of ONE file, not the workspace.

## Suggested fix

Add optional `--git-safe` flag (or default-on with `--no-git-safe` opt-out):

1. On entry: `git stash push -u -m "autoplan-safety-${SESSION_ID}"`
2. `git checkout -b autoplan-wip/${SESSION_ID}` to isolate review-report writes
3. On clean completion: merge back into user's branch + `git stash pop`
4. On failure/Ctrl+C: leave stash + branch with clear recovery hint:
```
⚠ autoplan interrupted. Your workspace is preserved at:
- branch: autoplan-wip/
- stash: stash@{0}
To recover: git checkout && git stash pop
```

## Smaller version

Even just a Phase 0 banner: "this skill will edit your plan file in place; uncommitted changes elsewhere are not protected; Ctrl+C now if that's a problem."

For a flagship skill the README points users at, recovery story should be `git checkout `, not "find the snapshot and copy-paste."

---
*Filed via GitHub Copilot CLI by @aviraldua93 during stress-testing a downstream port.*

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.