The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(gateway): answer session.info and the voice gate on a history mount
unsupportedpastels7fe896863c41
diff --git a/gateway/session_config.py b/gateway/session_config.pyindex 01fcb36a439..89dd1e2753a 100644--- a/gateway/session_config.py+++ b/gateway/session_config.py@@ -132,6 +132,8 @@ def local_voice_enabled(session_id):for authority in all_authorities(_ACTIVE_RUNNER):live = getattr(authority, 'sessions', {}).get(session_id)if live is not None:+ if live.source is None: # a history mount: no chat for a voice mode to belong to+ return Falsemodes = getattr(_ACTIVE_RUNNER, '_voice_mode', None) or {}return modes.get(_ACTIVE_RUNNER._voice_key_for_source(live.source), 'off') != 'off'return Nonediff --git a/gateway/session_local.py b/gateway/session_local.pyindex 980348f3811..ca5cd0f2f54 100644--- a/gateway/session_local.py+++ b/gateway/session_local.py@@ -419,7 +419,11 @@ def local_session_info(authority, ref):from gateway.session_authorities import served_profile_namefrom gateway.session_policy import policy_for_sourcepolicy = policy_for_source(authority.runner, live.source)- info = {'source': policy.source if policy else live.source.platform.value,+ if live.source is None: # a history mount: what its stored row says+ source = authority.db.get_session(ref.session_id)['source']+ else:+ source = policy.source if policy else live.source.platform.value+ info = {'source': source,'model': (getattr(agent, 'model', policy.current_model(authority) if policy else None) if agent is not Noneelse _lazy_model(authority, policy)),'lazy': agent is None,@@ -432,7 +436,7 @@ def local_session_info(authority, ref):peek = getattr(authority.runner, '_peek_session_state', None)state = peek(live.route) if peek is not None else Noneoverride = state.conversation.reasoning_override if state is not None else None # a typed /reasoning- if agent is None and policy is None and live.source.platform != Platform.LOCAL:+ if agent is None and policy is None and live.source is not None and live.source.platform != Platform.LOCAL:# A messaging chat not built yet: what its next turn resolves (its /model and /reasoning picks# included), so a viewer's model and reasoning pill never wait on a field that never comes.from gateway.session_messaging_picks import messaging_route_infodiff --git a/tests/gateway/test_stored_history_mount.py b/tests/gateway/test_stored_history_mount.pyindex c0e3a0c6eb7..fc54afa565f 100644--- a/tests/gateway/test_stored_history_mount.py+++ b/tests/gateway/test_stored_history_mount.py@@ -185,3 +185,30 @@ async def test_an_api_chat_opened_read_only_still_continues_through_the_api(tmp_assert frame['params']['payload'] == {'text': 'bound'}detached = await conn.detach(ref, {'session_id': 'api-1', 'subscription_id': opened['subscription_id']})assert detached['detached'] is True++[email protected]('sid', sorted(ROWS))+async def test_session_info_answers_on_a_mount(tmp_path, monkeypatch, sid):+ """The classic CLI's /new and /tools read session.info first; on a mount it answered ``internal error``."""+ conn, ref = await _connect(tmp_path, monkeypatch, sid)+ await conn.resume(ref, {})+ reply = await conn.dispatch({'id': 1, 'method': 'session.info', 'params': {'session_id': sid}})+ assert reply.get('result', {}).get('source') == ROWS[sid][0], reply+++async def test_push_to_talk_reads_voice_off_on_a_mount(tmp_path, monkeypatch):+ """The TUI's push-to-talk gate on an opened stored chat raised AttributeError on the source-less mount."""+ from gateway import run_api+ from gateway.run import GatewayRunner+ from gateway.session_config import local_voice_enabled+ conn, ref = await _connect(tmp_path, monkeypatch, 'cron_job1_20261001_120000')+ await conn.resume(ref, {})+ runner = conn.authority.runner+ for name in ('_voice_key_for_source', '_voice_key'):+ setattr(runner, name, getattr(GatewayRunner, name).__get__(runner))+ runner._adapter_profile_for_source = lambda source: None+ runner.session_authority = conn.authority+ monkeypatch.setattr(run_api, '_ACTIVE_RUNNER', runner)+ assert local_voice_enabled(ref.session_id) is False