Skip to content
This repository was archived by the owner on Apr 19, 2026. It is now read-only.

fix(issue-worker): avoid double prefix on conventional-commit titles#135

Merged
jpleva91 merged 1 commit intomainfrom
fix/issue-worker-double-prefix
Apr 13, 2026
Merged

fix(issue-worker): avoid double prefix on conventional-commit titles#135
jpleva91 merged 1 commit intomainfrom
fix/issue-worker-double-prefix

Conversation

@jpleva91
Copy link
Copy Markdown
Contributor

Closes #134

Summary

  • scripts/issue-worker.sh unconditionally prepended fix: to PR titles and commit subjects, producing fix: feat: … when the source issue already carried a conventional-commit prefix (clawta#44/45/46).
  • Added a case statement matching known prefixes (feat|fix|chore|docs|test|refactor|perf|arch|build|ci|style|revert) and only prepend fix: when none is present. Same logic applied to the commit subject.

Test plan

  • bash -n scripts/issue-worker.sh passes
  • Next ForgeCode run on a feat: issue produces a single-prefix PR title

Do not auto-merge.

Generated with Claude Code

When an issue title already begins with a conventional-commit prefix
(feat:, fix:, chore:, etc.), the worker produced PR titles like
"fix: feat: …". Detect known prefixes via a case statement and only
prepend "fix: " when no convention is present. Same logic applied to
the commit subject.

Closes #134

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings April 13, 2026 21:12
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the ForgeCode issue worker to prevent generating PR titles (and commit subjects) with duplicated Conventional Commit prefixes when the source issue title already includes one.

Changes:

  • Adds a case-based prefix detector for known Conventional Commit types.
  • Uses computed pr_title for gh pr create --title and commit_subject for git commit -m.

Comment thread scripts/issue-worker.sh
Comment on lines +177 to +178
pr_title="$title"
commit_subject="address #${num} — ${title}" ;;
Copy link

Copilot AI Apr 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the prefixed-title branch, commit_subject becomes address #N — ${title}, which no longer starts with a Conventional Commit type and also embeds the type later in the subject (e.g., address #1 — feat: ...). If commit messages are expected to be Conventional Commits (see CONTRIBUTING.md), consider extracting the existing type[(scope)] prefix from title and using it at the start of commit_subject (and strip it from the remainder), so the subject stays feat(...): address #N — <rest> / fix(...): ... etc.

Suggested change
pr_title="$title"
commit_subject="address #${num}${title}" ;;
local commit_prefix commit_remainder
if [[ "$title" =~ ^((fix|feat|chore|docs|test|refactor|perf|arch|build|ci|style|revert)(\([^)]+\))?:)[[:space:]]*(.*)$ ]]; then
commit_prefix="${BASH_REMATCH[1]}"
commit_remainder="${BASH_REMATCH[4]}"
else
commit_prefix="fix:"
commit_remainder="$title"
fi
pr_title="$title"
commit_subject="${commit_prefix} address #${num}${commit_remainder}" ;;

Copilot uses AI. Check for mistakes.
Comment thread scripts/issue-worker.sh
Comment on lines +173 to +182
# Avoid double-prefixing when the issue title already carries a
# conventional-commit prefix (closes chitinhq/shellforge#134).
case "$title" in
fix:*|feat:*|chore:*|docs:*|test:*|refactor:*|perf:*|arch:*|build:*|ci:*|style:*|revert:*)
pr_title="$title"
commit_subject="address #${num} — ${title}" ;;
*)
pr_title="fix: $title"
commit_subject="fix: address #${num} — ${title}" ;;
esac
Copy link

Copilot AI Apr 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pr_title and commit_subject are introduced as implicit globals here (not declared local inside work_issue). To avoid accidental leakage between iterations/calls and to match the existing style in this function, declare them as local pr_title commit_subject before the case statement.

Copilot uses AI. Check for mistakes.
@jpleva91 jpleva91 merged commit 199da43 into main Apr 13, 2026
10 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

issue-worker.sh: PR titles double-prefix when issue title already has conventional-commit tag

2 participants