Skip to content

fix: treat an empty worker queue password or model key as unset - #52

Open
leninworld wants to merge 1 commit into
Graphicle-AI:mainfrom
leninworld:fix-empty-worker-credentials
Open

leninworld wants to merge 1 commit into
Graphicle-AI:mainfrom
leninworld:fix-empty-worker-credentials

Conversation

@leninworld

Copy link
Copy Markdown
Contributor

Summary

  • graphicle redis-worker read the variables named by the queue's credential_ref and the model profile's key_env with std::env::var, so a variable that was set but empty counted as a credential. With an empty model key the worker connected to Redis and would send an empty API key header on each model call. With an empty queue password it tried to authenticate with it and reported "Queue authentication or connection failed".
  • Both now fail at start with the worker's existing messages ("Worker queue credential environment variable is unavailable", "Worker model credential unavailable"), before any connection. This matches the coordinator, whose resolve_credential (vault.rs) already refuses an empty value for the same credential_ref, and every model call, whose environment_credential refuses an empty key. The worker now calls model::environment_credential instead of reading key_env itself.

Not changed: graphicle login with an empty token variable, which is a separate command; I can send that as its own PR.

Test plan

  • New redis_worker::redis_worker_rejects_empty_credentials_before_connecting runs the program with a queue on redis://127.0.0.1:1 (no Redis) and checks three cases: empty queue password, empty model key, and both set. The first two must fail with their credential message. The third must fail without either message. On main it fails at the first case (graphicle: Queue authentication or connection failed). With only the model-key check reverted it fails the same way at the second case. 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.

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