Skip to content

fix(gateway): honor explicit api_server enabled:false under env key (#51374 salvage) - #70164

Merged
teknium1 merged 1 commit into
mainfrom
salvage/51374-api-cluster
Jul 23, 2026
Merged

teknium1 merged 1 commit into
mainfrom
salvage/51374-api-cluster

Conversation

@teknium1

Copy link
Copy Markdown
Collaborator

Summary

Salvage of #51374 by @davidgut1982 — an explicit platforms.api_server.enabled: false in config.yaml now survives a process-level API_SERVER_KEY env var.

The env-override pass force-enabled api_server whenever the key env var was present, ignoring the _enabled_explicit marker the loader records (and which plugin platforms already honor, #41112). In multiplex setups a secondary profile pins enabled: false to share the default profile's listener — the inherited env var re-enabled it and tripped MultiplexConfigError.

Changes

  • gateway/config.py: api_server env branch pops _enabled_explicit and skips force-enable when the user explicitly disabled; key still wires through
  • tests/gateway/test_config.py: TestApiServerEnvOverride regression test

Validation

Scenario Result
explicit enabled: false + env key stays disabled
config silent + env key enabled (unchanged)
explicit enabled: true + env key enabled (unchanged)
tests/gateway/test_config.py 136/136 pass

Authorship preserved via cherry-pick. Related-but-distinct: #61164 (profile/registry path). Closes #51374.

Infographic

infographic

_apply_env_overrides() force-set ``api_server.enabled = True`` whenever
API_SERVER_KEY (or API_SERVER_ENABLED) was present in the environment.

In multiplex mode, a secondary profile pins
``platforms.api_server.enabled: false`` in its config.yaml so that it
shares the default profile's API-server listener instead of binding its
own port. That profile still inherits the process-level env, including
API_SERVER_KEY, so the unconditional re-enable flipped api_server back on
and tripped the MultiplexConfigError check.

Honor an explicit disable, flagged by ``_enabled_explicit`` in the
platform's extra. Use ``extra.pop("_enabled_explicit", False)``: the
api_server branch is terminal (unlike the migrated plugin platforms, no
later registry pass re-enables api_server), so popping consumes the flag
in a single read and avoids the double-read hazard, while the final
per-platform cleanup remains a no-op.

Adds a regression test asserting that with API_SERVER_KEY set, a config
with api_server explicitly enabled:false + _enabled_explicit:true survives
_apply_env_overrides() as enabled=False (fails without the fix), while the
key is still wired through for the shared listener.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Jul 23, 2026 •

Copy link
Copy Markdown

૮ >ﻌ< ა ci review

ran on 6c7da50

ℹ️ Info

Desktop E2E visual evidence · View test artifacts · View job

1 visual diff.

inline evidence upload failed.

Failed to upload diff-665a0833239e-onboarding-overlay-diff.png with gh image (exit code 1): Error uploading /home/runner/work/_temp/e2e-evidence/diff-665a0833239e-onboarding-overlay-diff.png: step 0 (get upload token): uploadToken not found on repo page — do you have write access to NousResearch/hermes-agent? (or, if NousResearch enforces SAML SSO, authorize at https://github.com/orgs/NousResearch/sso)

@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/gateway Gateway runner, session dispatch, delivery area/config Config system, migrations, profiles sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades labels Jul 23, 2026
@teknium1
teknium1 merged commit c7fd3eb into main Jul 23, 2026
42 checks passed
@teknium1
teknium1 deleted the salvage/51374-api-cluster branch July 23, 2026 18:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/config Config system, migrations, profiles comp/gateway Gateway runner, session dispatch, delivery P2 Medium — degraded but workaround exists sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants