fix(openclaw): avoid gateway restart when switching models#893
Merged
btc69m979y-dotcom merged 1 commit intonetease-youdao:release/2026.03.26from Mar 26, 2026
Conversation
Use per-provider env vars (LOBSTER_APIKEY_<NAME>) instead of a single shared LOBSTER_PROVIDER_API_KEY. All configured provider apiKeys are collected and injected at gateway startup, so switching between providers only rewrites openclaw.json (hot-reloaded silently) without changing env vars — eliminating the forced process restart.
This was referenced Mar 26, 2026
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.
Summary
between 套餐模型 (lobsterai-server) and custom providers, or
between different custom providers
single shared LOBSTER_PROVIDER_API_KEY, so all apiKeys are
pre-injected at gateway startup
hot-reloads silently via its file-watcher — no process restart
needed
Problem
When users switch models across provider types (e.g.,
lobsterai-server ↔ moonshot), the gateway was killed and restarted
because:
LOBSTER_PROVIDER_API_KEY set to the active provider's apiKey
true
restart was forced
Key changes:
all enabled providers and returns their apiKeys keyed by stable
env var suffix
provider-specific env var names
${LOBSTER_APIKEY_} instead of ${LOBSTER_PROVIDER_API_KEY}
upfront; legacy LOBSTER_PROVIDER_API_KEY set to fixed value
Test Plan
stopGateway/startGateway in logs
restart
apiKey used
(expected)