Skip to content

Client.local uses the key hai login stored - #243

Merged
abonneth merged 1 commit into
mainfrom
antoine/local-stored-key
Oct 6, 2026
Merged

abonneth merged 1 commit into
mainfrom
antoine/local-stored-key

Conversation

@abonneth

@abonneth abonneth commented Oct 6, 2026 •

Copy link
Copy Markdown
Collaborator

Made with Cursor


Note

Medium Risk
Changes how credentials are passed into spawned local runtimes; behavior is guarded by existing self-hosted key stripping and new tests, but still touches auth/env forwarding for child processes.

Overview
Client.local() now forwards the same API key the main client uses when it spawns a local agent runtime, including the key saved by hai login when HAI_API_KEY is not set in the environment.

A shared default_api_key() helper centralizes resolution (HAI_API_KEY env, then stored credentials) for both client construction and runtime launch. Spawned runtimes get HAI_API_KEY in spawn_env via setdefault; self-hosted inference still does not receive a hosted key because Inference.runtime_env() removes it afterward. Tests cover both default/cloud spawn and self-hosted spawn.

Reviewed by Cursor Bugbot for commit 85d2bf8. Bugbot is set up for automated code reviews on this repo. Configure here.

@abonneth
abonneth requested a review from adeprezh as a code owner October 6, 2026 14:21
@abonneth
abonneth merged commit 4804560 into main Oct 6, 2026
6 checks passed
@abonneth
abonneth deleted the antoine/local-stored-key branch October 6, 2026 15:00
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.

2 participants