fix(gateway): respect routed profile in slash commands - #31102
tensorbit89-netizen wants to merge 1 commit into
Conversation
teknium1
left a comment
There was a problem hiding this comment.
Thanks for addressing routed-profile visibility in gateway slash commands. The premise remains valid on current main, but this implementation needs rework against the current multiplexing seam.
Problems
- Current routing stamps
event.source.profileingateway/run.py:8629-8637; the agent resolves that same field ingateway/run.py:16977-16990. The PR instead introduceschannel_profileslookup atgateway/run.py:4613, a configuration shape with no current routing consumer. It can make/profileor/modelreport a profile that the agent will not use. - The PR only replaces the initial
/modelconfig read (gateway/run.py:10065). Its unchangedconfig_pathremains process-scoped at line 10063, so global/modelpersistence still targets the gateway profile. - Current handlers live in
gateway/slash_commands.pyafter619bd782738adfa87544d0fda7a1114defe86e4c.
Suggested changes
- Salvage this in
gateway/slash_commands.pyusingevent.source.profileand the existing profile-home resolver, including both read and persistence paths. - Test real multiplexed
SessionSource.profilerouting rather than a new mapping.
Automated hermes-sweeper review.
| active = self._active_profile_name() | ||
| if source is None: | ||
| return active | ||
| routes = self._channel_profile_routes(source.platform) |
There was a problem hiding this comment.
Current multiplex routing does not derive a profile from channel IDs: secondary adapters stamp event.source.profile before dispatch (gateway/run.py:8629-8637 on main), and the agent resolves that field. This new mapping can make slash commands select a profile that the actual turn will not use; derive from source.profile instead.
| config_path = _hermes_home / "config.yaml" | ||
| try: | ||
| cfg = _load_gateway_config() | ||
| cfg, _effective_profile = self._effective_user_config_for_source(source) |
There was a problem hiding this comment.
This fixes only the display-time config read. config_path remains _hermes_home / "config.yaml" immediately above, so the typed/picker global persistence paths still save to the gateway process profile. Scope the full command's read/write path to the same routed profile.
|
Thanks for tackling this — the
So for a normally-configured routed channel — e.g. the gateway:
multiplex_profiles: true
profile_routes:
- platform: discord
guild_id: "..."
chat_id: "..."
profile: boisejazz
Suggestion: source the effective profile from the same engine messages use — reuse Happy to be wrong if |
|
Thanks for this PR. Merged via #101247 (0437fe6) on current main — handoffs fail closed and load secrets off-loop; Discord slash commands honor profile_routes. #101247 won as the consolidated fix because it covers the whole multiplex-profile bug class in one change (with tests) rather than the single symptom addressed here; this PR is superseded by it. If anything from your original change is still missing on main >= 0437fe6, please open a fresh PR/issue against main and tag it. Thanks again. |
Summary
/profilereport the chat's effective profile and make/modelread the effective profile config before showing the current model/provider.Why
When a gateway process runs under one profile but Discord channels or threads are routed to named profiles, slash commands should reflect the profile that will actually handle that chat. Otherwise
/profileand/modelcan show the gateway process profile instead of the routed chat profile.Tests
python -m pytest tests/gateway/test_channel_profile_routing.py -q -o 'addopts='python -m pytest tests/gateway/test_channel_profile_routing.py tests/gateway/test_status_command.py tests/gateway/test_model_command_custom_providers.py tests/gateway/test_session_model_override_routing.py -q -o 'addopts='