Skip to content

fix: allow @ in branch names (used by Gastown and other multi-agent tools)#1305

Open
jerhinesmith wants to merge 1 commit into
anthropics:mainfrom
jerhinesmith:fix/allow-at-in-branch-names
Open

fix: allow @ in branch names (used by Gastown and other multi-agent tools)#1305
jerhinesmith wants to merge 1 commit into
anthropics:mainfrom
jerhinesmith:fix/allow-at-in-branch-names

Conversation

@jerhinesmith
Copy link
Copy Markdown

Problem

validateBranchName uses a strict character whitelist that excludes @, causing the action to fail on PRs from branches like polecat/nux/bo-gpl@moxcd5jj with:

Invalid branch name: "polecat/nux/bo-gpl@moxcd5jj". Branch names must start with an alphanumeric character and contain only alphanumeric characters, forward slashes, hyphens, underscores, periods, hashes (#), or plus signs (+).

Context

Multi-agent orchestration tools like Gastown generate branch names of the form polecat/<name>/<project>@<sessionid>, where @ separates a task name from a unique session ID. Engineers using these tools open PRs from these branches and see the review job fail immediately.

Fix

Add @ to the whitelist pattern. The @{ sequence (git reflog syntax) is still explicitly rejected by its own dedicated check later in the function — this PR doesn't touch that. Bare @ carries no injection risk since all git calls use execFileSync (not shell interpolation), which is the same rationale used when + was added in #1248 and # was added in #1167.

Before:

const validPattern = /^[a-zA-Z0-9][a-zA-Z0-9/_.#+-]*$/;

After:

const validPattern = /^[a-zA-Z0-9][a-zA-Z0-9/_.#+@-]*$/;

Changes

  • src/github/operations/branch.ts — add @ to whitelist; update comment and error message
  • test/validate-branch-name.test.ts — add test cases for @-containing branch names

…ools)

Multi-agent orchestration tools like Gastown generate branch names of the
form "polecat/name/project@sessionid", where "@" separates a task name from
a session ID. The strict whitelist in validateBranchName rejected these names
with "Invalid branch name", causing claude-code-action to fail on any PR
opened from such a branch.

The "@{" sequence (git reflog syntax) is still explicitly rejected by the
dedicated check that follows. Bare "@" carries no injection risk since all
git calls use execFileSync, not shell interpolation — the same rationale
used when "+" and "#" were added to the allowlist.

Fixes branches like: polecat/nux/bo-gpl@moxcd5jj

References:
- Gastown: https://github.com/gastownhall/gastown
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