Skip to content

Show ruleset violation details when create_branch fails - #3081

Open
Hashim1999164 wants to merge 1 commit into
github:mainfrom
Hashim1999164:fix/create-branch-ruleset-errors
Open

Show ruleset violation details when create_branch fails#3081
Hashim1999164 wants to merge 1 commit into
github:mainfrom
Hashim1999164:fix/create-branch-ruleset-errors

Conversation

@Hashim1999164

@Hashim1999164 Hashim1999164 commented Aug 16, 2026

Copy link
Copy Markdown

Summary

  • create_branch currently returns a compact 422 dump when a repository rule rejects the new name
  • Tool errors now include each nested validation message and the docs URL so agents can recover the way the GitHub UI already explains the rule

Why

Fixes #3080

What changed

  • Format github.ErrorResponse in NewGitHubAPIErrorResponse so nested error messages are visible
  • Cover a ruleset style 422 in the create_branch tests

MCP impact

  • Tool schema or behavior changed
    Error text for GitHub REST failures now includes nested validation messages. Tool schema is unchanged.

Prompts tested (tool changes only)

  • Create a branch named hotfix in a repo whose ruleset requires feature/* and confirm the tool error names the pattern

Security / limits

  • No security or limits impact

Tool renaming

  • I am not renaming tools as part of this PR

Lint & tests

  • Linted locally with ./script/lint
  • Tested locally with ./script/test

Docs

  • Not needed

create_branch currently forwards the compact 422 dump, which hides
ruleset details the GitHub UI already shows. Unwrap ErrorResponse so agents
can see each validation message and recover.
@Hashim1999164
Hashim1999164 requested a review from a team as a code owner August 16, 2026 12:17
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.

create_branch branch tool fails with generic message when rule is violated oppose to the Github UI

1 participant