The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
refactor(honcho): trim duplicated tests and long docstrings
Erosikad532d83eca83
diff --git a/plugins/memory/honcho/__init__.py b/plugins/memory/honcho/__init__.pyindex a37b1f8064a..4b11f65bb17 100644--- a/plugins/memory/honcho/__init__.py+++ b/plugins/memory/honcho/__init__.py@@ -86,20 +86,15 @@ _PROMPT_HEADERS = {_LOCAL_PLATFORMS = frozenset({"cli", "tui", "desktop", ""})+_FLAG_WORDS = {"1": True, "true": True, "yes": True, "on": True,+ "0": False, "false": False, "no": False, "off": False, "": False}++def _as_flag(raw: Any, default: Optional[bool]) -> Optional[bool]:"""A config or env value read as a boolean. Unrecognized strings keep ``default``."""- if isinstance(raw, bool):- return raw- if raw is None:- return defaultif isinstance(raw, str):- text = raw.strip().lower()- if text in {"1", "true", "yes", "on"}:- return True- if text in {"0", "false", "no", "off", ""}:- return False- return default- return bool(raw)+ return _FLAG_WORDS.get(raw.strip().lower(), default)+ return default if raw is None else bool(raw)# (injection.sessionStart name, context key, heading). Render order is fixed here, not by config order.@@ -460,7 +455,6 @@ class HonchoMemoryProvider(DialecticMixin, MemoryProvider):@staticmethoddef _resolve_injection_log_path(look: _HostLookup) -> Optional[str]:"""Where to append the injection audit, or None to keep it off.-The ``logging`` key or HONCHO_LOGGING switches it on. HONCHO_INJECTION_LOG overrides the destination."""explicit = os.environ.get("HONCHO_INJECTION_LOG")if explicit:@@ -474,8 +468,7 @@ class HonchoMemoryProvider(DialecticMixin, MemoryProvider):def _log_injection(self, reason: str, payload: str = "") -> str:"""Append one record of what this turn injected and why, then return ``payload`` unchanged. Never raises.-- The reason is recorded because prefetch has several ways to return nothing and each needs a different fix."""+ The reason matters because prefetch has several ways to return nothing and each needs a different fix."""path = self._injection_log_pathif not path:return payload@@ -621,10 +614,8 @@ class HonchoMemoryProvider(DialecticMixin, MemoryProvider):"to re-authenticate will restore it.")def _peer_failure_text(self) -> str:- """The stored peer failure plus the fix that fits the session's platform.-- On a gateway platform the fix is a user id from the transport, never peerName: a shared- peerName would merge every user of that gateway onto one peer."""+ """The stored peer failure plus the fix that fits the session's platform. On a gateway the fix is a+ user id from the transport, never peerName: a shared peerName would merge every user onto one peer."""text = self._init_peer_failure or ""if self._init_peer_platform in _LOCAL_PLATFORMS:return f"{text} Set one with 'hermes honcho peer --user <name>'."@@ -1042,8 +1033,7 @@ class HonchoMemoryProvider(DialecticMixin, MemoryProvider):_SHUTDOWN_JOIN_FLOOR = 5.0def _shutdown_join_budget(self) -> float:- """One join window for every plugin thread: the floor, or the configured HTTP timeout when- that is longer, so a thread blocked in a Honcho call can finish before the interpreter finalizes."""+ """The floor, or the configured HTTP timeout when longer, so a thread blocked in a Honcho call can finish."""try:from plugins.memory.honcho.client_cache import _resolve_timeout_from_sourcesreturn max(self._SHUTDOWN_JOIN_FLOOR, _resolve_timeout_from_sources(self._config))@@ -1051,9 +1041,8 @@ class HonchoMemoryProvider(DialecticMixin, MemoryProvider):return self._SHUTDOWN_JOIN_FLOORdef shutdown(self) -> None:- """Join the write threads, flush and stop the manager, then join every other thread this- provider or its manager spawned, all within one budget. A daemon thread still blocked in- httpx I/O when the interpreter finalizes aborts the process."""+ """Join the write threads, flush and stop the manager, then join every other thread this provider or its+ manager spawned, all within one budget. A daemon thread still blocked in httpx I/O at exit aborts the process."""self._recall_generation = object()budget = self._shutdown_join_budget()deadline = time.monotonic() + budgetdiff --git a/plugins/memory/honcho/session.py b/plugins/memory/honcho/session.pyindex 4376737bfba..e099da30fe7 100644--- a/plugins/memory/honcho/session.py+++ b/plugins/memory/honcho/session.py@@ -241,12 +241,9 @@ class HonchoSessionManager(SessionAuthMixin, SessionPeersMixin, SessionContextMilogger.warning("Honcho session '%s' loaded (failed to fetch context: %s)", session_id, e)return []- def _get_or_create_honcho_session(- self, session_id: str, user_peer: Any, assistant_peer: Any,- ) -> tuple[Any, list, dict[str, bool] | None]:- """(honcho_session, existing_messages, observation flags) with peers configured.-- A cached session yields no messages and the flags stored when it was configured."""+ def _get_or_create_honcho_session(self, session_id: str, user_peer: Any, assistant_peer: Any) -> tuple[Any, list, dict[str, bool] | None]:+ """(honcho_session, existing_messages, observation flags) with peers configured; a cached session+ yields no messages and the flags stored when it was configured."""with self._cache_lock:if session_id in self._sessions_cache:logger.debug("Honcho session '%s' retrieved from cache", session_id)@@ -400,9 +397,8 @@ class HonchoSessionManager(SessionAuthMixin, SessionPeersMixin, SessionContextMiexcess -= 1def _flush_session(self, session: HonchoSession) -> bool:- """Write unsynced messages to Honcho synchronously.-- The session's lock keeps the async writer and an exit-time flush_all() from posting the same batch."""+ """Write unsynced messages to Honcho synchronously. The session's lock keeps the async writer and an+ exit-time flush_all() from posting the same batch."""with session._flush_lock:return self._flush_session_locked(session)@@ -474,9 +470,8 @@ class HonchoSessionManager(SessionAuthMixin, SessionPeersMixin, SessionContextMilogger.error("Honcho async writer error: %s", e)def _keep_until_flushed(self, session: HonchoSession) -> None:- """Put an evicted session that still holds unsynced messages back where flush_all() looks.-- When a newer object already owns the key, this one's batch is written now instead."""+ """Put an evicted session that still holds unsynced messages back where flush_all() looks. When a+ newer object already owns the key, this one's batch is written now instead."""with self._cache_lock:current = self._cache.get(session.key)if current is session or not self._has_unsynced(session):@@ -539,9 +534,8 @@ class HonchoSessionManager(SessionAuthMixin, SessionPeersMixin, SessionContextMiself._async_thread.start()def stop_async_writer(self, timeout: float = 10.0) -> None:- """Join the async writer, then drain whatever was queued before the join.-- saveMessages: false never enqueues, so the drain is a no-op there and the exit stays clean."""+ """Join the async writer, then drain whatever was queued before the join. saveMessages: false never+ enqueues, so the drain is a no-op there and the exit stays clean."""with self._async_thread_lock:self._shutting_down = Trueif self._async_queue is not None and self._async_thread is not None and self._async_thread.is_alive():diff --git a/tests/honcho_plugin/test_async_memory.py b/tests/honcho_plugin/test_async_memory.pyindex 9256b4da4f6..e3d6d9d4c39 100644--- a/tests/honcho_plugin/test_async_memory.py+++ b/tests/honcho_plugin/test_async_memory.py@@ -647,18 +647,21 @@ class TestConcurrentFlushSession:mgr._sessions_cache[session.honcho_session_id] = remotereturn remote- def test_racing_flushes_send_the_batch_once(self, make_manager):- mgr = make_manager(write_frequency="turn")- session = _make_session(key="race")- session.add_message("user", "only once")- upload_started = threading.Event()- release_upload = threading.Event()+ def _blocking_remote(self, mgr, session):+ """Remote whose add_messages blocks until the returned release event is set."""+ upload_started, release_upload = threading.Event(), threading.Event()def blocking_add_messages(_messages):upload_started.set()release_upload.wait(timeout=2)- remote = self._wire_remote(mgr, session, blocking_add_messages)+ return self._wire_remote(mgr, session, blocking_add_messages), upload_started, release_upload++ def test_racing_flushes_send_the_batch_once(self, make_manager):+ mgr = make_manager(write_frequency="turn")+ session = _make_session(key="race")+ session.add_message("user", "only once")+ remote, upload_started, release_upload = self._blocking_remote(mgr, session)results = []first = threading.Thread(target=lambda: results.append(mgr._flush_session(session)), daemon=True)second = threading.Thread(target=lambda: results.append(mgr._flush_session(session)), daemon=True)@@ -683,14 +686,7 @@ class TestConcurrentFlushSession:session.add_message("assistant", "hi")with mgr._cache_lock:mgr._cache[session.key] = session- upload_started = threading.Event()- release_upload = threading.Event()-- def blocking_add_messages(_messages):- upload_started.set()- release_upload.wait(timeout=2)-- remote = self._wire_remote(mgr, session, blocking_add_messages)+ remote, upload_started, release_upload = self._blocking_remote(mgr, session)mgr.save(session)assert upload_started.wait(timeout=2), "async writer never started the upload"exit_flush = threading.Thread(target=mgr.flush_all, daemon=True)diff --git a/tests/honcho_plugin/test_session.py b/tests/honcho_plugin/test_session.pyindex 111482353cf..9e11593907a 100644--- a/tests/honcho_plugin/test_session.py+++ b/tests/honcho_plugin/test_session.py@@ -1305,27 +1305,17 @@ def _provider_with_raw(raw, host="hermes"):class TestSessionStartInjection:- def test_unset_renders_every_component_in_fixed_order(self):- formatted = _provider_with_raw({})._format_first_turn_context(_FULL_CTX)- headings = [line for line in formatted.splitlines() if line.startswith("## ")]- assert headings == ["## Session Summary", "## User Representation", "## User Peer Card",- "## AI Self-Representation", "## AI Identity Card"]-- def test_empty_list_means_inject_nothing(self):- raw = {"injection": {"sessionStart": []}}- assert _provider_with_raw(raw)._format_first_turn_context(_FULL_CTX) == ""-- def test_pinned_names_render_in_table_order_not_config_order(self):- raw = {"injection": {"sessionStart": ["aiCard", "summary"]}}+ @pytest.mark.parametrize("raw, headings", [+ ({}, ["## Session Summary", "## User Representation", "## User Peer Card",+ "## AI Self-Representation", "## AI Identity Card"]),+ ({"injection": {"sessionStart": []}}, []),+ ({"injection": {"sessionStart": ["aiCard", "summary"]}}, ["## Session Summary", "## AI Identity Card"]),+ ({"injection": {"sessionStart": ["summary"]}, "hosts": {"hermes": {"injection": {"sessionStart": ["peerCard"]}}}},+ ["## User Peer Card"]),+ ], ids=["unset-renders-all-in-fixed-order", "empty-list-injects-nothing", "pin-keeps-table-order", "host-block-beats-root"])+ def test_pin_selects_the_rendered_components(self, raw, headings):formatted = _provider_with_raw(raw)._format_first_turn_context(_FULL_CTX)- headings = [line for line in formatted.splitlines() if line.startswith("## ")]- assert headings == ["## Session Summary", "## AI Identity Card"]-- def test_host_block_pin_beats_root(self):- raw = {"injection": {"sessionStart": ["summary"]},- "hosts": {"hermes": {"injection": {"sessionStart": ["peerCard"]}}}}- formatted = _provider_with_raw(raw)._format_first_turn_context(_FULL_CTX)- assert "## User Peer Card" in formatted and "## Session Summary" not in formatted+ assert [line for line in formatted.splitlines() if line.startswith("## ")] == headingsdef test_non_list_value_is_treated_as_unset(self):raw = {"injection": {"sessionStart": "summary"}}@@ -1343,37 +1333,26 @@ class TestSessionStartInjection:class TestInjectionAuditLog:- def test_off_by_default(self, monkeypatch):+ @pytest.fixture(autouse=True)+ def _no_logging_env(self, monkeypatch):monkeypatch.delenv("HONCHO_LOGGING", raising=False)monkeypatch.delenv("HONCHO_INJECTION_LOG", raising=False)- assert _provider_with_raw({})._injection_log_path is None- def test_logging_key_enables_default_path(self, monkeypatch):- monkeypatch.delenv("HONCHO_INJECTION_LOG", raising=False)- path = _provider_with_raw({"logging": True})._injection_log_path- assert path is not None and path.endswith("injection.log")-- def test_host_block_can_switch_it_off(self, monkeypatch):- monkeypatch.delenv("HONCHO_LOGGING", raising=False)- monkeypatch.delenv("HONCHO_INJECTION_LOG", raising=False)- raw = {"logging": True, "hosts": {"hermes": {"logging": False}}}+ @pytest.mark.parametrize("raw, env", [+ ({}, None),+ ({"logging": True, "hosts": {"hermes": {"logging": False}}}, None),+ *[({"logging": value}, None) for value in ("false", "0", "no", "off", "")],+ ({}, "off"),+ ])+ def test_stays_off(self, monkeypatch, raw, env):+ if env is not None:+ monkeypatch.setenv("HONCHO_LOGGING", env)assert _provider_with_raw(raw)._injection_log_path is None- @pytest.mark.parametrize("value", ["false", "0", "no", "off", ""])- def test_string_false_values_keep_it_off(self, monkeypatch, value):- monkeypatch.delenv("HONCHO_LOGGING", raising=False)- monkeypatch.delenv("HONCHO_INJECTION_LOG", raising=False)- assert _provider_with_raw({"logging": value})._injection_log_path is None-- @pytest.mark.parametrize("value", ["true", "1", "yes", "on"])- def test_string_true_values_switch_it_on(self, monkeypatch, value):- monkeypatch.delenv("HONCHO_INJECTION_LOG", raising=False)- assert _provider_with_raw({"logging": value})._injection_log_path is not None-- def test_env_off_value_keeps_it_off(self, monkeypatch):- monkeypatch.setenv("HONCHO_LOGGING", "off")- monkeypatch.delenv("HONCHO_INJECTION_LOG", raising=False)- assert _provider_with_raw({})._injection_log_path is None+ @pytest.mark.parametrize("value", [True, "true", "1", "yes", "on"])+ def test_logging_key_switches_on_the_default_path(self, value):+ path = _provider_with_raw({"logging": value})._injection_log_path+ assert path is not None and path.endswith("injection.log")@pytest.mark.skipif(os.name == "nt", reason="POSIX file modes")def test_log_file_is_owner_only(self, tmp_path):diff --git a/tests/test_honcho_session_cache_bounds.py b/tests/test_honcho_session_cache_bounds.pyindex 2c034b962e9..755571556e3 100644--- a/tests/test_honcho_session_cache_bounds.py+++ b/tests/test_honcho_session_cache_bounds.py@@ -161,6 +161,8 @@ def test_get_or_create_triggers_sweep_without_blocking_on_lock_reentrancy():# hard caps, unsynced buffers, peers, and read activity (follows #71463)# ---------------------------------------------------------------------------+import pytest # noqa: E402+from plugins.memory.honcho.session import ( # noqa: E402_PEERS_CACHE_MAX_SIZE,_SESSION_CACHE_MAX_SIZE,@@ -320,27 +322,17 @@ def test_cached_sdk_session_returns_the_flags_stored_for_it():assert mgr._get_or_create_honcho_session("hs-x", None, None) == (sdk, [], flags)-def test_deferred_save_puts_an_evicted_session_back_in_the_cache():[email protected]("synced, kept", [(False, True), (True, False)])+def test_deferred_save_keeps_an_evicted_session_only_while_it_holds_unsynced_messages(synced, kept):"""write_frequency "session" defers to flush_all(), which only sees cached sessions."""mgr = _manager()mgr._write_frequency = "session"session = _session(key="evicted")- session.add_message("user", "unsynced", _synced=False)-- mgr.save(session)-- assert mgr._cache["evicted"] is session---def test_deferred_save_of_a_fully_synced_evicted_session_stays_out_of_the_cache():- mgr = _manager()- mgr._write_frequency = "session"- session = _session(key="done")- session.add_message("user", "old", _synced=True)+ session.add_message("user", "pending", _synced=synced)mgr.save(session)- assert "done" not in mgr._cache+ assert (mgr._cache.get("evicted") is session) is keptdef test_deferred_save_flushes_inline_when_a_newer_object_owns_the_key():diff --git a/tests/test_honcho_startup_fail_open.py b/tests/test_honcho_startup_fail_open.pyindex 3856a0bd7c8..50943fae17e 100644--- a/tests/test_honcho_startup_fail_open.py+++ b/tests/test_honcho_startup_fail_open.py@@ -7,6 +7,8 @@ import threadingimport timefrom types import SimpleNamespace+import pytest+from plugins.memory.honcho import HonchoMemoryProvider@@ -302,51 +304,39 @@ def _init_with_unresolved_peer(monkeypatch, cfg, platform: str = "cli") -> tuplereturn provider, attempts-def test_honcho_unresolved_peer_notices_once_and_stops_retrying(monkeypatch):- """No runtime identity and no peerName: memory stays off for the session, the model hears it- once, and later turns do not re-run init for a config gap that cannot heal (#93326)."""- provider, attempts = _init_with_unresolved_peer(monkeypatch, _configured_hybrid_config())[email protected]("platform, present, absent", [+ ("cli", "hermes honcho peer --user", "Do not suggest peerName"),+ ("telegram", "Do not suggest peerName", "hermes honcho peer --user"),+])+def test_honcho_unresolved_peer_notices_once_and_stops_retrying(monkeypatch, platform, present, absent):+ """No runtime identity and no peerName: memory stays off for the session, the model hears it once, and+ later turns do not re-run init for a config gap that cannot heal (#93326). The notice recommends peerName+ only on a local platform: on a multi-user gateway a shared peerName would merge every human onto one peer."""+ provider, attempts = _init_with_unresolved_peer(monkeypatch, _configured_hybrid_config(), platform=platform)assert provider._manager is Noneassert provider._can_start_init() is Falsenotice = provider.prefetch("what did we decide about the schema?")- assert "Honcho memory is off" in notice- assert "peerName" in notice+ assert "Honcho memory is off" in notice and "peerName" in notice+ assert present in notice and absent not in noticeassert provider.prefetch("second question") == ""provider.sync_turn("hello", "world")assert attempts == [1]-def test_honcho_unresolved_peer_tool_error_names_the_fix(monkeypatch):- provider, _ = _init_with_unresolved_peer(monkeypatch, _configured_tools_config(init_on_session_start=True))-- result = json.loads(provider.handle_tool_call("honcho_profile", {"peer": "user"}))-- assert "peerName" in result["error"]- assert "hermes honcho peer --user" in result["error"]- assert "could not be initialized" not in result["error"]---def test_honcho_unresolved_peer_on_a_gateway_platform_does_not_recommend_peer_name(monkeypatch):- """A shared peerName on a multi-user gateway would merge every human onto one peer."""- provider, _ = _init_with_unresolved_peer(monkeypatch, _configured_hybrid_config(), platform="telegram")-- notice = provider.prefetch("what did we decide about the schema?")-- assert "Honcho memory is off" in notice- assert "hermes honcho peer --user" not in notice- assert "Do not suggest peerName" in notice---def test_honcho_unresolved_peer_tool_error_on_a_gateway_platform_omits_the_peer_name_fix(monkeypatch):[email protected]("platform, present, absent", [+ ("cli", "hermes honcho peer --user", "could not be initialized"),+ ("discord", "supplied no user id", "hermes honcho peer --user"),+])+def test_honcho_unresolved_peer_tool_error_names_the_fix_for_the_platform(monkeypatch, platform, present, absent):cfg = _configured_tools_config(init_on_session_start=True)- provider, _ = _init_with_unresolved_peer(monkeypatch, cfg, platform="discord")+ provider, _ = _init_with_unresolved_peer(monkeypatch, cfg, platform=platform)result = json.loads(provider.handle_tool_call("honcho_profile", {"peer": "user"}))- assert "hermes honcho peer --user" not in result["error"]- assert "supplied no user id" in result["error"]+ assert "peerName" in result["error"]+ assert present in result["error"] and absent not in result["error"]def test_honcho_tools_lazy_hooks_do_not_prestart_background_init(monkeypatch):diff --git a/tests/test_tui_gateway_server.py b/tests/test_tui_gateway_server.pyindex e3c413a9816..ac012b0f11d 100644--- a/tests/test_tui_gateway_server.py+++ b/tests/test_tui_gateway_server.py@@ -4562,46 +4562,26 @@ def _capture_make_agent_kwargs(monkeypatch) -> dict:return captured-def test_make_agent_passes_the_authenticated_dashboard_user_as_user_id(monkeypatch):- """The identity stamped at WS-upgrade auth (WSTransport.auth_identity) reaches the agent as- ``user_id``, the same kwarg gateways pass, so memory providers scope memory to the login."""- captured = _capture_make_agent_kwargs(monkeypatch)- transport = types.SimpleNamespace(auth_identity={"user_id": "oidc|abc123", "provider": "oidc"})- monkeypatch.setitem(server._sessions, "sid-auth", {"session_key": "k", "transport": transport})-- server._make_agent("sid-auth", "k")-- assert captured["user_id"] == "oidc:oidc|abc123"---def test_make_agent_keeps_same_named_users_of_two_login_providers_apart(monkeypatch):- """A basic-auth ``alice`` and an OIDC ``alice`` are two people and must not share one memory peer."""- seen = []- for provider in ("basic", "oidc"):- captured = _capture_make_agent_kwargs(monkeypatch)- transport = types.SimpleNamespace(auth_identity={"user_id": "alice", "provider": provider})- monkeypatch.setitem(server._sessions, f"sid-{provider}", {"session_key": "k", "transport": transport})- server._make_agent(f"sid-{provider}", "k")- seen.append(captured["user_id"])- assert seen == ["basic:alice", "oidc:alice"]--[email protected]("identity", [- None,- {"user_id": "server-internal", "provider": "server-internal"},- {"user_id": "", "provider": "oidc"},- {"user_id": "abc", "provider": ""},[email protected]("identity, user_id", [+ ({"user_id": "oidc|abc123", "provider": "oidc"}, "oidc:oidc|abc123"),+ ({"user_id": "alice", "provider": "basic"}, "basic:alice"),+ ({"user_id": "alice", "provider": "oidc"}, "oidc:alice"),+ (None, None),+ ({"user_id": "server-internal", "provider": "server-internal"}, None),+ ({"user_id": "", "provider": "oidc"}, None),+ ({"user_id": "abc", "provider": ""}, None),])-def test_make_agent_passes_no_user_id_without_an_authenticated_human(monkeypatch, identity):- """Legacy token, stdio and the PTY child's server-internal credential name no human. The- agent must not receive a user id memory would treat as a person."""+def test_make_agent_passes_the_authenticated_dashboard_user_as_user_id(monkeypatch, identity, user_id):+ """WSTransport.auth_identity reaches the agent as ``user_id`` prefixed with the login provider, so a+ basic-auth ``alice`` and an OIDC ``alice`` stay two memory peers. The legacy token, stdio and the PTY+ child's server-internal credential name no human, so the agent gets no user id for them."""captured = _capture_make_agent_kwargs(monkeypatch)transport = types.SimpleNamespace(auth_identity=identity)- monkeypatch.setitem(server._sessions, "sid-anon", {"session_key": "k", "transport": transport})+ monkeypatch.setitem(server._sessions, "sid-auth", {"session_key": "k", "transport": transport})- server._make_agent("sid-anon", "k")+ server._make_agent("sid-auth", "k")- assert captured["user_id"] is None+ assert captured["user_id"] == user_iddef test_make_agent_passes_no_user_id_for_an_unknown_session(monkeypatch):diff --git a/tui_gateway/server.py b/tui_gateway/server.pyindex aba4a77e8ca..b728c36f119 100644--- a/tui_gateway/server.py+++ b/tui_gateway/server.py@@ -2256,10 +2256,9 @@ def _startup_system_prompt(cfg: dict, task_id: str) -> str:def _session_auth_user_id(session: dict | None) -> str | None:- """``<provider>:<user id>`` the WS-upgrade credential authenticated for ``session``'s transport.-- None for the legacy token, stdio, and the server-internal credential the PTY child connects with.- The provider prefix keeps a basic-auth ``alice`` and an OIDC ``alice`` apart."""+ """``<provider>:<user id>`` the WS-upgrade credential authenticated for ``session``'s transport, or None for+ the legacy token, stdio and the PTY child's server-internal credential. The prefix keeps a basic-auth ``alice``+ and an OIDC ``alice`` apart."""identity = getattr((session or {}).get("transport"), "auth_identity", None)if _methods_browser_control._is_authenticated_identity(identity):return f"{str(identity['provider']).strip()}:{str(identity['user_id']).strip()}"