fix: make log messages more AI-friendly#111
fix: make log messages more AI-friendly#111haliaeetusvocifer wants to merge 2 commits intomicrosoft:mainfrom
Conversation
Reword log messages that AI tools commonly misinterpret as errors when analyzing test failures and logs: - IDE runner unavailability: Clarify that missing IDE environment variables are expected in non-IDE environments (CI, tests), not errors - Runtime status: Add context that non-installed runtimes (e.g. Podman when only Docker is available) are expected and can be ignored - Executable runner fallback: Downgrade from Error to Info log level since progressing through startup stages is normal behavior - IDE notification handler: Clarify that disposed endpoint is expected during shutdown Fixes microsoft#20
There was a problem hiding this comment.
Pull request overview
This PR rewords and re-levels a few log/error messages so they are less likely to be misinterpreted as actionable failures by AI log analyzers, while keeping the same runtime behavior.
Changes:
- Clarifies IDE-related messages when required IDE environment variables/connection endpoints are not present (common in CI/tests/shutdown).
- Adjusts container runtime selection logging to avoid surfacing “podman not found” style details in routine logs.
- Downgrades an “executable runner not available” log from Error to V(1) Info during startup-stage fallback.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| internal/exerunners/ide_notification_handler.go | Rewords disposed IDE endpoint error to indicate it’s expected during shutdown. |
| internal/exerunners/ide_connection_info.go | Rephrases IDE runner “not configured” and missing env var messages to be less error-sounding. |
| internal/containers/runtimes/runtime.go | Reworks runtime selection log fields/message to reduce noisy “missing runtime” details. |
| controllers/executable_controller.go | Changes runner-not-found logging from Error to V(1) Info during stage fallback. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (1)
internal/exerunners/ide_connection_info.go:53
runnerNotAvailablenow claims IDE execution being unavailable is expected in non-IDE environments, but the same prefix is used for all errors produced bycreateAndLogError(e.g., certificate decode/parse failures, request creation failures, incompatible IDE extension). Those cases are not “expected in non-IDE environments” and the log line becomes misleading. Suggest splitting the helper so missing env vars are logged with the “expected” wording, while other errors use a neutral prefix and/or a higher severity.
const runnerNotAvailable = "IDE execution is not configured (this is expected in non-IDE environments): "
const missingRequiredEnvVar = "environment variable '%s' is not set"
createAndLogError := func(format string, a ...any) error {
err := fmt.Errorf(format, a...)
log.Info(runnerNotAvailable + err.Error())
return err
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| } | ||
|
|
||
| log.V(1).Info("Runtime status", "Runtime", availableRuntime.orchestrator.Name(), "Status", availableRuntime.status) | ||
| log.V(1).Info("Container runtime selected (non-installed runtimes are expected and can be ignored)", |
There was a problem hiding this comment.
The new log message says "non-installed runtimes are expected and can be ignored", but this function logs after selecting a runtime and runs both when the runtime is auto-selected and when it is explicitly requested via flags. If the user explicitly selects a runtime that isn't installed/running, that is not expected/ignorable and this wording can hide real configuration problems. Consider making the message conditional on runtimeFlagValue == flags.UnknownRuntime, or tailor the text based on whether the runtime was user-selected vs auto-selected (and include guidance when the selected runtime is not installed).
| log.V(1).Info("Container runtime selected (non-installed runtimes are expected and can be ignored)", | |
| logMessage := "Container runtime selected" | |
| if runtimeFlagValue == flags.UnknownRuntime { | |
| logMessage = "Container runtime selected (non-installed runtimes are expected and can be ignored)" | |
| } | |
| log.V(1).Info(logMessage, |
karolz-ms
left a comment
There was a problem hiding this comment.
Thanks for helping us make DCP better.
Making the error messages understandable is important, but so is terseness and precision. Hope my suggestions make sense.
| log.V(1).Info("Executable runner is not available for current startup stage, will try next stage if available", | ||
| "StartupStage", ri.startupStage, "Error", runnerNotFoundErr) |
There was a problem hiding this comment.
| log.V(1).Info("Executable runner is not available for current startup stage, will try next stage if available", | |
| "StartupStage", ri.startupStage, "Error", runnerNotFoundErr) | |
| log.V(1).Info("Executable runner is not available for current startup stage", | |
| "StartupStage", ri.startupStage, "Error", runnerNotFoundErr) |
There was a problem hiding this comment.
If the execution gets to this place in the code, we know that there is more than one startup state to be tried, so "will try next stage if available" part is both redundant and bit misleading.
| } | ||
|
|
||
| log.V(1).Info("Runtime status", "Runtime", availableRuntime.orchestrator.Name(), "Status", availableRuntime.status) | ||
| log.V(1).Info("Container runtime selected (non-installed runtimes are expected and can be ignored)", |
There was a problem hiding this comment.
Let's not change the properties here: Runtime and Status conveys what we need. Just change the message to "Container runtime selected" (that's it, no need to elaborate beyond that).
| func NewIdeConnectionInfo(lifetimeCtx context.Context, log logr.Logger) (*ideConnectionInfo, error) { | ||
| const runnerNotAvailable = "Executables cannot be started via IDE: " | ||
| const missingRequiredEnvVar = "missing required environment variable '%s'" | ||
| const runnerNotAvailable = "IDE execution is not configured (this is expected in non-IDE environments): " |
There was a problem hiding this comment.
No, let's not change this error message. Requesting IDE execution is NOT expected in non-IDE environments and represents an invalid workload definition. Just keep the error message as-is.
| const runnerNotAvailable = "Executables cannot be started via IDE: " | ||
| const missingRequiredEnvVar = "missing required environment variable '%s'" | ||
| const runnerNotAvailable = "IDE execution is not configured (this is expected in non-IDE environments): " | ||
| const missingRequiredEnvVar = "environment variable '%s' is not set" |
There was a problem hiding this comment.
No, let's keep the message as-is. The part that the environment variable is REQUIRED is important.
Reword log messages that AI tools commonly misinterpret as errors when analyzing test failures and logs:
Fixes #20