Skip to content

The agent that grows with you

test(gateway): a bundled plugin platform conversation is listed in the stored picker (currently failing)

yoniebansdb9ef18d0cf2
diff --git a/tests/gateway/test_stored_picker_routed_sources.py b/tests/gateway/test_stored_picker_routed_sources.py
index a1e69ddf7b1..2c6f4dbde01 100644
--- a/tests/gateway/test_stored_picker_routed_sources.py
+++ b/tests/gateway/test_stored_picker_routed_sources.py
@@ -42,12 +42,12 @@ async def _finished_cron_run(authority, db, tmp_path):
return receipt['session_id']
-def _messaging_row(db, sid, chat_id, *, profile_name=None):
+def _messaging_row(db, sid, chat_id, *, profile_name=None, platform='telegram'):
import json
- route = f'agent:main:telegram:dm:{chat_id}'
- db.create_session(sid, source='telegram', model='m', user_id='111', profile_name=profile_name)
+ route = f'agent:main:{platform}:dm:{chat_id}'
+ db.create_session(sid, source=platform, model='m', user_id='111', profile_name=profile_name)
db._write_sql('UPDATE sessions SET session_key=?, chat_id=?, chat_type=?, origin_json=? WHERE id=?',
- (route, chat_id, 'dm', json.dumps({'platform': 'telegram', 'chat_id': chat_id, 'chat_type': 'dm',
+ (route, chat_id, 'dm', json.dumps({'platform': platform, 'chat_id': chat_id, 'chat_type': 'dm',
'user_id': '111'}), sid))
db.append_message(sid, 'user', sid + ' question')
db.append_message(sid, 'assistant', sid + ' answer')
@@ -104,3 +104,22 @@ async def test_a_compressed_messaging_conversation_is_listed_under_its_lineage_r
rows = [row for row in listed['result']['sessions'] if row['id'] in {'tg-root', 'tg-tip'}]
assert [(row['id'], row['session_id']) for row in rows] == [('tg-root', 'tg-root')]
assert rows[0]['message_count'] == 1 # the tip's segment, as every picker row reads after compression
+
+
[email protected]('platform', ['irc', 'line', 'google_chat'])
+async def test_a_bundled_plugin_platform_conversation_is_listed_and_resumes(tmp_path, monkeypatch, platform):
+ """Plugin platforms are ``Platform`` pseudo-members that enum iteration never yields; the cold mount
+ resolves them by label, so the listing must offer the same rows."""
+ from gateway.session_controls import AuthorityConnection
+
+ authority, db = await _owner(tmp_path, monkeypatch)
+ _messaging_row(db, 'plugin-chat', '114', platform=platform)
+ native = AuthorityConnection(authority, object(), {'provider': 'local', 'user_id': 'native',
+ 'profile_id': str(tmp_path), 'instance_id': 'owner'},
+ operator=True)
+
+ listed = await native.dispatch({'id': 1, 'method': 'session.list', 'params': {'scope': 'stored'}})
+ assert 'plugin-chat' in {row['id'] for row in listed['result']['sessions']}, listed
+ resumed = await native.dispatch({'id': 2, 'method': 'session.resume', 'params': {'session_id': 'plugin-chat'}})
+ assert 'result' in resumed, resumed