New request
#1502: tracking: sunset LMSTUDIO_API_KEY env-var legacy alias (introduced in #1501, target removal ~Nov 2026)
We'll provision a sandbox, run an agent against the issue, and open a draft PR. You can pull the branch and iterate from there.
Summary
Tracking the eventual removal of the LMSTUDIO_API_KEY legacy alias added in PR #1501 (#1499 + #1500).
After #1501 ships:
- Canonical env var for LM Studio is
LM_API_KEY(matcheshermes_cli/auth.py:lmstudio.api_key_env_vars) - Legacy alias
LMSTUDIO_API_KEYis preserved as a read-only fallback in two places:api/onboarding.py:_SUPPORTED_PROVIDER_SETUPS["lmstudio"]["env_var_aliases"]api/providers.py:_PROVIDER_ENV_VAR_ALIASES["lmstudio"]
- Onboarding only writes the canonical name going forward
- Detection (Settings → Providers + onboarding readiness) reads canonical first, then aliases
The alias mechanism prevents an upgrade cliff for existing users with LMSTUDIO_API_KEY in .env. But it also means we carry a small amount of dead code forever unless we sunset it.
Sunset criteria
Drop the alias when all of the following are true:
- Time: at least 6 months since #1501 shipped (gives users multiple release cycles to upgrade)
- No new bug reports referencing
LMSTUDIO_API_KEYin either issue tracker or Discord for the prior 90 days - Documentation: the upgrade-path note in #1501's release notes has been live for at least 3 releases
When all three hit, file a small PR that:
- Removes the
env_var_aliasesentry from_SUPPORTED_PROVIDER_SETUPS["lmstudio"] - Removes the
_PROVIDER_ENV_VAR_ALIASES["lmstudio"]entry - Removes the alias-fallback branches in
_provider_api_key_present(api/onboarding.py) and_provider_has_key(api/providers.py) — but keeps the_PROVIDER_ENV_VAR_ALIASESdict shape so future env-var renames can use the same mechanism - Updates the regression tests in
tests/test_issue1500_lmstudio_env_var_alignment.pyto remove the legacy-detection assertions (or flip them to "legacy is no longer detected") - Adds a release-note entry: "Removed legacy
LMSTUDIO_API_KEYenv-var detection. Users still on the old name should rename it toLM_API_KEYin~/.hermes/.env."
Why not just leave it forever?
Leaving the alias in place is also defensible — it's ~10 LOC of dead code with a clear comment explaining why. But there are two costs:
- Cognitive load: every future engineer touching the env-var detection path has to understand why there's a fallback dict. The comment is good, but the next person renaming a different env var has a tempting precedent ("just add it to aliases too") that may not be necessary if they're starting fresh.
- Misleading detection: a user with
LMSTUDIO_API_KEYin.envafter rename-cliff sees Settings reportinghas_key=Trueeven though the agent runtime won't pick it up. The PR description acknowledges this; an explicit drop date forces us to revisit and either (a) actually rewrite their.envat upgrade time, (b) emit a deprecation log warning before silent drop, or (c) just drop and accept thehas_key=True / chat-failsmismatch is fine because they need to rename anyway.
Priority
Low. The alias is safe and useful for the next several months. File this so it doesn't get forgotten — typical follow-up cadence in the WebUI repo is 6-12 months for cleanup-class issues.
Related
- PR #1501 (introduced the alias)
- Issue #1500 (motivated the env-var alignment)
references/reviewer-flagged-fix-in-release-not-followup.md(skill that captures when to land vs. defer reviewer-flagged items)
When to schedule
Re-evaluate around November 2026 — far enough out that #1501 has had multiple release cycles to roll through user installs, recent enough to still be tracked.
Removing a well-scoped legacy environment-variable alias is a localized internal cleanup with no user-visible behavior change for current setups.
- api/onboarding.py
- api/providers.py
- docs/configuration.md