Skip to content

fix: fall back to dirname/unknown when git context is absent - #564

Closed
collinstraka-clov wants to merge 1 commit into
garrytan:mainfrom
collinstraka-clov:fix/gstack-slug-unbound-variable
Closed

collinstraka-clov wants to merge 1 commit into
garrytan:mainfrom
collinstraka-clov:fix/gstack-slug-unbound-variable

Conversation

@collinstraka-clov

Copy link
Copy Markdown
Contributor

Problem

gstack-review-log uses set -euo pipefail, which treats empty strings as unbound variables. When run outside a git repo (or in a repo with no remote configured), gstack-slug produces empty strings for SLUG and BRANCH, causing:

gstack-review-log: line 8: SLUG: unbound variable
gstack-review-log: line 9: BRANCH: unbound variable

This breaks any gstack review skill (e.g. /autoplan, /plan-ceo-review) when the working directory isn't a git repo with a remote.

Fix

Two changes in gstack-slug:

  1. Add || true to the git commands so set -e doesn't abort when git context is missing
  2. Fall back to basename "$PWD" for SLUG and "unknown" for BRANCH when the values are empty

Repro

Run any gstack review skill in a directory with no git remote configured.

🤖 Generated with Claude Code

gstack-review-log uses set -euo pipefail, which treats empty strings as
unbound variables. When run outside a git repo (or in a repo with no
remote), gstack-slug produced empty SLUG and BRANCH, causing:

  gstack-review-log: line 8: SLUG: unbound variable
  gstack-review-log: line 9: BRANCH: unbound variable

Fix: add || true to prevent set -e from aborting on git failures, then
fall back to the current directory name for SLUG and "unknown" for BRANCH.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@time-attack

Copy link
Copy Markdown
Contributor

@16francej Please close this PR. Current main already handles missing Git context and includes stronger safe slug caching. This branch targets the old helper, so its useful idea has already been incorporated.

@capy-ai

capy-ai Bot commented Oct 3, 2026

Copy link
Copy Markdown
Contributor

Thanks for this, @collinstraka-clov. The fix is now on main: bin/gstack-slug was rewritten with basename and username fallbacks (already on main as of v1.91.16.0). Closing as superseded; if you still see the problem on the latest gstack, please open an issue with ./setup --status output.

@capy-ai capy-ai Bot closed this Oct 3, 2026
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.

2 participants