/autoplan: no workspace safeguards (git stash / branch isolation) around 15-30 min in-place plan edits
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):
- On entry:
git stash push -u -m "autoplan-safety-${SESSION_ID}" git checkout -b autoplan-wip/${SESSION_ID}to isolate review-report writes- On clean completion: merge back into user's branch +
git stash pop - On failure/Ctrl+C: leave stash + branch with clear recovery hint:
⚠ autoplan interrupted. Your workspace is preserved at:
- branch: autoplan-wip/<session-id>
- stash: stash@{0}
To recover: git checkout <your-branch> && 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 <branch>, not "find the snapshot and copy-paste."
Filed via GitHub Copilot CLI by @aviraldua93 during stress-testing a downstream port.
This is a workspace mutation contract issue.
/autoplan can run for 15–30 minutes and edit plan artifacts in place. That should probably have a workspace safety preflight.
A standard AISP-style contract could make this explicit:
[
{
"role": "system",
"content": {
"protocol": "AISP V1.0.0",
"axiom_0": "Human_Sovereignty_and_Wellbeing",
"id": "gstack_autoplan_workspace_safeguard_aisp",
"name": "gstack /autoplan Workspace Safeguard Contract",
"version": "1.0.0",
"license": "MIT",
"summary": "Machine-checkable contract for git branch/stash safeguards around long /autoplan edits.",
"flow_format": "mermaid",
"loading_mode": "node",
"tools": ["filesystem", "shell"],
"params": {
"repo_root": "string",
"plan_path": "string"
},
"system_prompt": ""
}
},
{
"role": "user",
"content": {
"instruction": "STRICTLY OBEY aisp_contract; its non_negotiable rules are inviolable; then RUN aisop.main",
"user_input": "{user_input}",
"aisp_contract": {
"profile": "aisp.skill.v1",
"invocation": {
"mode": "preflight_workspace_safety",
"when_to_use": [
"before /autoplan performs long-running in-place plan edits",
"before editing plan artifacts in a git repo",
"when workspace has uncommitted changes"
],
"when_not_to_use": [
"read-only /autoplan dry run",
"explicit user-approved no-safeguard mode"
]
},
"non_negotiable": [
{
"rule": "Do not start long in-place /autoplan edits without checking git status.",
"enforced_by": "git_status.step2:sys.assert"
},
{
"rule": "If workspace has dirty changes, require stash, branch isolation, or explicit user approval.",
"enforced_by": "safeguard.step2:sys.assert"
},
{
"rule": "Record preflight state before modifying plan files.",
"enforced_by": "trace.step2:sys.assert"
}
],
"discovery": {
"category": "planning_workflow",
"tags": ["gstack", "autoplan", "git", "workspace-safety", "aisp"]
},
"risk_level": "high",
"resources": [
{
"id": "repo_root",
"path": "{repo_root}",
"kind": "repository",
"mode": "read_only",
"when": "Read before workspace safety preflight.",
"scope": "skill"
}
]
},
"aisop": {
"main": "graph TD\n git_status[Check git status] --> safeguard[Choose workspace safeguard]\n safeguard --> snapshot[Record preflight snapshot]\n snapshot --> edit[Run autoplan edits]\n edit --> trace[Record edit trace]\n trace --> end_node((End))"
},
"functions": {
"git_status": {
"step1": "Run git status --porcelain in repo_root.",
"step2": "sys.assert('git status checked before editing', 'Autoplan requires git status preflight')",
"output_mapping": "git_status_result"
},
"safeguard": {
"step1": "If dirty, choose stash, branch isolation, or explicit user approval.",
"step2": "sys.assert('dirty workspace has safeguard or user approval', 'Autoplan cannot edit dirty workspace without safeguard')",
"output_mapping": "workspace_safeguard"
},
"snapshot": {
"step1": "Record branch, HEAD, dirty files, plan_path, and safeguard decision.",
"output_mapping": "preflight_snapshot"
},
"edit": {
"step1": "Run /autoplan edits only after preflight_snapshot exists.",
"output_mapping": "autoplan_edit_result"
},
"trace": {
"step1": "Record modified files and compare with allowed plan paths.",
"step2": "sys.assert('preflight trace exists before modifications', 'Autoplan modifications must be traceable')",
"output_mapping": "autoplan_workspace_trace"
},
"end_node": {
"step1": "Return autoplan_workspace_trace."
}
}
}
}
]
The minimal fix:
1. Run git status before long /autoplan edits.
2. Warn or ask if dirty.
3. Offer stash or branch isolation.
4. Record branch/HEAD/dirty state in the plan trace.
Thanks @aviraldua93 for the idea. In the Oct 11 triage we grouped the open feature requests by theme so related asks get built together instead of one at a time. This one is part of the Planning reviews theme in TODOS.md (https://github.com/garrytan/gstack/blob/50d020ad9/TODOS.md#L54-L69). Closing it here so the open list stays actionable; it isn't rejected, and the theme credits every linked reporter when it's picked up.
Reopened under the parked label: this is tracked in the Planning reviews theme in TODOS.md (https://github.com/garrytan/gstack/blob/main/TODOS.md#p3-feature-themes-from-the-wave-9-triage-filed-2026-10-11), and what fixes it is the next plan-review wave (/office-hours, /plan-*-review, /autoplan), which takes the theme as a whole. Closed-but-tracked read as closed, so parked issues now stay open until they ship, are duplicates, or are declined (https://github.com/garrytan/gstack/blob/main/docs/triage.md).
Thanks for raising this, @aviraldua93. Stashing or branching people's work around a 30-minute run can strand their changes, which is riskier than the problem it solves. Closing as not planned.