Skip to content

fix: report an empty provider key variable as unavailable in the model status - #51

Open
leninworld wants to merge 1 commit into
Graphicle-AI:mainfrom
leninworld:fix-empty-provider-key-status
Open

leninworld wants to merge 1 commit into
Graphicle-AI:mainfrom
leninworld:fix-empty-provider-key-status

Conversation

@leninworld

Copy link
Copy Markdown
Contributor

Summary

  • model::Config::status (served at GET /api/models) set credentials_available to true whenever the variable a profile's key_env names was set, even when it was empty. A model with OPENAI_API_KEY="" exported was therefore listed as having credentials, while every call to it then failed in environment_credential with "Provider credential unavailable", which ignores an empty value.
  • Config::status now asks environment_credential, the same check every model call makes, so an empty variable is unavailable, as the workspace status already says, and a non-empty value is still available.

Not changed: Config::status still looks a saved-in-app reference (secret:ID, oauth:ID) up as a variable name; the workspace status resolves those.

Test plan

  • backends::model_status_treats_empty_environment_credentials_as_unavailable runs itself again as a child process with one provider key variable set to "" and another set to a fixture key (the parent's environment is not changed, as in observer.rs), and checks Config::status for both profiles. On main the child fails (assertion failed: !available("empty")); with this change it passes.
  • cargo fmt --check, cargo clippy --locked --all-targets -- -D warnings, cargo clippy --locked --all-targets --features local-inference -- -D warnings and cargo test --locked --all-targets in crates/graphicle (Rust 1.95.0, macOS). Linux and Windows run in CI.

…l status

Config::status reported credentials_available for a profile whose key_env
names a variable that is set but empty, so GET /api/models listed the
model as ready while environment_credential rejected the empty key on
every call. It now asks environment_credential, so an empty variable is
unavailable and a non-empty value is available, as every call and the
workspace status already do.

Signed-off-by: Lenin Mookiah <2639584+leninworld@users.noreply.github.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant