feat(cli): add docker agent doctor for model and credential diagnosis#3489
Merged
Conversation
Phase 2 of #3442: - New `docker agent doctor [agent-file]` reports, without printing secret values: per-provider credential state with its source (environment, env-file, run-secrets, credential-helper, docker-desktop, pass, keychain), Docker Model Runner reachability and pulled models, and the model `auto` selection would pick - With an agent file, lists the environment variables it requires (model credentials and tool secrets), whether each is set and from which source; resolves first_available selectors and honours the models gateway like the run-time preflight - Issues are actionable (exact command or docs URL) and make the command exit non-zero for scripting; `--json` emits the full report - environment.DefaultSources exposes the labeled secret-source chain consumed by NewDefaultProvider so doctor and runtime never diverge - config.CloudProviderEnvVars exposes the auto-selection provider table; config.RequiredModelEnvVars mirrors the gateway-aware model-credential preflight
dgageot
approved these changes
Jul 6, 2026
This was referenced Jul 7, 2026
Merged
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.
Phase 2 of #3442: a diagnosis command that answers "is this machine ready to run an agent, and if not, why?". Complements Phase 1 (#3452), which made run-time failures actionable.
What it does
autowould pick, whether it is usable, notes (configured default model, gateway, "not pulled yet")Secret values are never printed, only the source that supplies them.
--jsonemits the full report for scripting; the non-zero exit code makes it usable as a CI preflight.Issue expectations vs implementation
dmr.ListModels(queried once, result reused for auto-selection)autowould selectconfig.AutoModelConfigon the same source chaindoctor agent.yaml: models + toolset env (e.g.GITHUB_PERSONAL_ACCESS_TOKEN)first_available, honours the models gateway like the run-time preflight--jsonfor scriptingSample output
Implementation notes
cmd/root/doctor.go: the command (telemetry, agent-ref completion,cli.StatusError{StatusCode: 1}when issues exist)pkg/environment/default.go:DefaultSources()exposes the labeled secret-source chain andNewDefaultProvider()now consumes it, so the doctor and the runtime can never diverge; no behavior changepkg/config/auto.go:CloudProviderEnvVars()exposes the auto-selection provider table without duplicating itpkg/config/gather.go:RequiredModelEnvVars()mirrors the gateway-aware model-credential preflight used by the run pathValidation
go build ./...go test ./cmd/... ./pkg/environment ./pkg/configTestURLSource_Read_RejectsLocalAddressesalready fails onmainin sandboxed networks, unrelated)golangci-lint runon touched packagesgo run ./lint .Open question
The issue leaves command naming open (
doctorvsdebug envvsmodels --verbose);doctormatches the flow in the issue's proposed behavior. Ifdebug envseems more appropriate, it can always be changed.