Skip to content

azure.ai.agents - reduce noisy logs in azd ai agent init and redirect log output when --debug is used#7596

Merged
JeffreyCA merged 4 commits intoAzure:mainfrom
JeffreyCA:ext/agents-reduce-init-log-noise
Apr 9, 2026
Merged

azure.ai.agents - reduce noisy logs in azd ai agent init and redirect log output when --debug is used#7596
JeffreyCA merged 4 commits intoAzure:mainfrom
JeffreyCA:ext/agents-reduce-init-log-noise

Conversation

@JeffreyCA
Copy link
Copy Markdown
Contributor

@JeffreyCA JeffreyCA commented Apr 8, 2026

Resolves #7595

azd ai agent init was printing many internal/debug messages to the terminal that cluttered the user experience. This PR cleans up the output by:

  1. Silencing Go log package output by default — The command runner (pkg/exec) and GitHub CLI wrapper (pkg/tools/github) write exec details and version info via Go's standard log package, which defaults to stderr. The extension now redirects log.SetOutput(io.Discard) unless --debug is enabled, matching the behavior of the core azd process.

    When --debug is passed, log statements from the extension should get written to the generated debug .log file.

  2. Moving internal messages to debug-only — Verbose messages about manifest parsing strategies, branch resolution, naive URL fallback logic, and validation internals are now log.Printf calls that only appear in debug mode.

  3. Switching color.Faint to output.WithGrayFormat — All uses of color.New(color.Faint) have been replaced with output.WithGrayFormat to follow the azd style guide.

  4. Improving user-facing download output — The download progress block has been simplified from verbose full-path lines to a clean, scannable format.

Before

image

After

image

Verbose logs are available in the .log file generated when --debug is used:

2026/04/08 23:51:20 Downloading manifest from GitHub: https://github.com/<redacted>/blob/main/samples/python/agentserver-responses/echo-agent-streaming/agent.manifest.yaml
2026/04/08 23:51:20 Run exec: '/home/vscode/.azd/bin/gh --version' , exit code: 0
2026/04/08 23:51:20 Run exec: '/home/vscode/.azd/bin/gh --version' , exit code: 0
2026/04/08 23:51:20 github cli version: 2.89.0
2026/04/08 23:51:20 Attempting to download manifest from 'samples/python/agentserver-responses/echo-agent-streaming/agent.manifest.yaml' in repository '<redacted>', branch 'main'
2026/04/08 23:51:20 Naive GitHub URL parsing failed to download manifest
2026/04/08 23:51:20 Proceeding with full parsing and download logic...
2026/04/08 23:51:21 Downloaded manifest from branch: main
2026/04/08 23:51:21 Run exec: '/home/vscode/.azd/bin/gh api https://api.github.com/repos/<redacted>/contents/samples/python/agentserver-responses/echo-agent-streaming/agent.manifest.yaml?ref=<redacted> -H Accept: application/vnd.github.v3.raw' , exit code: 0
2026/04/08 23:51:21 The manifest does not contain parameters that need to be configured.
2026/04/08 23:51:21 Downloading full directory for container agent
2026/04/08 23:51:21 Downloading parent directory 'samples/python/agentserver-responses/echo-agent-streaming' from repository '<redacted>', branch 'main'
2026/04/08 23:51:21 Run exec: '/home/vscode/.azd/bin/gh api https://api.github.com/repos/<redacted>/contents/samples/python/agentserver-responses/echo-agent-streaming?ref=<redacted>' , exit code: 0
2026/04/08 23:51:21 Downloading file: samples/python/agentserver-responses/echo-agent-streaming/.dockerignore
2026/04/08 23:51:21 Run exec: '/home/vscode/.azd/bin/gh api https://api.github.com/repos/<redacted>/contents/samples/python/agentserver-responses/echo-agent-streaming/.dockerignore?ref=<redacted> -H Accept: application/vnd.github.v3.raw' , exit code: 0
2026/04/08 23:51:21 Downloading file: samples/python/agentserver-responses/echo-agent-streaming/Dockerfile
2026/04/08 23:51:22 Run exec: '/home/vscode/.azd/bin/gh api https://api.github.com/repos/<redacted>/contents/samples/python/agentserver-responses/echo-agent-streaming/Dockerfile?ref=<redacted> -H Accept: application/vnd.github.v3.raw' , exit code: 0
2026/04/08 23:51:22 Downloading file: samples/python/agentserver-responses/echo-agent-streaming/README.md
2026/04/08 23:51:22 Run exec: '/home/vscode/.azd/bin/gh api https://api.github.com/repos/<redacted>/contents/samples/python/agentserver-responses/echo-agent-streaming/README.md?ref=<redacted> -H Accept: application/vnd.github.v3.raw' , exit code: 0
2026/04/08 23:51:22 Downloading file: samples/python/agentserver-responses/echo-agent-streaming/agent.manifest.yaml
2026/04/08 23:51:22 Run exec: '/home/vscode/.azd/bin/gh api https://api.github.com/repos/<redacted>/contents/samples/python/agentserver-responses/echo-agent-streaming/agent.manifest.yaml?ref=<redacted> -H Accept: application/vnd.github.v3.raw' , exit code: 0
2026/04/08 23:51:22 Downloading file: samples/python/agentserver-responses/echo-agent-streaming/agent.yaml
2026/04/08 23:51:23 Run exec: '/home/vscode/.azd/bin/gh api https://api.github.com/repos/<redacted>/contents/samples/python/agentserver-responses/echo-agent-streaming/agent.yaml?ref=<redacted> -H Accept: application/vnd.github.v3.raw' , exit code: 0
2026/04/08 23:51:23 Downloading file: samples/python/agentserver-responses/echo-agent-streaming/main.py
2026/04/08 23:51:23 Run exec: '/home/vscode/.azd/bin/gh api https://api.github.com/repos/<redacted>/contents/samples/python/agentserver-responses/echo-agent-streaming/main.py?ref=<redacted> -H Accept: application/vnd.github.v3.raw' , exit code: 0
2026/04/08 23:51:23 Downloading file: samples/python/agentserver-responses/echo-agent-streaming/requirements.txt
2026/04/08 23:51:23 Run exec: '/home/vscode/.azd/bin/gh api https://api.github.com/repos/<redacted>/contents/samples/python/agentserver-responses/echo-agent-streaming/requirements.txt?ref=<redacted> -H Accept: application/vnd.github.v3.raw' , exit code: 0

Changes

  • internal/cmd/debug.go — Redirect log.SetOutput to io.Discard by default; route to log file when --debug is active.
  • internal/cmd/init.go — Convert ~20 verbose fmt.Printf calls to log.Printf; simplify user-facing messages; use output.WithGrayFormat; show indented filenames instead of full paths.
  • internal/cmd/banner.go — Replace color.Faint with output.WithGrayFormat.
  • internal/cmd/init_from_templates_helpers.go — Replace color.Faint with output.WithGrayFormat.
  • internal/pkg/agents/registry_api/helpers.go — Move "no parameters" info message to debug log.

Move internal/debug messages in azd ai agent init to Go's log package
(debug-only) and improve user-facing output formatting:

- Redirect Go log output to io.Discard by default; only write to log
  file when --debug is enabled. This silences command runner exec logs
  and GitHub CLI version messages that were leaking to stderr.
- Convert verbose internal messages (manifest parsing fallbacks, branch
  resolution, validation details) from fmt.Printf to log.Printf so
  they only appear in debug mode.
- Replace color.Faint with output.WithGrayFormat per the azd style
  guide for all remaining user-facing gray text.
- Simplify user-facing download output: show concise status lines
  ("Downloading manifest from GitHub...", "Downloading files...")
  with indented filenames instead of full paths on every line.
- Clean up message wording: shorten validation confirmation, remove
  redundant URL echoing, use "Downloaded to:" instead of internal
  jargon like "parent directory".

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

Reduces noisy user-facing terminal output from the azd ai agent init flow in the azure.ai.agents extension by defaulting internal/exec logging to debug-only output, and aligning de-emphasized text styling with azd’s output helpers.

Changes:

  • Silences Go log output by default (unless --debug is enabled), and routes debug logs to a file.
  • Converts verbose init-time fmt.Printf messages to log.Printf (debug-only) while keeping a smaller set of user-facing progress messages.
  • Replaces color.Faint usage with output.WithGrayFormat and simplifies download progress output.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
cli/azd/extensions/azure.ai.agents/internal/cmd/debug.go Redirects stdlib log output to a log file in debug mode; discards it otherwise; continues Azure SDK log listener setup.
cli/azd/extensions/azure.ai.agents/internal/cmd/init.go Moves verbose init messaging to debug logs; updates gray output formatting; simplifies download progress display.
cli/azd/extensions/azure.ai.agents/internal/cmd/banner.go Switches faint styling to output.WithGrayFormat for version/docs lines.
cli/azd/extensions/azure.ai.agents/internal/cmd/init_from_templates_helpers.go Switches “Retrieving agent templates…” to output.WithGrayFormat.
cli/azd/extensions/azure.ai.agents/internal/pkg/agents/registry_api/helpers.go Moves “no parameters to configure” message to debug log output.

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

Copilot reviewed 11 out of 11 changed files in this pull request and generated no new comments.

@JeffreyCA JeffreyCA changed the title azure.ai.agents - reduce noisy log output in azd ai agent init azure.ai.agents - reduce noisy log output in azd ai agent init and configure log output Apr 9, 2026
@JeffreyCA JeffreyCA marked this pull request as ready for review April 9, 2026 01:04
@JeffreyCA JeffreyCA added the ext-agents azure.ai.agents extension label Apr 9, 2026
@JeffreyCA JeffreyCA changed the title azure.ai.agents - reduce noisy log output in azd ai agent init and configure log output azure.ai.agents - reduce noisy log output in azd ai agent init and redirect log output when --debug is used Apr 9, 2026
@JeffreyCA JeffreyCA changed the title azure.ai.agents - reduce noisy log output in azd ai agent init and redirect log output when --debug is used azure.ai.agents - reduce noisy logs in azd ai agent init and redirect log output when --debug is used Apr 9, 2026
Copy link
Copy Markdown
Member

@jongio jongio left a comment

Choose a reason for hiding this comment

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

Clean cleanup of noisy init output. One edge case to consider:

  • internal/cmd/debug.go:35 - when log file creation fails in debug mode, Azure SDK events are silently lost (old code fell back to stderr)

Cleanup function pattern, output.WithGrayFormat migration, and rootDirPath threading for relative paths all look correct.

@JeffreyCA JeffreyCA merged commit c65c259 into Azure:main Apr 9, 2026
19 checks passed
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.

azure.ai.agents - reduce noisy logs during azd ai agent init

5 participants