Skip to content

fix: remove -e shorthand from AI extensions to resolve reserved flag collision#7741

Open
jongio wants to merge 2 commits intomainfrom
fix/remove-e-shorthand
Open

fix: remove -e shorthand from AI extensions to resolve reserved flag collision#7741
jongio wants to merge 2 commits intomainfrom
fix/remove-e-shorthand

Conversation

@jongio
Copy link
Copy Markdown
Member

@jongio jongio commented Apr 15, 2026

Summary

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, and the -e shorthand for --environment in azure.ai.agents, eliminating the collision with azd's reserved global -e/--environment flag.

Users must use --project-endpoint (or --environment) instead.

Related

Changes

File Change
extensions/azure.ai.models/internal/cmd/init.go StringVarPStringVar, removed ShorthandDeprecated
extensions/azure.ai.models/internal/cmd/custom.go StringVarPStringVar, removed ShorthandDeprecated
extensions/azure.ai.finetune/internal/cmd/init.go StringVarPStringVar, removed ShorthandDeprecated
extensions/azure.ai.finetune/internal/cmd/operations.go StringVarPStringVar, removed ShorthandDeprecated
extensions/azure.ai.agents/internal/cmd/init.go Removed -e shorthand from --environment flag
extensions/azure.ai.models/CHANGELOG.md Updated deprecation entry → removal entry

Testing

  • All three extensions build clean
  • No behavioral change for users already using --project-endpoint / --environment long form

…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>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 -e shorthand for --project-endpoint in azure.ai.models and azure.ai.finetune by switching StringVarPStringVar.
  • Removed -e shorthand for --environment in 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.

Comment thread cli/azd/extensions/azure.ai.agents/internal/cmd/init.go
Comment on lines +95 to 96
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)")
Copy link

Copilot AI Apr 15, 2026

Choose a reason for hiding this comment

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

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).

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

-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.

@github-actions
Copy link
Copy Markdown

📋 Milestone: April 2026

This work is tracked for April 2026. The team will review it soon!

Copy link
Copy Markdown
Member

@spboyer spboyer left a comment

Choose a reason for hiding this comment

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

2 findings (0 HIGH, 2 MEDIUM, 0 LOW)

Clean mechanical change - StringVarP to StringVar with ShorthandDeprecated cleanup is correct in all six files. Two documentation gaps noted below.

Comment thread cli/azd/extensions/azure.ai.models/CHANGELOG.md Outdated
Comment thread cli/azd/extensions/azure.ai.models/CHANGELOG.md
Comment thread cli/azd/extensions/azure.ai.models/CHANGELOG.md Outdated
Copy link
Copy Markdown
Member

@trangevi trangevi left a comment

Choose a reason for hiding this comment

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

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>
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.

azd model custom create failing with latest Azd Version

5 participants