fix(mcp): let embedding hosts pin the process home for routed-profile detection - #119355
Open
karangehlod wants to merge 1 commit into
Open
karangehlod wants to merge 1 commit into
karangehlod wants to merge 1 commit into
Conversation
… detection Fixes all four launch-home decisions that flip when a host mirrors the served profile into os.environ["HERMES_HOME"] per turn (NousResearch#119242): * serves_routed_profile() - MCP registry scope / connection key * _is_routed_home() - strip_launch_profile_env residue in child env * _is_process_home() - GATEWAY_ALLOW_ALL_USERS seeding into served scope * env_loader._process_hermes_home() - terminal.* config cross-profile leak Changes: - hermes_constants.pin_process_hermes_home(path): records the host own home (first call wins; None clears). get_process_hermes_home() returns the pinned value when set, so all four callers are fixed without touching their call sites. - agent.secret_scope.set_multiplex_active(True) now calls pin_process_hermes_home() so multiplexed gateways are covered automatically. An embedding host that calls pin_process_hermes_home() before activating multiplex keeps its own pin (first-pin-wins). - get_routing_process_hermes_home() kept as an alias for backward compat. - 9 tests covering: unpinned semantics unchanged, pin survives mirrored env, first-pin-wins, multiplex auto-pin, explicit-pin-before-multiplex, _is_routed_home, _is_process_home, env_loader._process_hermes_home. Fixes NousResearch#119242.
karangehlod
force-pushed
the
fix/pin-process-hermes-home
branch
from
September 23, 2026 11:08
d345be2 to
8ad4a76
Compare
This branch has not been deployed
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.
What does this PR do?
Fixes all four launch-home decisions that flip when an embedding host mirrors the active turn's profile into `os.environ["HERMES_HOME"]` per turn (confirmed broken on main @ a27b130, #119242):
Root cause. All four decisions call `get_process_hermes_home()`, which reads `HERMES_HOME` live. When the host mirrors the served home there, all four flip.
Fix. `get_process_hermes_home()` now returns a pinned value when one is set, so every caller is fixed at once without touching their call sites. The pin is set by:
Standalone invocations (no multiplex, no explicit pin) keep following `HERMES_HOME` exactly as before.
Related Issue
Fixes #119242.
Type of Change
Changes Made
How to Test
pytest tests/agent/test_serves_routed_profile_pin.py -q # 9 passed (all fail on main without this change)Checklist
Code
Documentation & Housekeeping