The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(gateway): name every profile and the install in the authority's profiles.list
Teknium0bf0682efcf2
diff --git a/gateway/session_group_controls.py b/gateway/session_group_controls.pyindex 3cbe9f90944..b89c0574c14 100644--- a/gateway/session_group_controls.py+++ b/gateway/session_group_controls.py@@ -432,4 +432,21 @@ def _profiles(authority, actor, home, params, siblings=()):if service is not None:for configured, target in service.profile_homes().items():discovered(configured, target)- return {'profiles': profiles, 'bot_mode_protocol': True}+ # Every other profile under this root, as the pre-authority ``profiles.list`` named them+ # (RT-38): a host running one gateway per profile serves no siblings, and Desktop drops every+ # union agent the active source leaves out, so a default-only answer hid the other bots.+ # Metadata only, like any discovery above.+ from hermes_cli.profiles import _get_default_hermes_home, _iter_named_profile_dirs+ root = _get_default_hermes_home()+ if root.is_dir():+ discovered('default', root)+ for target in _iter_named_profile_dirs():+ discovered(target.name, target)+ # ``install_id`` (same value as /api/status) lets a multi-connection client prove which+ # machine answered; the roster trace logged ``answered=-`` without it.+ from hermes_cli.install_identity import get_install_id+ try:+ install_id = get_install_id() or ''+ except Exception:+ install_id = ''+ return {'profiles': profiles, 'bot_mode_protocol': True, 'install_id': install_id}diff --git a/tests/gateway/test_session_group_controls.py b/tests/gateway/test_session_group_controls.pyindex 37d96398aba..4a59d36e63b 100644--- a/tests/gateway/test_session_group_controls.py+++ b/tests/gateway/test_session_group_controls.py@@ -140,3 +140,38 @@ def test_groups_list_pages_the_actor_visible_rooms(tmp_path):breakparams = {'limit': 2, 'offset': page['next_offset']}assert pages == [['m1', 'm2'], ['m3']], pages+++def test_profiles_list_names_every_profile_on_disk_and_its_install(tmp_path, monkeypatch):+ """RT-38 (#140417): with one gateway per profile (no multiplexing, no hosted_rooms entries) the+ authority's roster must still name every profile under this root, and carry ``install_id`` as+ the pre-authority ``profiles.list`` did. Desktop's roster merge drops every union agent the+ active source did not return, so a default-only answer showed one bot after ``hermes update``."""+ home = tmp_path / 'state'+ for name in ('helper', 'writer'):+ (home / 'profiles' / name).mkdir(parents=True)+ (home / 'profiles' / name / 'config.yaml').write_text('model:\n default: m\n')+ (home / 'profiles' / 'writer' / 'profile.yaml').write_text('display_name: Writer Bot\n')+ (home / 'profiles' / 'ghost').mkdir() # no identity marker: never listed+ monkeypatch.setenv('HERMES_HOME', str(home))+ monkeypatch.setenv('HOME', str(tmp_path / 'user'))+ (home / 'config.yaml').write_text('model:\n default: fixture-model\n')+ with SessionDB(home / 'state.db') as db:+ db.create_session('theirs', source='cli', user_id='another')+ writer_db = SessionDB(home / 'profiles' / 'writer' / 'state.db')+ writer_db.create_session('writer-chat', source='gui', user_id='another')+ writer_db.set_session_title('writer-chat', 'Bot Chat')+ writer_db.close()+ authority = SimpleNamespace(profile_id=str(home), instance_id='owner', db=db, events={}, sessions={})++ async def probe():+ connection = AuthorityConnection(authority, object(), {'user_id': 'reader'})+ return await connection.dispatch({'id': 'r', 'method': 'profiles.list', 'params': {}})+ result = asyncio.run(probe())['result']+ from hermes_cli.install_identity import get_install_id+ assert result['install_id'] and result['install_id'] == get_install_id()+ rows = {row['name']: row for row in result['profiles']}+ assert list(rows) == ['default', 'helper', 'writer'], rows+ assert rows['writer']['display_name'] == 'Writer Bot'+ # Discovery is metadata only: a profile this socket does not route to adds no session fields.+ assert 'canonical_session' not in rows['writer'] and 'last_session' not in rows['writer']