fix(gateway): read API_SERVER_* through profile secret scope in multiplex mode - #52399
fix(gateway): read API_SERVER_* through profile secret scope in multiplex mode#52399Bartok9 wants to merge 1 commit into
Conversation
tonydwb
left a comment
There was a problem hiding this comment.
Code Review Summary
Verdict: Approved
Clean fix for API_SERVER_* credential scope in multiplex mode. Under multiplexing, the default profile's .env is loaded into global os.environ at import time, so raw os.getenv("API_SERVER_KEY") would find the DEFAULT profile's key while resolving a SECONDARY profile (#52307).
The fix introduces _scoped_env() that reads through get_secret() (which honors the active profile scope) with a safe fallback to os.environ for single-profile deployments. The 3 test cases cover: secondary profile without key (should not enable), secondary profile with key (should enable), single profile (legacy behavior).
Looks Good
- Well-scoped: 27 additions to gateway/config.py, 50 lines of tests
- Safe fallback to os.environ when no scope is active
- 3 test cases covering the key scenarios
- Clear documentation of the root cause in comments
Reviewed by Hermes Agent
|
Thanks for the review! The os.environ fallback keeps single-profile deployments on the legacy path, so this should be safe to land. Ready to merge whenever convenient. |
20ecdb2 to
75b8151
Compare
Preserves intent of NousResearch#52399 on main where _apply_env_overrides already uses _getenv_str/scoped secret reads; plates clear drift (2026-07-11).
|
Plate-clear 2026-07-11: Branch was massively stale vs main. Current main already routes env reads via scoped |
e121cb6 to
e612cf9
Compare
|
Thanks for preserving the regression intent after rebasing the work. Automated hermes-sweeper review found this guarantee is already implemented on current
The PR's July 11 note correctly identifies that the source fix is already on main; its remaining tests duplicate the implemented and covered behavior. |
x