diff --git a/loopx/capabilities/agent_turn_recall/core.py b/loopx/capabilities/agent_turn_recall/core.py index bce98d2a15..7bf8c42742 100644 --- a/loopx/capabilities/agent_turn_recall/core.py +++ b/loopx/capabilities/agent_turn_recall/core.py @@ -1,10 +1,10 @@ from __future__ import annotations -import hashlib import json from collections.abc import Mapping, Sequence from typing import Any +from ...control_plane.digest_envelope import sha256_envelope from ...control_plane.runtime.public_safety import public_safe_compact_text from ..context_providers.base import ContextProvider from ..reward_memory.runtime_hooks import run_reward_memory_automatic_recall_hook @@ -32,7 +32,7 @@ def _canonical_hash(value: object) -> str: sort_keys=True, separators=(",", ":"), ).encode("utf-8") - return "sha256:" + hashlib.sha256(encoded).hexdigest() + return sha256_envelope(encoded) def _recent_outcomes(quota_decision: Mapping[str, Any]) -> list[str]: diff --git a/tests/architecture/test_content_digest_production_owner.py b/tests/architecture/test_content_digest_production_owner.py index e0f21f04d9..e42a176b75 100644 --- a/tests/architecture/test_content_digest_production_owner.py +++ b/tests/architecture/test_content_digest_production_owner.py @@ -30,6 +30,7 @@ import pytest +from loopx.capabilities.agent_turn_recall import core from loopx.capabilities.periodic_report import ( archive, audience, @@ -58,7 +59,10 @@ PRODUCTION_OWNER = "loopx/control_plane/digest_envelope.py" ENVELOPE = "sha256:" -CONVERTED_SURFACES = ("loopx/capabilities/periodic_report",) +CONVERTED_SURFACES = ( + "loopx/capabilities/agent_turn_recall", + "loopx/capabilities/periodic_report", +) def _fold_joined_prefix(node: ast.JoinedStr, scope: Any) -> str | None: @@ -297,6 +301,7 @@ def _reference(data: bytes) -> str: @pytest.mark.parametrize( "helper,expected", [ + (core._canonical_hash, _reference(_canonical(SAMPLE))), (bindings._sha256, _reference(_canonical(SAMPLE))), (audience._digest, _reference(_canonical(SAMPLE))), (machine_defaults._digest, _reference(_canonical(SAMPLE))),