Skip to content

Remove dead COBO code from azure.ai.agents extension; guard postdeploy handler with ShouldRun#7373

Draft
Copilot wants to merge 2 commits intomainfrom
copilot/investigate-fix-7201-7344
Draft

Remove dead COBO code from azure.ai.agents extension; guard postdeploy handler with ShouldRun#7373
Copilot wants to merge 2 commits intomainfrom
copilot/investigate-fix-7201-7344

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 27, 2026

The postdeployHandler in the azure.ai.agents extension called EnsureAgentIdentityRBAC() without checking whether the project actually uses agents. This caused AZURE_AI_PROJECT_ID not set errors in projects that have the extension installed but no agent services. Separately, the entire COBO flow (~1130 lines) was dead code that no longer functions.

Bug fix (#7344)

Added a ShouldRun guard in postdeployHandler so EnsureAgentIdentityRBAC is skipped for non-agent projects:

func postdeployHandler(ctx context.Context, projectParser *project.FoundryParser, args *azdext.ProjectEventArgs) error {
	shouldRun, err := project.ShouldRun(ctx, args.Project)
	if err != nil {
		return fmt.Errorf("failed to determine if extension should run: %w", err)
	}
	if !shouldRun {
		return nil
	}
	// ...
}

Dead code removal (#7201)

  • parser.go: Removed SetIdentity, CoboPostDeploy, all COBO types (AgentRegistrationPayload, AgentDefinition, etc.), and 12+ helper functions (assignAzureAIRole, registerAgent, deactivateHelloWorldRevision, testDataPlane, etc.). File went from 1197 → 66 lines.
  • listen.go: Removed SetIdentity() calls from preprovisionHandler/predeployHandler, simplified their signatures. Replaced CoboPostDeploy + EnsureAgentIdentityRBAC with just the latter behind ShouldRun.
  • go.mod: Dropped unused deps armappcontainers and armresources.
  • Exported ShouldRun (was shouldRun) so the cmd package can call it directly.

Copilot AI and others added 2 commits March 27, 2026 22:41
Fixes #7201: Remove dead COBO code from parser.go including SetIdentity,
CoboPostDeploy, agent registration, hello-world revision management, and
all associated helper functions and types (~1130 lines removed).

Fixes #7344: Add ShouldRun guard in postdeployHandler so
EnsureAgentIdentityRBAC only runs for projects with hosted agents,
preventing spurious errors in non-agent projects.

Also removes unused SetIdentity calls from preprovision/predeploy
handlers and cleans up unused go.mod dependencies (armappcontainers,
armresources).

Agent-Logs-Url: https://github.com/Azure/azure-dev/sessions/6dcf2a05-05ea-4a1b-a135-6a0e42cbbb1a

Co-authored-by: JeffreyCA <9157833+JeffreyCA@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.

2 participants