Skip to content

fix: allow Unicode letters in branch name validation - #1025

Closed
Jah-yee wants to merge 4 commits into
anthropics:mainfrom
Jah-yee:fix/unicode-branch-names
Closed

fix: allow Unicode letters in branch name validation#1025
Jah-yee wants to merge 4 commits into
anthropics:mainfrom
Jah-yee:fix/unicode-branch-names

Conversation

@Jah-yee

@Jah-yee Jah-yee commented Mar 6, 2026

Copy link
Copy Markdown

Summary

This PR adds multiple fixes for branch validation and permission checking:

1. Unicode Branch Names (#1020)

  • Allows branch names with Unicode characters (e.g., Japanese like 機能/fix)
  • Uses Unicode property escapes (\p{L} for letters, \p{N} for numbers)

2. Azure DevOps # Character (#1024)

  • Allows # in branch names for Azure DevOps ticket linking
  • Azure DevOps uses # for ticket linking (e.g., feature/AB#1992-sentry)

3. Shell Comment Stripping (#1019)

  • Strips lines starting with # before parsing claude_args
  • Allows users to add documentation comments without breaking flags

4. Copilot Permission Check (#1018)

  • Adds Copilot to the bypass list for permission checking
  • Copilot-initiated workflows return 404 for user permission lookup

Changes

  • Modified validPattern regex for Unicode and # support
  • Added comment stripping in parseClaudeArgsToExtraArgs()
  • Added Copilot check alongside [bot] accounts

Related

Fixes #1020, Fixes #1024, Fixes #1019, Fixes #1018

Jah-yee added 4 commits March 7, 2026 02:57
Previously, validateBranchName only allowed ASCII alphanumeric characters,
rejecting valid Unicode branch names (e.g., Japanese characters).

This fix uses Unicode property escapes (\p{L} for letters, \p{N} for numbers)
to allow valid Unicode branch names while still blocking dangerous characters.

Fixes: anthropics#1020
Azure DevOps uses # for ticket linking in branch names (e.g., feature/AB#1992).
This fix adds # to the allowed characters in branch name validation.

Fixes: anthropics#1024
shell-quote treats # as a comment character, causing all content after
a comment line to be swallowed.

This fix strips lines starting with # before passing to parseShellArgs,
so users can add documentation comments to their claude_args without
breaking subsequent flags.

Fixes: anthropics#1019, anthropics#802
checkWritePermissions() calls repos.getCollaboratorPermissionLevel()
with github.actor as username. When actor is Copilot (from Copilot-
initiated pull_request_review), the API returns 404 because Copilot
is not a regular GitHub user.

This fix adds Copilot to the bypass list alongside [bot] accounts.

Fixes: anthropics#1018

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

LGTM.

@Jah-yee

Jah-yee commented Jul 6, 2026

Copy link
Copy Markdown
Author

👋 Hi! Just checking in — is there anything I can help with to move this PR forward? Happy to address any feedback! 🙏

@Jah-yee

Jah-yee commented Jul 6, 2026

Copy link
Copy Markdown
Author

👍 Looks good to merge — clean fix, thanks for contributing!

@Jah-yee

Jah-yee commented Jul 13, 2026

Copy link
Copy Markdown
Author

Hi @ALL, gentle reminder that this PR is waiting for review. Happy to make any changes — just let me know! 🙏

@Jah-yee

Jah-yee commented Jul 13, 2026

Copy link
Copy Markdown
Author

Thanks for this contribution! Bumping for visibility.

@Jah-yee

Jah-yee commented Jul 13, 2026

Copy link
Copy Markdown
Author

Would it be possible to merge this PR? Happy to make any adjustments if needed. Thank you for your time!

@Jah-yee

Jah-yee commented Jul 13, 2026

Copy link
Copy Markdown
Author

➿ bump (R337)

@ashwin-ant

Copy link
Copy Markdown
Collaborator

Thanks for the effort here, but this bundles four unrelated changes into one PR, which makes it hard to review or land, and a couple of the pieces overlap other open PRs.

One part also can't go in as written: the actor === "Copilot" check in checkWritePermissions runs before the collaborator permission check and before any allowed_bots opt-in, so it grants write access on a bare actor name. We removed that exact pattern deliberately in #1330 and don't want it back.

If you'd like to pursue any of the individual fixes, please open them as separate, focused PRs (without the Copilot check).

@ashwin-ant ashwin-ant closed this Jul 16, 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

3 participants