Skip to content

[azure.ai.connection] leaks projectctx debug log to terminal on every command #8540

Description

@hund030

Summary

Every azd ai connection <command> invocation prints an internal diagnostic line
to the terminal:

projectctx: resolved endpoint=https://<...>.services.ai.azure.com/api/projects/<proj> source=flag

This is developer-facing noise that users should never see. It appears
unconditionally — there is no --debug flag required to trigger it.

Repro

  1. Install the azure.ai.connections extension.
  2. Run any connection command against a Foundry project, e.g.:
    azd ai connection list -p https://<your-project-endpoint>
    

Expected

No projectctx: diagnostic line in normal output.

Actual

The projectctx: resolved endpoint=... source=... line is printed on every run.

Root cause

resolveConnectionContext in
cli/azd/extensions/azure.ai.connections/internal/cmd/connection_context.go
calls log.Printf("projectctx: resolved endpoint=%s source=%s", ...). The
extension never silences Go's default logger, so the line goes straight to the
terminal.

Beyond the noise, this is also a layering issue: endpoint resolution is owned by
projectctx.Resolve. Any such diagnostic belongs inside the projectctx
package (where the resolution decision is made), not in the consuming caller.

Fix

Remove the log.Printf line (and the now-unused log import) from
connection_context.go.

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingext-agentsazure.ai.agents extension

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions