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:
- 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
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.
Goal
Developers get relevant error message and actionable suggestion when
init -mfails because the Github URL is private or in an EMU repo and theghCLI is not authorized for that organization.Context
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
ghby 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 loginand 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
Acceptance Criteria
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.