You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Greptile caught this bug in PR #2185 while reviewing a copy of this same fallback pattern added to `/sweep`. `.claude/skills/resolve/SKILL.md` has the identical, pre-existing flaw in 2 places (lines 62 and 81):
Two issues with the fallback (only exercised when `gh repo view` fails, e.g. `gh` unauthenticated):
Retains the `.git` suffix. The greedy `(.+)` capture swallows `.git` before the optional `(.git)?` group ever gets a chance to match it, so a standard `https://github.com/owner/repo.git\` or `git@github.com:owner/repo.git` remote resolves to `owner/repo.git` instead of `owner/repo` — every subsequent `gh --repo` call in the skill then targets an invalid slug.
Silently accepts non-GitHub remotes. When `origin` isn't a `github.com` URL at all, plain `sed 's|pattern|replacement|'` leaves a non-matching line unchanged, so the raw (wrong) URL is returned as $REPO — non-empty, so the existing `if [ -z "$REPO" ]` guard doesn't catch it, and the skill proceeds with a garbage repo identifier instead of failing loudly.
Suggested fix
Mirror the fix applied to `/sweep` in PR #2185 — a two-pass `sed`, since non-greedy quantifiers aren't POSIX ERE (confirmed: `+?` errors on both BSD sed's `-E` and is not GNU-portable either):
The first pass only prints (`-n ... p`) when the URL is a genuine `github.com` remote, so a non-GitHub `origin` correctly produces empty output (caught by the existing `-z` guard) instead of passing through unchanged. The second pass unconditionally strips a trailing `.git`, sidestepping the greedy-capture problem entirely.
Filed separately per scope-discipline convention — out of scope for #1966 (which covered the hardcoded-wrong-repo-name bug, not this regex correctness issue), and `/resolve` wasn't touched by PR #2185's diff.
Activity
fix: harden /sweep's repo-detection fallback regex (Greptile, #1966)
fix(skills): derive repo slug dynamically in /sweep instead of hardco…
fix(skills): resolve's repo-detection fallback regex retains .git suf…