Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions loopx/capabilities/agent_turn_recall/core.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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]:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@

import pytest

from loopx.capabilities.agent_turn_recall import core
from loopx.capabilities.periodic_report import (
archive,
audience,
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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))),
Expand Down
Loading