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 Apr 9, 2026
Conversation
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>
Contributor
There was a problem hiding this comment.
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
logoutput by default (unless--debugis enabled), and routes debug logs to a file. - Converts verbose init-time
fmt.Printfmessages tolog.Printf(debug-only) while keeping a smaller set of user-facing progress messages. - Replaces
color.Faintusage withoutput.WithGrayFormatand 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. |
azd ai agent initazd ai agent init and configure log output
azd ai agent init and configure log outputazd ai agent init and redirect log output when --debug is used
azd ai agent init and redirect log output when --debug is usedazd ai agent init and redirect log output when --debug is used
jongio
reviewed
Apr 9, 2026
Member
jongio
left a comment
There was a problem hiding this comment.
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.
jongio
reviewed
Apr 9, 2026
trangevi
approved these changes
Apr 9, 2026
therealjohn
approved these changes
Apr 9, 2026
trangevi
approved these changes
Apr 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves #7595
azd ai agent initwas printing many internal/debug messages to the terminal that cluttered the user experience. This PR cleans up the output by:Silencing Go
logpackage output by default — The command runner (pkg/exec) and GitHub CLI wrapper (pkg/tools/github) write exec details and version info via Go's standardlogpackage, which defaults to stderr. The extension now redirectslog.SetOutput(io.Discard)unless--debugis enabled, matching the behavior of the coreazdprocess.When
--debugis passed,logstatements from the extension should get written to the generated debug.logfile.Moving internal messages to debug-only — Verbose messages about manifest parsing strategies, branch resolution, naive URL fallback logic, and validation internals are now
log.Printfcalls that only appear in debug mode.Switching
color.Fainttooutput.WithGrayFormat— All uses ofcolor.New(color.Faint)have been replaced withoutput.WithGrayFormatto follow the azd style guide.Improving user-facing download output — The download progress block has been simplified from verbose full-path lines to a clean, scannable format.
Before
After
Verbose logs are available in the .log file generated when
--debugis used:Changes
internal/cmd/debug.go— Redirectlog.SetOutputtoio.Discardby default; route to log file when--debugis active.internal/cmd/init.go— Convert ~20 verbosefmt.Printfcalls tolog.Printf; simplify user-facing messages; useoutput.WithGrayFormat; show indented filenames instead of full paths.internal/cmd/banner.go— Replacecolor.Faintwithoutput.WithGrayFormat.internal/cmd/init_from_templates_helpers.go— Replacecolor.Faintwithoutput.WithGrayFormat.internal/pkg/agents/registry_api/helpers.go— Move "no parameters" info message to debug log.