"""Regression for #80646: the ``agent_context`` handed to memory providers follows the platform (``cron`` / ``subagent`` skip writes per the ``MemoryProvider.initialize`` contract) instead of a hardcoded ``"primary"`` that let cron turns land in stores configured to skip them. """ from types import SimpleNamespace import pytest from agent.agent_init import _GATEWAY_IDENTITY_PARAMS, _memory_provider_init_kwargs def _fake_agent(): """The attribute surface ``_memory_provider_init_kwargs`` reads.""" return SimpleNamespace( session_id="sess-80646", _session_db=None, _emit_warning=None, _emit_status=None, session_cwd=None, **{f"_{name}": None for name in _GATEWAY_IDENTITY_PARAMS}, ) @pytest.mark.parametrize( ("platform", "expected"), [("cron", "cron"), ("subagent", "subagent"), ("telegram", "primary"), (None, "primary")], ) def test_agent_context_follows_the_platform(platform, expected): assert _memory_provider_init_kwargs(_fake_agent(), platform)["agent_context"] == expected