feat: delegate azure.ai.project ownership - #10030
Hui Miao (huimiu) wants to merge 34 commits into
Conversation
|
Azure Pipelines: Successfully started running 2 pipeline(s). 20 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
Glenn Harper (glharper)
left a comment
There was a problem hiding this comment.
Two additional correctness issues in #10030 are not covered by the existing comments.
There was a problem hiding this comment.
🟡 Changes recommended
Headless adoption can replace an existing project configuration, and model-only deployment delegation can fail on ambiguous catalog candidates.
Get a fresh assessment by requesting another Copilot review.
Review details
Suppressed comments (1)
Previously missed (1) — in code that hasn't changed since the last review.
cli/azd/extensions/azure.ai.agents/internal/cmd/init_adopt.go:767
- This delegates only the model name, but
authorFoundryDeploymentsalways adds--no-prompt. The Projects command rejects a model-only request whenever multiple version/SKU candidates exist, so the documented headless--model <name>adoption flow will fail for common models. Resolve a complete deployment tuple before delegation, or propagate the caller's prompt mode and let Projects select the candidate interactively.
- Files reviewed: 33/33 changed files
- Comments generated: 1
- Review effort level: Balanced
There was a problem hiding this comment.
🟡 Changes recommended
Delegated authoring can lose the selected model default and break deferred no-prompt adoption with --model.
Get a fresh assessment by requesting another Copilot review.
Review details
Suppressed comments (3)
Previously missed (2) — in code that hasn't changed since the last review.
cli/azd/extensions/azure.ai.projects/internal/cmd/project_add.go:1430
- This condition also handles a changed endpoint when no project ID is being cleared, so the error currently gives the wrong reason for that path. Use wording that covers both endpoint replacement and identity clearing.
cli/azd/extensions/azure.ai.projects/internal/cmd/project_deployment_reconcile.go:29 - The added tests never call
reconcileAdoptedDeployments; they cover onlyexpandDeploymentandprojectAddMutation. This leaves the new Azure paging, no-prompt matching, prompt choices, service mutation, default selection, and rollback behavior unverified. Add focused tests with injectable deployment-list behavior, including failures after the service update.
cli/azd/extensions/azure.ai.agents/internal/cmd/project_workflow.go:118
azd ai project add --new-projectclearsAZURE_AI_MODEL_DEPLOYMENT_NAMEas project-bound state, but this preservation list omits it. The agent flow records the first selected deployment before calling this helper; with multiple deployments, the subsequent delegateddeployment addcalls each set themselves as default, so the last deployment silently replaces the intended first default. Preserve this key across project authoring, and add a regression case that starts with multiple selected deployments.
var newProjectEnvironmentKeys = []string{
"AZURE_AI_PROJECT_NAME",
"AZURE_RESOURCE_GROUP",
"AZURE_AI_ACCOUNT_NAME",
"AZURE_LOCATION",
"AZURE_AI_DEPLOYMENTS_LOCATION",
}
- Files reviewed: 33/33 changed files
- Comments generated: 1
- Review effort level: Balanced
There was a problem hiding this comment.
🟡 Changes recommended
The declared Projects dependency lacks the required flag, and cancellation and lint issues remain.
Get a fresh assessment by requesting another Copilot review.
Review details
Suppressed comments (3)
Previously missed (2) — in code that hasn't changed since the last review.
cli/azd/extensions/azure.ai.projects/internal/cmd/project_deployment_reconcile.go:198
- Cancellation from this new prompt is wrapped as a generic error, unlike the other Projects prompt paths. Pressing Ctrl+C here therefore loses the structured
cancelledclassification. Detectexterrors.IsCancellationbefore wrapping it.
cli/azd/extensions/azure.ai.projects/internal/cmd/project_add.go:1430 - This branch also runs when the endpoint changes and
AZURE_AI_PROJECT_IDis empty, so “while clearing project identity” reports the wrong cause for that path. Mention both endpoint replacement and identity clearing.
cli/azd/extensions/azure.ai.agents/extension.yaml:14
- The published Projects
beta.10tag does not define--new-project, but the new Agents workflow always passes that flag for new-project initialization. Keepingbeta.10as the allowed lower bound means a packaged Agents build can resolve a compatible dependency and then fail with an unknown flag. Require the first published Projects version containing the flag before this dependency contract ships.
version: "~1.0.0-beta.10"
- Files reviewed: 33/33 changed files
- Comments generated: 1
- Review effort level: Balanced
There was a problem hiding this comment.
🔵 Needs a closer look
Multi-deployment authoring can incorrectly leave the final deployment as the default after project replacement.
Review details
Suppressed comments (1)
cli/azd/extensions/azure.ai.agents/internal/cmd/project_workflow.go:260
- When the project workflow has cleared the old default (for example,
--new-projectreplacing an existing project),defaultNameis empty. Each nesteddeployment addmakes its deployment the default, so this early return leaves the last deployment asAZURE_AI_MODEL_DEPLOYMENT_NAME; the Agents flow otherwise defines the first deployment as the default. Fall back to the first requested deployment before running the batch, and add a regression case with no initial default.
defaultName = strings.TrimSpace(defaultName)
restoreDefault := func() error {
if defaultName == "" {
return nil
}
- Files reviewed: 33/33 changed files
- Comments generated: 0 new
- Review effort level: Balanced
There was a problem hiding this comment.
🔵 Needs a closer look
Adoption can retain unintended deployments, lose prior interactive choices, and restore stale deployment defaults.
Review details
Suppressed comments (3)
Previously missed (3) — in code that hasn't changed since the last review.
cli/azd/extensions/azure.ai.agents/internal/cmd/init_adopt.go:609
- The delegated
project addruns before--model-deploymentis handled. It therefore reconciles every deployment already declared in the adoptedazure.yamland may prompt for or retain unmatched declarations;configureAdoptedExistingDeploymentlater only changes the environment default. Previously, an explicit--model-deploymentskipped that loop and removed all managed declarations, so this ordering can unexpectedly provision additional models. Skip project deployment reconciliation for this flag or clear the declarations through the Projects owner before authoring.
cli/azd/extensions/azure.ai.projects/internal/cmd/project_add.go:315 - This rediscovery still expands the service with the
oldValuescaptured beforereconcileProjectEnvironmentWithRollback. On a project replacement, a deployment name such as${AZURE_AI_MODEL_DEPLOYMENT_NAME}can therefore resolve to the old project’s deployment; becauseeffectiveValuescorrectly shows that key as cleared, the following branch writes the stale name back into the new environment. Refresh the reconciler witheffectiveValuesbefore rediscovering the service.
cli/azd/extensions/azure.ai.projects/internal/cmd/project_deployment_reconcile.go:159 - Interactive adoption no longer preserves the previous no-match flow. When no live deployment uses this model, this branch silently keeps the declaration and proceeds to provision it, whereas the removed Agents flow prompted the user to deploy it, choose another model, or skip it. That can create a model the user did not confirm and contradicts the stated goal of preserving adoption behavior; restore the deploy/change/skip prompt when
noPromptis false.
- Files reviewed: 33/33 changed files
- Comments generated: 0 new
- Review effort level: Balanced
There was a problem hiding this comment.
🟡 Changes recommended
Endpoint-only deployment retention and adopted --model-deployment handling can fail provisioning or create unintended resources.
Get a fresh assessment by requesting another Copilot review.
Review details
- Files reviewed: 31/31 changed files
- Comments generated: 2
- Review effort level: Balanced
azure.ai.agents PR buildNote This is an unsigned development build. Install it only if you trust this PR. Install the extension: azd ext install "https://azuresdkartifacts.z5.web.core.windows.net/azd/extensions/pr/10030/azure-ai-agents.zip"
|
azure.ai.projects PR buildNote This is an unsigned development build. Install it only if you trust this PR. Install the extension: azd ext install "https://azuresdkartifacts.z5.web.core.windows.net/azd/extensions/pr/10030/azure-ai-projects.zip"
|
Azure Dev CLI Install InstructionsInstall scriptsMacOS/Linux
bash: pwsh: WindowsPowerShell install MSI install Standalone Binary
MSI
Documentationlearn.microsoft.com documentationtitle: Azure Developer CLI reference
|
Summary
Move ownership of the
azure.ai.projectservice block to the Projects extension while keeping the existing Agents initialization and adoption flows. Agents now use the public Projects commands for project and deployment authoring and only add the resulting project service to the agent'suseslist.This change deliberately leaves azd Core cwd and WorkflowService cancellation behavior unchanged. Delegated authoring supports the normal flow from the project root. A top-level relative
--cwdmay still resolve incorrectly in the nested Projects command, and cancellation may still surface asproject_authoring_failed. Those Core changes are outside this PR so the extension work does not depend on an unreleased azd version.Changes
WorkflowService$refbehavior without mutating the project service from Agentsazure.ai.projectsbeta.10, which contains the public project authoring commands used by Agents--cwduseswiring, ownership boundaries, repeated initialization, existing manifests,$reffiles, and failure handling$refinitialization--new-projectflag used by new-project delegation. Publish a Projects version containing that flag first, then raise the Agents dependency lower bound to that released version in the follow-up release update before publishing Agents.