Skip to content

feat: per-user profile routing for messaging platforms - #33558

Closed
samuelperezh wants to merge 1 commit into
NousResearch:mainfrom
samuelperezh:feat/per-user-profile-routing
Closed

feat: per-user profile routing for messaging platforms#33558
samuelperezh wants to merge 1 commit into
NousResearch:mainfrom
samuelperezh:feat/per-user-profile-routing

Conversation

@samuelperezh

Copy link
Copy Markdown

Summary

Adds {PLATFORM}_USER_PROFILE_MAP environment variable that maps platform user IDs to Hermes profiles, enabling a single bot to route different users to fully isolated agent profiles.

Changes

  • New: hermes_cli/profile_context.py — reusable profile context manager extracted from cron/scheduler.py, with resolve_user_profile() helper for platform-agnostic routing
  • Refactor: cron/scheduler.py_job_profile_context now delegates to shared profile_context(), keeping its _hermes_home wrapper
  • Add: gateway/run.py — resolve per-user profile before agent run, enter profile context (HERMES_HOME override + .env loading), restore on exit

How to use

# .env
SLACK_USER_PROFILE_MAP=U01ADMIN:default,U01TEAM:automations

When a message arrives from U01TEAM, the gateway enters the automations profile context, loading its config, model, toolsets, memory, and .env. On exit, the original environment is fully restored.

Testing

  • profile_context import and unit tests pass
  • resolve_user_profile maps users correctly
  • _job_profile_context (cron) works with refactored code
  • Gateway compiles and runs cleanly
  • Slack gateway reconnects with no errors

Closes #33548

Add SLACK_USER_PROFILE_MAP (and {PLATFORM}_USER_PROFILE_MAP) env var
that maps platform user IDs to Hermes profiles, so a single bot can
route different users to fully isolated agent profiles.

- Add hermes_cli/profile_context.py: reusable profile context manager
  extracted from cron/scheduler.py's _job_profile_context, with
  resolve_user_profile() helper for platform-agnostic routing
- Refactor cron/scheduler.py: _job_profile_context now delegates to
  the shared profile_context(), maintaining its _hermes_home wrapper
- gateway/run.py: resolve per-user profile before agent run, enter
  profile context (HERMES_HOME override + .env loading), restore on
  exit in the finally block

Closes NousResearch#33548
@alt-glitch alt-glitch added type/feature New feature or request P3 Low — cosmetic, nice to have comp/gateway Gateway runner, session dispatch, delivery area/config Config system, migrations, profiles labels May 28, 2026
@samuelperezh

Copy link
Copy Markdown
Author

@alt-glitch can we merge this to main?

@teknium1

Copy link
Copy Markdown
Contributor

Thanks for the concrete profile-isolation proposal. This automated hermes-sweeper review is closing it because its user-facing configuration mechanism conflicts with a standing policy.

  • The PR introduces SLACK_USER_PROFILE_MAP / {PLATFORM}_USER_PROFILE_MAP as a non-secret behavioral setting in .env (hermes_cli/profile_context.py:119 in 06be69e82d56).
  • Repository policy requires behavioral settings to use config.yaml, not new HERMES_*-style environment configuration (AGENTS.md:102-107).
  • The related discussion on feat: per-user profile routing via config.yaml (#33548) #33892 already identifies a config.yaml routing-map direction. Please re-scope any follow-up around a config.yaml mechanism rather than an environment-variable map.

Closed as not-planned per standing maintainer policy (env-var-for-config). This is a design-direction decision, not a code-quality judgment — see the Contribution Rubric in AGENTS.md for what the project is looking for. If you believe this policy was misapplied to your change, comment here and a maintainer will take a look.

@teknium1 teknium1 closed this Jul 13, 2026
@teknium1 teknium1 added the sweeper:not-planned Sweeper: closed per standing maintainer policy (design direction) label Jul 13, 2026
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 P3 Low — cosmetic, nice to have sweeper:not-planned Sweeper: closed per standing maintainer policy (design direction) type/feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature: Per-user profile routing for messaging platforms (user->profile binding)

3 participants