Skip to content

[Bug]: Honcho memory scoping ignores gateway user_id when peer_name is configured #11199

@NewTurn2017

Description

@NewTurn2017

Bug Description

HonchoMemoryProvider.initialize() only copies the gateway user_id into cfg.peer_name when cfg.peer_name is empty. If the user has configured a static peer_name, every gateway user on that agent instance is forced into the same Honcho peer identity, so per-user memory scoping breaks.

Affected files / lines

  • plugins/memory/honcho/__init__.py:220-226
  • plugins/memory/honcho/session.py:275-283
  • run_agent.py:1206-1208

Why this is a bug

run_agent.py explicitly threads user_id into provider initialization for per-user memory scoping. But Honcho ignores that runtime identity whenever cfg.peer_name is already set, and HonchoSessionManager.get_or_create_session() always prefers self._config.peer_name as the user peer ID source.

That means two different gateway users can silently share the same Honcho user peer / memory bucket whenever a static peer_name is configured.

Minimal reproduction / evidence

Existing test already fails on main:

cd /Users/genie/.hermes/hermes-agent
source venv/bin/activate
pytest -q tests/agent/test_memory_user_id.py::TestHonchoUserIdScoping::test_gateway_user_id_overrides_peer_name -vv

Observed failure:

  • expected mock_cfg.peer_name == "discord_user_789"
  • actual mock_cfg.peer_name == "static-user"

Relevant code path:

_gw_user_id = kwargs.get("user_id")
if _gw_user_id and not cfg.peer_name:
    cfg.peer_name = _gw_user_id

Expected Behavior

A gateway-provided user_id should produce isolated per-user Honcho identity, even when a static peer_name exists in config, or the product should clearly separate "assistant peer name" vs "runtime end-user identity" so they do not collide.

Actual Behavior

Configured peer_name wins globally, so multiple gateway users can collapse into the same Honcho memory identity.

Suggested investigation direction

  • Decide whether gateway user_id should always override the runtime user peer for Honcho sessions.
  • If peer_name is meant to represent the assistant or deployment identity, split it from end-user identity instead of reusing one field for both.
  • Extend tests/agent/test_memory_user_id.py to cover the static-peer_name + multiple-user scenario end to end.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions