Skip to content

Stop gstack-uninstall deleting unpushed or kept work under any folder it removes (GST-2303) - #4282

Merged
capy-ai[bot] merged 6 commits into
mainfrom
uninstall-checks-every-folder-it-deletes
Nov 10, 2026
Merged

capy-ai[bot] merged 6 commits into
mainfrom
uninstall-checks-every-folder-it-deletes

Conversation

@garrytan

@garrytan garrytan commented Nov 10, 2026 •

Copy link
Copy Markdown
Owner

gstack-uninstall now checks every folder it is about to delete for git work that exists nowhere else, and stops instead of deleting it. This serves gstack's goal of being safe to install and remove: uninstalling should never cost you unpushed commits or kept state.

What changed

  • Before deleting anything, uninstall looks for git checkouts inside each host's gstack install (global and project-local), the gstack-made Claude per-skill folders and ~/.gstack. A checkout with uncommitted changes, commits no remote holds, or a locked worktree stops the uninstall with exit 2 and names the checkout.
  • --keep-state no longer deletes the state it promised to keep. An install that holds kept state is refused instead.
  • A stable-channel install that was updated with git fetch origin stable still uninstalls cleanly, including through a url.insteadOf rewrite. A commit that only a local fetch (git fetch . HEAD) wrote is still treated as unpushed.
  • On git older than 2.36, which cannot list worktrees safely, uninstall now refuses rather than guessing.
  • The manual removal steps in docs/uninstall.md use the same checks, and docs/troubleshooting.md explains each refusal.

Why

Uninstall used to check only the repo you ran it from. An unpushed .gstack repo inside ~/.claude/skills/gstack, an edited project-local install, or a notes repo under .agents/skills/gstack-* was deleted without warning, and --keep-state run from inside the gstack checkout deleted the very lanes it was told to keep.

Blast radius

Only bin/gstack-uninstall and its docs change, and every new path fails closed: when git cannot prove a checkout is safe, the folder is kept and uninstall exits 2. The 73 uninstall tests (including the docs-helper replays and an old-git shim) pass, and CI free-tests run 42789222890 is green at this head.

Documentation

Status: updated. One factual fix in docs/troubleshooting.md, with no blockers.

Scope: the 5 committed files between 6c23638 and 8eb1173 (bin/gstack-uninstall, test/uninstall.test.ts, docs/uninstall.md, docs/troubleshooting.md and the GST-2303 changelog.d fragment), plus the README.md and docs/install.md links to the uninstall doc. Nothing was staged, unstaged or untracked.

Documentation health:

  • docs/uninstall.md: Current. The every-folder check, the exit-2 refusals, the FETCH_HEAD and remote-URL matching, the --keep-state refusal and the git 2.36 requirement all match the script.
  • docs/troubleshooting.md: Updated. The git-cannot-read list now includes the has worktrees git cannot list (gstack-uninstall needs git 2.36 or later) message and its fix.
  • changelog.d/uninstall-checks-every-folder-it-deletes-gst-2303.md: Current.
  • README.md and docs/install.md: Current. Both still link to docs/uninstall.md.

Coverage: all shipped features have adequate documentation. The new refusals have reference coverage in docs/uninstall.md and how-to fixes in docs/troubleshooting.md. No diagrams drifted, so there is no documentation debt.

Test plan

Agent notes

GST-2303. Shipped by GSTA-508 for Captain GStack Minder (GSTA-36).

Pre-Landing Review: pass 1 and pass 2 (full, risk:security), a fix-check at f10dc27, Step 11 voices at f10dc27 (native Opus 5.5, outside GPT-6.1 Sol), and a granted fix-check at 8eb1173 (grant a-c68964597f88). The outside voice's blocking finding (the old-git fallback dropping a locked newline-named worktree) was fixed in 8eb1173 by removing the fallback.
REVIEW_LOOP: passes=2 blocking_found=4 deferred=0 noted=6 fixed=8 scope=frozen unbound=1 fix_checks=2 dispatches=8
Ruled note: bin/gstack-uninstall:415:fix-check at f10dc27 ruled by Captain GStack Minder (GSTA-36) at 2026-11-10T08:13:44.631Z: insteadOf false stop fixed mechanically in 07c9eb8 (git remote get-url --all); fail-closed; no further fix-check (approval a-63a5aedf8e9e)
Ruled note: changelog.d/uninstall-checks-every-folder-it-deletes-gst-2303.md:4:fix-check at 8eb1173 ruled by Captain GStack Minder (GSTA-36) at 2026-11-10T08:47:16.814Z: changelog fragment omits the git < 2.36 refusal; informational, fails closed, no data loss (approval a-70f3ec961a8e)
Ruled note: docs/uninstall.md:45:fix-check at 8eb1173 ruled by Captain GStack Minder (GSTA-36) at 2026-11-10T08:47:17.441Z: docs helper names the wrong reason on old git when it keeps the folder; informational, fails closed, no data loss (approval a-8a2dca98d546)
Ruled note: bin/gstack-uninstall:429:fix-check at 8eb1173 ruled by Captain GStack Minder (GSTA-36) at 2026-11-10T08:47:17.589Z: needs-git-2.36 message also shows for other -z list failures; informational, fails closed, no data loss (approval a-855e69d96f3e)

Open notes (not blocking):

  • FETCH_HEAD trust does not expire after a remote force-push (native voice, Low).
  • FETCH_HEAD tokens are passed to rev-list without a sha check (native voice, Low).
  • _worktree_list can print twice when -z output is partial and git exits non-zero (native voice, Low).
  • Two uninstall tests run close to Bun's 5 s default on a 1-CPU machine; CI was green.

Approvals

Approved: yes (record r-9f11d4a0b950). The full approval record stays private.
Plan: exempt: bug fix
Plan check: exempt bug fix

Agent notes
{
  "schema_version": 1,
  "pr": 4282,
  "head": "d8ac45125d5d7f18e5eb485fbcac6570fc7018bc",
  "version": "1.99.0.0",
  "base": "main",
  "gate": {
    "tests": {
      "pass": 37096,
      "fail": 0,
      "skip": 0
    }
  },
  "ci_carried": [
    {
      "lane": "tests",
      "run": 42789222890,
      "attempt": 1,
      "tree": "354c5f2880aa46722a435882c765236539571767"
    }
  ],
  "session_kind": "unattended",
  "head_tree": "354c5f2880aa46722a435882c765236539571767",
  "product_patch_id": "13f32cf5a5866e7b6fcf068d428f6c1a7cec9543",
  "gstack_version": "1.99.0.0",
  "review_depth": {
    "depth": "full",
    "class": "code",
    "runtime_lines": 343,
    "rules": "66e5174161eecc2c",
    "base": "6c23638d6dfd78d01191c37249de1d4785cdc9ed",
    "registry": "6c23638d6dfd78d01191c37249de1d4785cdc9ed",
    "gate_scan": {
      "tagged": 0,
      "head": "d8ac45125d5d7f18e5eb485fbcac6570fc7018bc"
    },
    "reasons": [
      "risk:security",
      "runtime=343"
    ],
    "risk": [
      "security"
    ],
    "mode": "panel"
  },
  "pregate": "pass @354c5f2880aa (8 checks, current for d8ac45125d5d)",
  "issues": {
    "fixes": [],
    "refs": [],
    "flakes": []
  },
  "docs": {
    "status": "updated",
    "scope": "docs/uninstall.md, docs/troubleshooting.md, the GST-2303 changelog.d fragment, README.md and docs/install.md"
  },
  "review_loop": {
    "passes": 2,
    "blocking_found": 4,
    "deferred": 0,
    "noted": 6,
    "fixed": 8,
    "scope": "frozen",
    "fix_checks": 2,
    "rounds": 4,
    "unbound": 1,
    "dispatches": {
      "specialist": 6,
      "red-team": 2
    }
  },
  "ruled_notes": [
    {
      "finding": "bin/gstack-uninstall:415:fix-check",
      "head": "f10dc271c9ef844a8a479ef091a68ecd7c5a03bb",
      "by": "Captain GStack Minder (GSTA-36)",
      "reason": "insteadOf false stop fixed mechanically in 07c9eb8 (git remote get-url --all); fail-closed; no further fix-check",
      "at": "2026-11-10T08:13:44.631Z",
      "approval": "a-63a5aedf8e9e"
    },
    {
      "finding": "changelog.d/uninstall-checks-every-folder-it-deletes-gst-2303.md:4:fix-check",
      "head": "8eb11739cfeeba376315f1110bba5787ef0d0446",
      "by": "Captain GStack Minder (GSTA-36)",
      "reason": "changelog fragment omits the git < 2.36 refusal; informational, fails closed, no data loss",
      "at": "2026-11-10T08:47:16.814Z",
      "approval": "a-70f3ec961a8e"
    },
    {
      "finding": "docs/uninstall.md:45:fix-check",
      "head": "8eb11739cfeeba376315f1110bba5787ef0d0446",
      "by": "Captain GStack Minder (GSTA-36)",
      "reason": "docs helper names the wrong reason on old git when it keeps the folder; informational, fails closed, no data loss",
      "at": "2026-11-10T08:47:17.441Z",
      "approval": "a-8a2dca98d546"
    },
    {
      "finding": "bin/gstack-uninstall:429:fix-check",
      "head": "8eb11739cfeeba376315f1110bba5787ef0d0446",
      "by": "Captain GStack Minder (GSTA-36)",
      "reason": "needs-git-2.36 message also shows for other -z list failures; informational, fails closed, no data loss",
      "at": "2026-11-10T08:47:17.589Z",
      "approval": "a-855e69d96f3e"
    }
  ]
}

… it removes (GST-2303)

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
@trunk-io

trunk-io Bot commented Nov 10, 2026 •

Copy link
Copy Markdown

😎 This pull request was merged.

garrytan and others added 5 commits November 10, 2026 07:46
…l installs, and read worktrees on git before 2.36 in gstack-uninstall (GST-2303)

Review-Finding: p1/red-team#1 reader=red-team
Review-Finding: p1/red-team#2 reader=red-team
Review-Finding: p1/red-team#3 reader=red-team
Review-Finding: p1/specialist-batched#1 reader=testing
Review-Finding: p1/specialist-batched#2 reader=testing
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
… checkout's remotes in gstack-uninstall (GST-2303)

Review-Finding: p2/specialist-batched#1 reader=security
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…tch FETCH_HEAD in gstack-uninstall (GST-2303)

Review-Finding: fc/fix-check#1 reader=fix-check
Review-Finding: fc/fix-check#2 reader=fix-check
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…es without -z (GST-2303)

Review-Finding: v11/outside-voice#1 reader=outside-voice
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
@capy-ai
capy-ai Bot merged commit 6b32714 into main Nov 10, 2026
81 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant