fix: remove -e shorthand from AI extensions to resolve reserved flag collision#7741
fix: remove -e shorthand from AI extensions to resolve reserved flag collision#7741
Conversation
…collision Completes the migration started in PR #7313 (which deprecated -e). Now fully removes the -e shorthand for --project-endpoint in azure.ai.models and azure.ai.finetune, eliminating the collision with azd's global -e/--environment flag. Users must use --project-endpoint instead. Also removes the -e shorthand for --environment on azure.ai.agents init subcommand, since it collides with the reserved short flag and the root command (or SDK) should provide -e/--environment globally. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Removes the -e shorthand flags from Azure AI extensions to avoid collisions with azd’s reserved global environment flag(s), completing the deprecation started in #7313.
Changes:
- Removed
-eshorthand for--project-endpointin azure.ai.models and azure.ai.finetune by switchingStringVarP→StringVar. - Removed
-eshorthand for--environmentin azure.ai.agents. - Updated azure.ai.models changelog entry to mark the change as breaking and explain the collision.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| cli/azd/extensions/azure.ai.models/internal/cmd/init.go | Drops -e shorthand for --project-endpoint on init. |
| cli/azd/extensions/azure.ai.models/internal/cmd/custom.go | Drops -e shorthand for --project-endpoint on custom commands. |
| cli/azd/extensions/azure.ai.models/CHANGELOG.md | Documents the breaking removal of -e for --project-endpoint. |
| cli/azd/extensions/azure.ai.finetune/internal/cmd/operations.go | Drops -e shorthand for --project-endpoint on fine-tune operations. |
| cli/azd/extensions/azure.ai.finetune/internal/cmd/init.go | Drops -e shorthand for --project-endpoint on fine-tune init. |
| cli/azd/extensions/azure.ai.agents/internal/cmd/init.go | Drops -e shorthand for --environment on agents init. |
| cmd.Flags().StringVar(&flags.projectEndpoint, "project-endpoint", "", | ||
| "Azure AI Foundry project endpoint URL (e.g., https://account.services.ai.azure.com/api/projects/project-name)") |
There was a problem hiding this comment.
After removing -e, users who still pass -e will get a generic "unknown shorthand" error from pflag/cobra. To make the breaking change easier to diagnose, consider adding a targeted flag parse error handler (e.g., via cmd.SetFlagErrorFunc) that detects -e usage and returns a clearer message pointing users to --project-endpoint (and/or explaining the azd reserved-flag collision).
There was a problem hiding this comment.
-e was deprecated in #7313 with ShorthandDeprecated giving users a clear migration warning for 3+ weeks. Cobra's default "unknown shorthand flag" error is informative enough at this point. Adding SetFlagErrorFunc to 5 commands across 3 extensions for one removed shorthand is disproportionate for the UX improvement.
📋 Milestone: April 2026This work is tracked for April 2026. The team will review it soon! |
trangevi
left a comment
There was a problem hiding this comment.
Approve for Agents extension
…ersion - azure.ai.models: new 0.0.6-preview entry for -e removal, restore deprecation note in 0.0.5-preview - azure.ai.finetune: new 0.0.18-preview entry for -e removal - azure.ai.agents: new 0.1.23-preview entry for -e removal Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Summary
Completes the migration started in PR #7313 (which deprecated
-e). Now fully removes the-eshorthand for--project-endpointin azure.ai.models and azure.ai.finetune, and the-eshorthand for--environmentin azure.ai.agents, eliminating the collision with azd's reserved global-e/--environmentflag.Users must use
--project-endpoint(or--environment) instead.Related
-ecollision bug)-e, merged)Changes
extensions/azure.ai.models/internal/cmd/init.goStringVarP→StringVar, removedShorthandDeprecatedextensions/azure.ai.models/internal/cmd/custom.goStringVarP→StringVar, removedShorthandDeprecatedextensions/azure.ai.finetune/internal/cmd/init.goStringVarP→StringVar, removedShorthandDeprecatedextensions/azure.ai.finetune/internal/cmd/operations.goStringVarP→StringVar, removedShorthandDeprecatedextensions/azure.ai.agents/internal/cmd/init.go-eshorthand from--environmentflagextensions/azure.ai.models/CHANGELOG.mdTesting
--project-endpoint/--environmentlong form