diff --git a/.agents/skills/gstack-ship/SKILL.md b/.agents/skills/gstack-ship/SKILL.md index ed8147ce..08e7f063 100644 --- a/.agents/skills/gstack-ship/SKILL.md +++ b/.agents/skills/gstack-ship/SKILL.md @@ -611,10 +611,14 @@ Use AskUserQuestion: - Continue with the workflow — treat the pre-existing failure as non-blocking. **If "Blame + assign GitHub issue" (collaborative only):** -- Find who last modified the failing area: +- Find who likely broke it. Check BOTH the test file AND the production code it tests: ```bash + # Who last touched the failing test? git log --format="%an (%ae)" -1 -- + # Who last touched the production code the test covers? (often the actual breaker) + git log --format="%an (%ae)" -1 -- ``` + If these are different people, prefer the production code author — they likely introduced the regression. - Create a GitHub issue assigned to that person: ```bash gh issue create \ diff --git a/bin/gstack-repo-mode b/bin/gstack-repo-mode index be44feba..0c9ce904 100755 --- a/bin/gstack-repo-mode +++ b/bin/gstack-repo-mode @@ -12,7 +12,8 @@ set -euo pipefail SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" -eval $("$SCRIPT_DIR/gstack-slug" 2>/dev/null) || { echo "REPO_MODE=unknown"; exit 0; } +# Compute SLUG directly (avoid eval of gstack-slug — branch names can contain shell metacharacters) +SLUG=$(git remote get-url origin 2>/dev/null | sed 's|.*[:/]\([^/]*/[^/]*\)\.git$|\1|;s|.*[:/]\([^/]*/[^/]*\)$|\1|' | tr '/' '-') [ -z "${SLUG:-}" ] && { echo "REPO_MODE=unknown"; exit 0; } # Validate: only allow known values (prevent shell injection via source <(...)) @@ -39,7 +40,9 @@ if [ -f "$CACHE_FILE" ]; then fi # Compute from git history (90-day window) -SHORTLOG=$(git shortlog -sn --since="90 days ago" --no-merges HEAD 2>/dev/null | head -20) +# Use default branch (not HEAD) to avoid feature-branch sampling bias +DEFAULT_BRANCH=$(git symbolic-ref refs/remotes/origin/HEAD 2>/dev/null | sed 's|refs/remotes/||' || echo "origin/main") +SHORTLOG=$(git shortlog -sn --since="90 days ago" --no-merges "$DEFAULT_BRANCH" 2>/dev/null | head -20) if [ -z "$SHORTLOG" ]; then echo "REPO_MODE=unknown" exit 0 diff --git a/scripts/gen-skill-docs.ts b/scripts/gen-skill-docs.ts index 820671a6..ce33035a 100644 --- a/scripts/gen-skill-docs.ts +++ b/scripts/gen-skill-docs.ts @@ -353,10 +353,14 @@ Use AskUserQuestion: - Continue with the workflow — treat the pre-existing failure as non-blocking. **If "Blame + assign GitHub issue" (collaborative only):** -- Find who last modified the failing area: +- Find who likely broke it. Check BOTH the test file AND the production code it tests: \`\`\`bash + # Who last touched the failing test? git log --format="%an (%ae)" -1 -- + # Who last touched the production code the test covers? (often the actual breaker) + git log --format="%an (%ae)" -1 -- \`\`\` + If these are different people, prefer the production code author — they likely introduced the regression. - Create a GitHub issue assigned to that person: \`\`\`bash gh issue create \\ diff --git a/ship/SKILL.md b/ship/SKILL.md index 692bcb75..24941c0a 100644 --- a/ship/SKILL.md +++ b/ship/SKILL.md @@ -621,10 +621,14 @@ Use AskUserQuestion: - Continue with the workflow — treat the pre-existing failure as non-blocking. **If "Blame + assign GitHub issue" (collaborative only):** -- Find who last modified the failing area: +- Find who likely broke it. Check BOTH the test file AND the production code it tests: ```bash + # Who last touched the failing test? git log --format="%an (%ae)" -1 -- + # Who last touched the production code the test covers? (often the actual breaker) + git log --format="%an (%ae)" -1 -- ``` + If these are different people, prefer the production code author — they likely introduced the regression. - Create a GitHub issue assigned to that person: ```bash gh issue create \