feat(cli): actionable errors for missing models and credentials (phase 1 of #3442)#3452
Open
Sayt-0 wants to merge 1 commit into
Open
feat(cli): actionable errors for missing models and credentials (phase 1 of #3442)#3452Sayt-0 wants to merge 1 commit into
Sayt-0 wants to merge 1 commit into
Conversation
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 every secret source with a one-line example, link to the secrets guide, and suggest the local-model alternative (including that pulled DMR models are picked up automatically by the `auto` model) when model credentials are missing - --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
Member
|
@Sayt-0 we need to review some of the messages |
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, keychain,pass, Docker Desktop, credential helper), 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 format❌ ...+ cobraError: ...)Sample output (missing model credentials)
Implementation 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). 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.