Skip to content

[Issue] ai agent extension fails to init agent.yaml with failed to parse GitHub URL could not find a valid branch in url path #6646

@therealjohn

Description

@therealjohn

Goal

Developers get relevant error message and actionable suggestion when init -m fails because the Github URL is private or in an EMU repo and the gh CLI is not authorized for that organization.

Context

  • An agent manifest file might be stored in a private repo or EMU repo which causes a cryptic error about being unable to parse a GitHub URL. Here's an example image:
Image
  • Using --debug flag uncovers: gh: Resource protected by organization SAML enforcement. You must grant your Personal Access token access to this organization. (HTTP 403)

Desired behavior

Gracefully handle auth errors from gh by printing a structured error message like:
"The GitHub URL is protected by organization SAML enforcement. You must grant your Personal Access token access to this organization."

And provide an error suggestion like:

"Suggestion: Run gh auth login and select the Authorize button next to the organization that contains this repository. If you're using GITHUB_TOKEN to authenticate instead, modify the token in your GitHub settings by updating in the 'Configure SSO' setting for the correct organization."

Implementation Notes

  • Use structured errors and suggestions consistent with the rest of the codebase

Acceptance Criteria

  • Unit tests added or updated
  • Existing test suite passes
  • Lint and format passes

How to test

azd ai agent init -m "https://github.com/coreai-microsoft/hosted-agents-bugbash/blob/main/samples/python/agentserver-responses/background-agent/agent.manifest.yaml"

This repo requires an EMU account and should produce a relevant error message and suggestion without the proper authentication.

Metadata

Metadata

Labels

ext-agentsazure.ai.agents extension

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions