Repository navigation
fix(auth): name the provider and remedy in request-time credential errors; accept GOOGLE_API_KEY (OB3) - #137
Merged
Merged
Conversation
…rors OB3 / ENG-877. `RequestCredentialError::Missing` now carries an optional `Arc<str>` remedy. qq-auth authors the text once when it constructs the xAI and Codex request-credential providers and attaches it when mapping `ProviderCredentialMissing`, `StoredCredentialNotRegistered`, and `StoredCredentialMissing`; qq-provider displays it opaquely, keeps the old `request credentials are missing` text when none is attached, and still classifies the failure as `Authentication`. The request hot path clones one `Arc` on the error path only. A run on `xai/...` with nothing stored now fails with no credential for provider `xai`: run `qq auth login xai --oauth` or `qq auth login xai` or set the environment variable `XAI_API_KEY` and on `openai-codex/...` with no credential for provider `openai-codex`: run `qq auth login openai-codex`. A configured profile is named with `--profile`, and a registered entry whose secret is gone suggests `qq auth logout NAME` first. `GOOGLE_API_KEY` is accepted as an alias of `GEMINI_API_KEY` (`GEMINI_API_KEY` wins). `HttpCredential::ApiKey` gained `alternate_variables`; `resolve_provider_credential_with_aliases` walks them and the plan-time message lists both. The plan descriptor still records `GEMINI_API_KEY` so the digest does not depend on the spelling. `SharedRequestCredentialProvider` now implements `RequestCredentialProvider` so tests can drive the shared handle. Tests: qq-provider (both feature profiles) for remedy display and kind mapping; qq-auth for xAI/Codex/profile/secret-missing/explicit-reference messages and alias precedence; bin child-process test for `provider_authenticated` with only `GOOGLE_API_KEY`.
…_KEY OB3 / ENG-877. Troubleshooting replaces the `request credentials are missing` entry with the new provider-named messages; providers, configuration, and quickstart list `GEMINI_API_KEY` or `GOOGLE_API_KEY`. Ledger: OB3 to In review.
lg2m
force-pushed
the
fix/eng-877-request-credential-errors
branch
from
September 23, 2026 04:04
ec68782 to
7df7996
Compare
lg2m
added a commit
that referenced
this pull request
Sep 23, 2026
OB3 (#137) made GOOGLE_API_KEY an alias of GEMINI_API_KEY; the doctor's credential check now reads HttpCredential::ApiKey.alternate_variables, accepts any of them as authenticating, and writes the remedy as `set GEMINI_API_KEY (or GOOGLE_API_KEY)`. Closes the OB3→OB4 follow-up named in #138 (OB4, ENG-878).
lg2m
added a commit
that referenced
this pull request
Sep 23, 2026
* feat(cli): add qq doctor readiness report with per-check remedies One screen that says whether QQ is ready to run here: configuration, project trust, model, credential for the model's provider, credential store, server discovery, workspace, and data directory. Each line is ok/warn/fail/skip with the remedy indented beneath anything not ok. Exit 0 when nothing fails, 1 otherwise; `--json` for scripts. `src/doctor.rs` keeps `run_checks` free of I/O to stdout so the text and JSON renderers and the tests share one report. The credential check mirrors `RuntimeFactory::provider_authenticated`; the AWS chain helpers in `runtime.rs` are now `pub(crate)` and shared rather than duplicated. No provider is contacted; the keyring is exercised only through the model's stored credential, never probed blindly. Slice OB4 of docs/plans/onboarding-ux.md. ENG-878. * docs(guide): document qq doctor and point troubleshooting at it first CLI reference section for `qq doctor [--json]` with the check table; troubleshooting opens with a sample report; quickstart and the guide index mention it. Ledger: OB4 to In review. Slice OB4. ENG-878. * feat(cli): name GOOGLE_API_KEY in the doctor's google remedy OB3 (#137) made GOOGLE_API_KEY an alias of GEMINI_API_KEY; the doctor's credential check now reads HttpCredential::ApiKey.alternate_variables, accepts any of them as authenticating, and writes the remedy as `set GEMINI_API_KEY (or GOOGLE_API_KEY)`. Closes the OB3→OB4 follow-up named in #138 (OB4, ENG-878).
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.
OB3: request-time credential errors name the provider and remedy; accept GOOGLE_API_KEY
Spec: docs/plans/onboarding-ux.md#ob3 Linear: ENG-877 (parent ENG-875)
What changes for users
Before → after:
provider response failed: request credentials are missing→…: no credential for provider `xai`: run `qq auth login xai --oauth` or `qq auth login xai` or set the environment variable `XAI_API_KEY`no credential for provider `openai-codex`: run `qq auth login openai-codex`credential `xai/work` is not registered: run `qq auth login xai --oauth --profile work` or …credential `xai/default` is registered, but its secret is missing: run `qq auth logout xai/default`, then …GOOGLE_API_KEYnow works as an alias ofGEMINI_API_KEY(precedence GEMINI then GOOGLE); the missing-credential message lists both.Env(...)/ foreignStored(...)references keep their own message (the provider remedy would describe the wrong credential).Design
RequestCredentialError::Missing { remedy: Option<Arc<str>> }; Display falls back to the old text;ProviderErrorKind::Authenticationmapping unchanged. Remedy text is authored once inqq-auth(MissingCredentialRemedies) when the request-credential provider is constructed; qq-provider treats it as opaque. No per-request allocation; provider identity does not branch on the request path.resolve_provider_credential_with_aliases(old fn delegates with&[]);HttpCredential::ApiKey.alternate_variables: &'static [&'static str]; google preset =&["GOOGLE_API_KEY"]. Descriptor digest still namesGEMINI_API_KEY, independent of spelling.How verified
cargo test --workspace, andcargo test -p qq-provider --no-default-features --features test-support.authorize()surfaces the remedy. qq-auth (8): xai nothing-stored / named profile / secret-missing / explicit Env keeps own message; codex nothing-stored /--profile work; google alias message; alias precedence via injected lookup. qq bin:provider_authenticated("google")+plan_forsucceed with onlyGOOGLE_API_KEY(child process withenv_clear()— the test binary shares process env andset_varis unsafe in edition 2024).XDG_CONFIG_HOME: each message above reproduced verbatim.GOOGLE_API_KEY=xwith a google model passes credential resolution and then fails at Google with HTTP 400Unknown name "additionalProperties" at 'tools[0].function_declarations[0].parameters'— pre-existing and unrelated; filed as a follow-up below.Docs
docs/guide/troubleshooting.md, providers.md, configuration.md, quickstart.md; ledger.
Compatibility
RequestCredentialErrordropsCopy(public type in qq-provider; additive field).AuthError::ProviderCredentialMissinggainsalternate_variables. No protocol/schema change.Follow-ups
additionalPropertiesin tool schemas (needs its own issue).xtask/src/providers.rscanary still usesGEMINI_API_KEYonly — fine, out of scope.