Skip to content

fix: add unified toolbox diagnostics - #9809

Open
Hui Miao (huimiu) wants to merge 7 commits into
mainfrom
hui/issue-8710-status
Open

fix: add unified toolbox diagnostics#9809
Hui Miao (huimiu) wants to merge 7 commits into
mainfrom
hui/issue-8710-status

Conversation

@huimiu

@huimiu Hui Miao (huimiu) commented Sep 1, 2026

Copy link
Copy Markdown
Member

Why this change is needed

Agents can declare bundled toolboxes in unified azure.yaml, while older projects still use agent.manifest.yaml. Next-step and Doctor previously did not represent those sources consistently, so missing endpoints and broken references could produce incomplete guidance or an incorrect legacy fallback.

Approach

  • Collect split, bundled, and legacy toolbox declarations into one source-aware state model.
  • Deduplicate by canonical endpoint environment key with precedence split > bundled > legacy.
  • Treat explicit empty declarations as authoritative and surface unified configuration or $ref errors.
  • Provide source-specific Next-step and Doctor remediation while preserving legacy compatibility.
  • Add regression coverage and bundled-toolbox migration documentation.

Validation

  • go test ./...
  • go build ./...
  • Targeted golangci-lint checks

End-to-end validation

Command Result
azd ai agent doctor --local-only --no-prompt (bundled toolbox, missing endpoint) PASS — reported the missing TOOLBOX_RESEARCH_TOOLS_MCP_ENDPOINT and provided bundled-toolbox migration guidance.
azd ai agent doctor --local-only --no-prompt (endpoint configured) PASS — reported local.toolboxes as passing.
azd ai agent doctor --local-only --no-prompt (invalid $ref) PASS — surfaced the toolbox load error and repair guidance.

Fixes #9565

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 3 pipeline(s).
24 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

@github-actions github-actions Bot added the ext-agents azure.ai.agents extension label Sep 1, 2026
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 3 pipeline(s).
24 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown

📋 Prioritization Note

Thanks for the contribution! The linked issue isn't in the current milestone yet.
Thank you for logging this issue; our team is reviewing it. If you need urgent prioritization, tag Rick Winter (@RickWinter) and Kristen Womack (@kristenwomack) to let us know.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Note

This error may be related to your runner configuration. You can now configure runners for Copilot code review separately from Copilot cloud agent by creating a copilot-code-review.yml file with your setup steps. Read the docs for details.

Copilot AI review requested due to automatic review settings September 1, 2026 11:52

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 15 out of 15 changed files in this pull request and generated 1 comment.

Copilot AI review requested due to automatic review settings September 1, 2026 12:50

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Note

This error may be related to your runner configuration. You can now configure runners for Copilot code review separately from Copilot cloud agent by creating a copilot-code-review.yml file with your setup steps. Read the docs for details.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 15 out of 15 changed files in this pull request and generated 1 comment.

Suppressed comments (3)

Previously missed (1) — in code that hasn't changed since the last review.

cli/azd/extensions/azure.ai.agents/internal/cmd/nextstep/manifest.go:176

  • This invalid-condition issue is already recorded in ToolboxDependencyErrors, so also adding it to ToolboxLoadErrors makes Next-step emit two different repair actions and makes Doctor take the generic load-error branch before its dependency-specific branch. Keep condition failures in the dependency list and block endpoint probing when either dependency or load errors exist.

This issue also appears on line 349 of the same file.

			recordToolboxLoadIssue(state, issue)

cli/azd/extensions/azure.ai.agents/internal/cmd/nextstep/manifest.go:349

  • This duplicates the agent-condition failure across ToolboxDependencyErrors and ToolboxLoadErrors. An assembled state therefore produces both generic load guidance and dependency guidance, while Doctor hides the more specific dependency result behind its load-error check. Record it only as a dependency error and gate probing on dependency errors separately.
			recordToolboxLoadIssue(state, issue)

cli/azd/extensions/azure.ai.agents/internal/cmd/nextstep/toolboxes.go:400

  • Resolving a root $ref through the full agent map recursively resolves unrelated sections too. A missing nested connection $ref, for example, becomes a ToolboxLoadError and suppresses every toolbox probe, whereas the non-root path below intentionally resolves only toolboxes and the new unrelated-ref test expects that isolation. Load the root agent definition, then resolve only its toolbox subtree so connection failures remain connection diagnostics.
	raw := props.AsMap()
	if _, hasRootRef := raw["$ref"]; hasRootRef {
		return resolveAgentConnectionProperties(props, projectRoot, source)
	}

Copilot AI review requested due to automatic review settings September 2, 2026 02:06

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Duplicate error classification and lost multi-agent ownership can produce misleading or incomplete remediation.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details

Suppressed comments (2)

Previously missed (1) — in code that hasn't changed since the last review.

cli/azd/extensions/azure.ai.agents/internal/cmd/nextstep/manifest.go:176

  • This condition failure is already added to ToolboxDependencyErrors above. Also adding it to ToolboxLoadErrors makes Next-step emit two different repair entries for the same issue, and Doctor takes the load-error branch first instead of its dependency-specific branch. Keep malformed dependency conditions in one category.

This issue also appears on line 349 of the same file.

cli/azd/extensions/azure.ai.agents/internal/cmd/nextstep/manifest.go:349

  • This same issue is already stored in ToolboxDependencyErrors on lines 345–348. Duplicating it in ToolboxLoadErrors produces duplicate Next-step actions and causes Doctor to misclassify the malformed dependency condition as a toolbox-file load failure. Keep the issue in the dependency category only.
			recordToolboxLoadIssue(state, issue)
  • Files reviewed: 15/15 changed files
  • Comments generated: 1
  • Review effort level: Balanced

Comment on lines +462 to +466
key := envkey.ToolboxMCPEndpoint(ref.Name)
existing, found := collected[key]
if !found || toolboxSourcePriority(ref.ToolboxSource) >
toolboxSourcePriority(existing.ToolboxSource) {
collected[key] = ref
@azure-sdk-automation

Copy link
Copy Markdown
Contributor

azure.ai.agents PR build

Note

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/9809/azure-ai-agents.zip"
  • Version: 1.0.0-beta.13.pr.9809.6775525
  • Merge commit: 8f639af

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ext-agents azure.ai.agents extension

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Migrate bundled and legacy toolbox diagnostics

3 participants