CLI: Route wslc warnings through Reporter#41111
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Routes WSLC CLI service-layer warnings through the existing Reporter output sink so warnings consistently honor --no-color and output-level routing (stderr), instead of writing directly to stderr.
Changes:
- Updated
IWarningCallbackimplementation (WarningCallback) to forward warnings toReporter::Warn. - Threaded
Reporter&into multiple service entry points (image/network/session/volume/container) and updated task call sites accordingly. - Replaced direct construction/passing of warning callback COM objects with locally constructed adapters per operation.
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/windows/wslc/tasks/VolumeTasks.cpp | Passes context.Reporter into VolumeService::Prune. |
| src/windows/wslc/tasks/SessionTasks.cpp | Passes context.Reporter into SessionService::OpenOrCreateDefaultSession. |
| src/windows/wslc/tasks/NetworkTasks.cpp | Passes context.Reporter into NetworkService::Create. |
| src/windows/wslc/tasks/ImageTasks.cpp | Passes context.Reporter into ImageService::{Pull,Push,Load,Import}. |
| src/windows/wslc/services/WarningCallback.h | Converts warnings to Reporter::Warn output. |
| src/windows/wslc/services/VolumeService.h | Adds Reporter& to Prune signature. |
| src/windows/wslc/services/VolumeService.cpp | Constructs warning adapter and passes it into PruneVolumes. |
| src/windows/wslc/services/SessionService.h | Adds Reporter& to OpenOrCreateDefaultSession signature. |
| src/windows/wslc/services/SessionService.cpp | Constructs warning adapter for CreateSession/EnterSession. |
| src/windows/wslc/services/NetworkService.h | Adds Reporter& to Create signature. |
| src/windows/wslc/services/NetworkService.cpp | Constructs warning adapter and passes it into CreateNetwork. |
| src/windows/wslc/services/ImageService.h | Adds Reporter& to Load/Import/Pull/Push signatures. |
| src/windows/wslc/services/ImageService.cpp | Constructs warning adapter and passes it into image operations. |
| src/windows/wslc/services/ContainerService.h | Adds wslc.h include to support warning callback usage. |
| src/windows/wslc/services/ContainerService.cpp | Threads warning adapter into container create/start flows and implicit pull path. |
AmelBawa-msft
approved these changes
Jul 17, 2026
dkbennett
marked this pull request as ready for review
July 17, 2026 23:59
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.
Summary of the Pull Request
Follows up on #41010 (which routed all non-help wslc output through
Reporter) byrouting service-layer warnings through the same
Reportersink. Previously thewarning callback wrote directly to
stderr, bypassingReporterand itsno-color/ output-level handling. With this change warnings are now routed as warnings to stderr, colored yellow where supported, and non-colored when not supported or color is disabled.PR Checklist
Detailed Description of the Pull Request / Additional comments
WarningCallbackis now a Reporter adapter. It takes aReporter&in itsconstructor and its
OnWarningforwards the message tom_reporter.Warn(...)(verbatim, with color added only on a VT console, and a null-guard), instead of
fputws(Message, stderr).Reporter&. The methods thatsurface warnings now take a
Reporter&and constructWarningCallbacklocally,replacing the
Microsoft::WRL::Make<WarningCallback>()COM object that wascreated and passed around:
ContainerService—Run/Create/Start(viaCreateInternal)ImageService—Load/Import/Pull/PushNetworkService—CreateSessionService—OpenOrCreateDefaultSession/EnterVolumeService—Prunecontext.Reporter; the floatingIWarningCallback*parameter is gone.Why
Reporterbecomes the single output sink for warnings too, so warnings honorno-color(SGR stripping) and level-based routing consistently with all otherCLI output.
favor of a
Reporter&, cleaning up call sites.Notes
Validation Steps Performed