feat(cli): actionable errors for missing models and credentials (phase 1 of #3442)#3452
Merged
Merged
Conversation
Member
|
@Sayt-0 we need to review some of the messages |
Phase 1 of #3442: - Bare `docker agent` with empty non-TTY stdin fails with next steps instead of exiting 0 silently; piped prompts keep working - DMR: "not installed" detection no longer depends on the exact docker CLI usage text; when `docker model status` fails, model availability is verified through the DMR HTTP API at client creation so a not-pulled model reports "docker model pull X" instead of a raw HTTP 404 at message time - RequiredEnvError and the first_available variant name the secret sources able to supply arbitrary keys (shell environment, env file, pass, macOS Keychain) with a one-line example each and a link to the secrets guide; Docker Desktop and the credential helper are deliberately absent, they only resolve fixed Docker variables (DOCKER_TOKEN) and can never satisfy the reported missing keys - When model credentials are missing, the error suggests running a local model instead (--model dmr/ai/qwen3, pulled on first use, `docker model ls` lists models already pulled) - --env-from-file with an unreadable or malformed file aborts the run instead of being logged and skipped; parse errors name the file - Exec mode prints the final error once (cobra), not twice
f5243ab to
549b076
Compare
dgageot
approved these changes
Jul 6, 2026
pull Bot
pushed a commit
to TheTechOddBug/cagent
that referenced
this pull request
Jul 7, 2026
…and credentials Adds a troubleshooting section covering the new error messages fired when model credentials are absent or DMR is unreachable, directing users to `docker agent doctor` for diagnosis. Source: docker#3452
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.
Part of #3442 (Phase 1: actionable errors). Phases 2-4 (
doctor, guidedsetup, docs tutorial) are independently shippable and left to follow-up PRs, as laid out in the issue.Changes mapped to the issue scenarios
docker agent, non-TTY, empty stdin (CI)docker modelCLI broken, model not pulledHTTP 404: POST .../chat/completionsdocker model pull Xunknown flag: --json, shared betweenNewClientandListModelsRequiredEnvError,first_availablevariant)--env-from-file,pass, macOS Keychain), plus the docs URL and the local-model alternative (only when the missing vars are model credentials)run --env-from-file typo.envslog(invisible without--debug), run continues--env-from-file: open typo.env: no such file or directory; parse errors name the file and expected formatError: ...)Sample output (missing model credentials)
Message coherence pass
Follow-up to the review comment about message consistency. Every claim made by the new messages is now backed by the code path it describes:
ModelNotAvailableErrorAutoModelFallbackError; final bullet diverged fromPullFailedError'sPullFailedError'sDockerDesktopProviderandCredentialHelperProvideronly resolveDOCKER_EMAIL/DOCKER_USERNAME/DOCKER_TOKENand can never satisfy the reported missing keysNotContainstest locks the exclusionautomodel" (the built-in agent usesfirst_available, and pinned agentfile models are never re-selected) and pointed atdocker agent modelsfor local models (that command deliberately skips DMR discovery and lists the catalog)docker model lsshows models already pulled"Pre-existing divergences left out of this PR, candidates for follow-ups:
docs/guides/secrets/presents Docker Desktop and the credential helper as generic secret sources (same conflation as above, docs side)auto.go) vs "To resolve this, you can:" (pull.go,available.go)ErrNotInstalledlowercase "docker model runner" brandingImplementation notes
ModelNotAvailableErrorpasses through the teamloader unwrapped (same treatment asPullFailedError) and exposes a one-line summary when nested underAutoModelFallbackError, so guidance blocks do not stack.cli.Runrather than at bare-command dispatch: a dispatch-levelisatty(stdout)check would break the workingecho "prompt" | docker agent > out.txtflow. The acceptance criterion (actionable error, exit != 0, never a silent no-op) is met either way; if the dispatch-level check seems preferable, it can be changed.--env-from-filevalidation reuses the provider chain built byRuntimeConfig.EnvProvider()(newEnvFilesError()accessor) and aborts in the shared command pre-run, so every command taking the flag is covered.RequiredEnvError.MissingModelCredentialsis computed ingatherMissingEnvVarsso the local-model hint is not shown for missing tool secrets (e.g.GITHUB_PERSONAL_ACCESS_TOKEN).Testing
pkg/environmentpkg/model/provider/dmrerrIndicatesNotInstalled,modelAvailable(tag/repo matching),checkModelAvailablevia httptest (pulled / not pulled / unqueryable),NewClientshim test with variant docker usage textpkg/cli-) fails, piped stdin still works,ErrorEventreturned once and not printedpkg/configEnvFilesError(missing, malformed, valid, clone),MissingModelCredentialswiring, updatedfirst_availableassertionscmd/root--env-from-fileAll scenarios also verified end to end against a built binary (including a live reproduction of scenario 2: reachable DMR, broken
docker modelCLI, not-pulled model). The message coherence pass only changes user-facing strings; the updated unit tests assert the new content. Existing e2e expectations (environment variables must be set,OPENAI_API_KEYon stderr) are preserved. Remaining suite failures (TestURLSource_Read_RejectsLocalAddresses, SSRF tests,TestLoadExamplesDMR pull) reproduce onmainand are environment-related.