Skip to content
Open
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
9 changes: 6 additions & 3 deletions loopx/capabilities/reward_memory/experiment.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@
from ..context_providers import build_context_provider
from ..context_providers.base import ContextProvider
from ..context_providers.openviking_scope import classify_openviking_scope
from .application import TOKEN_RE, normalize_reward_memory_provider_binding
from .application import (
RECALL_MODES,
TOKEN_RE,
normalize_reward_memory_provider_binding,
)
from .ingestion import normalize_reward_memory_standing_policy
from .registry import MAX_CORPORA, normalize_reward_memory_corpus
from .scoped_feedback import SCOPED_FEEDBACK_ADAPTER
Expand Down Expand Up @@ -63,7 +67,6 @@
}
_RECALL_PROFILE_FIELDS = {"profile_id", "mode", "max_queries", "limit"}
_AUTOMATION_FIELDS = {"automatic_recall", "automatic_ingest", "fail_open"}
_RECALL_MODES = {"function_boundary", "bounded_agentic_search"}


def canonical_reward_memory_actor_peer_id(*, goal_id: str, agent_id: str) -> str:
Expand Down Expand Up @@ -589,7 +592,7 @@ def _normalize_v1(raw: Mapping[str, Any]) -> dict[str, Any]:
allowed=_RECALL_PROFILE_FIELDS,
)
mode = str(profile.get("mode") or "").strip()
if mode not in _RECALL_MODES:
if mode not in RECALL_MODES:
raise ValueError("recall_profile.mode is unsupported")
profile_id = str(profile.get("profile_id") or "").strip()
if not profile_id:
Expand Down
8 changes: 4 additions & 4 deletions loopx/capabilities/reward_memory/utility_reducer.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
from .memory_utility import (
ATTRIBUTION_LEVELS,
RewardMemoryUtilityObservationValidationError,
_MEMORY_REF_DIGEST_RE,
_OPAQUE_REF_RE,
_SCOPE_FIELDS,
validate_reward_memory_utility_observation,
)
Expand All @@ -37,8 +39,6 @@
MAX_REVIEW_REASON_CODES = 12
MAX_HISTORY_EVIDENCE_REFS = 16

_REF_RE = re.compile(r"^[A-Za-z0-9][A-Za-z0-9_.:-]{0,199}$")
_MEMORY_DIGEST_RE = re.compile(r"^(?:[0-9a-f]{16}|sha256:[0-9a-f]{64})$")
_OBSERVATION_ID_RE = re.compile(r"^muo_[0-9a-f]{64}$")
_EVIDENCE_ORDER = (
"insufficient",
Expand Down Expand Up @@ -91,7 +91,7 @@ def _ref(value: object, label: str) -> str:
result = value.strip()
if (
result != value
or not _REF_RE.fullmatch(result)
or not _OPAQUE_REF_RE.fullmatch(result)
or "://" in result
or PurePosixPath(result).is_absolute()
or PureWindowsPath(result).is_absolute()
Expand All @@ -113,7 +113,7 @@ def _memory_digests(value: object, label: str) -> list[str]:
result = []
for item in value:
digest = _ref(item, label)
if not _MEMORY_DIGEST_RE.fullmatch(digest):
if not _MEMORY_REF_DIGEST_RE.fullmatch(digest):
raise ValueError(f"{label} must contain canonical memory digests")
result.append(digest)
if result != value or result != sorted(result) or len(set(result)) != len(result):
Expand Down
Loading
Loading