diff --git a/docs/architecture/rfcs/monorepo-distribution-split-v0.md b/docs/architecture/rfcs/monorepo-distribution-split-v0.md index 07588c657f..7b4147970e 100644 --- a/docs/architecture/rfcs/monorepo-distribution-split-v0.md +++ b/docs/architecture/rfcs/monorepo-distribution-split-v0.md @@ -4088,3 +4088,29 @@ File/SQLite negative cases guard this boundary without changing valid activation V1–V5/V10, R1/M3, current D2/D5 closure, actual Host/model context adoption, progressive product control, comparable complete costs, C1 default cutover and original-Goal regression remain open. + +### 2026-11-14 — Disabled Turn recall defers execution dependencies + +- **Baseline:** `main@4604f938b612`; C1 #8266 at `79d7ebc81fbc`. +- **Gap:** independent Core File/SQLite Turn journals report recall disabled, + no context and zero provider calls, yet admission imports the recall execution + hook and read-authority implementation through the recall package. +- **Delta:** the existing recall and checkpoint functions import those two + implementations when called. Experiment resolution, ingest reconciliation, + schema ownership, exported function identity, permissions and C1 composition + remain with their existing owners. No shared orchestration or default changes. +- **Evidence:** the disabled helper cases and the actual installed CLI cases + fail on the baseline and pass on the repair. The capability regression covers + active recall, authority rejection, provider failure, deduplication and outcome + lifecycle. Independent Core installation, execution, interruption/recovery, + replay and context suites pass on main and the pinned C1 combination; runtime + bytes match their declared sources. Observed initial File/SQLite Turns load + 514 rather than 516 Python modules, with 100 rather than 102 capability modules; + RPC counts remain 223/222, and replay remains 432/50 modules with 12 RPCs. + Four observed Node launches are two version probes and two instrumented + runtime/Host-bridge processes. This is a loading-boundary result; instrumented + elapsed times do not qualify latency or complete cost. +- **Remaining:** built-in capability packaging and complete D2/D5 closure, + actual model/Host context adoption, progressive controls, comparable complete + costs, full V1–V5/V10, R1/M3 and C1 default cutover remain unqualified. The + process Host and native context events are synthetic fixtures. diff --git a/docs/architecture/rfcs/monorepo-distribution-split-v0.zh-CN.md b/docs/architecture/rfcs/monorepo-distribution-split-v0.zh-CN.md index b06b17be9f..c94ea5e1fe 100644 --- a/docs/architecture/rfcs/monorepo-distribution-split-v0.zh-CN.md +++ b/docs/architecture/rfcs/monorepo-distribution-split-v0.zh-CN.md @@ -3179,3 +3179,23 @@ R1/M3、C1 切换和原目标回归仍未完成资格验证。 - **剩余:**本切片修复消费者资格的前置缺口。完整 V1–V5/V10、R1/M3、 当前 D2/D5 闭包、真实 Host/模型上下文采用、渐进产品控制、可比完整成本、 C1 默认切换和原 Goal 回归仍开放。 + +### 2026-11-14 — 禁用 Turn 召回延迟加载执行依赖 + +- **基线:**`main@4604f938b612`;C1 #8266 为 `79d7ebc81fbc`。 +- **缺口:**独立 Core 的 File/SQLite Turn journal 记录召回关闭、无上下文和 + 零 provider 调用,但准入仍经召回 package 导入执行 hook 和读权限实现。 +- **交付:**既有召回和 checkpoint 函数在实际调用时导入这两个实现。实验解析、 + ingest reconciliation、schema owner、导出函数标识、权限和 C1 composition + 保留既有 owner。共享编排和默认行为均未改变。 +- **证据:**禁用 helper 用例和真实安装 CLI 用例在基线上失败、修复后通过。 + capability 回归覆盖启用召回、权限拒绝、provider 故障、去重和 outcome lifecycle。 + 独立 Core 的安装、执行、中断恢复、重放与上下文套件在主干及固定 C1 组合上 + 通过,runtime 字节与声明的源码相同。观测到的首次 File/SQLite Turn 从 + 516 个 Python 模块降为 514 个,capability 模块从 102 个降为 100 个; + RPC 仍为 223/222,重放仍为 432/50 个模块及 12 次 RPC。四次 Node 启动 + 分别是两次版本探测,以及两个已加观测的 runtime/Host bridge 进程。 + 这只验证加载边界,带观测开销的耗时不构成延迟或完整成本资格。 +- **剩余:**内置 capability 打包与完整 D2/D5 闭包、真实模型/Host 上下文采用、 + 渐进控制、可比完整成本、完整 V1–V5/V10、R1/M3 和 C1 默认切换仍未完成 + 资格验证。进程 Host 与 native context 事件属于 synthetic fixture。 diff --git a/loopx/capabilities/agent_turn_recall/core.py b/loopx/capabilities/agent_turn_recall/core.py index 7bf8c42742..631c99a262 100644 --- a/loopx/capabilities/agent_turn_recall/core.py +++ b/loopx/capabilities/agent_turn_recall/core.py @@ -7,7 +7,6 @@ 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 AGENT_TURN_SITUATION_SCHEMA_VERSION = "agent_turn_situation_v0" @@ -215,6 +214,8 @@ def run_agent_turn_recall( ) -> dict[str, Any]: """Recall guidance and inject it into this turn's private reasoning context.""" + from ..reward_memory.runtime_hooks import run_reward_memory_automatic_recall_hook + query = _turn_query(situation) context = { "schema_version": AGENT_TURN_RECALL_CONTEXT_SCHEMA_VERSION, diff --git a/loopx/capabilities/agent_turn_recall/runtime.py b/loopx/capabilities/agent_turn_recall/runtime.py index 441519e71b..5eaca95d6f 100644 --- a/loopx/capabilities/agent_turn_recall/runtime.py +++ b/loopx/capabilities/agent_turn_recall/runtime.py @@ -17,7 +17,6 @@ resolve_reward_memory_experiment, resolve_reward_memory_surface_config, ) -from ..reward_memory.read_authority import build_reward_memory_surface_read_authority_checkpoints from .core import ( AGENT_TURN_RECALL_SCHEMA_VERSION, AGENT_TURN_RECALL_SURFACE_ID, @@ -150,6 +149,8 @@ def resolve_reward_memory_turn_session_ref( def reward_memory_turn_read_authority_checkpoints( config: Mapping[str, Any], goal_id: str ) -> dict[str, dict[str, Any]]: + from ..reward_memory.read_authority import build_reward_memory_surface_read_authority_checkpoints + return build_reward_memory_surface_read_authority_checkpoints( config, AGENT_TURN_RECALL_SURFACE_ID, verified=True, source_ref=f"registry:{goal_id}:reward-memory", diff --git a/tests/capabilities/test_context_provider_loading.py b/tests/capabilities/test_context_provider_loading.py index 8e3ec73462..58232f774f 100644 --- a/tests/capabilities/test_context_provider_loading.py +++ b/tests/capabilities/test_context_provider_loading.py @@ -156,7 +156,35 @@ def test_disabled_retirement_context_does_not_select_inspector() -> None: """) -@pytest.mark.parametrize("package", ["context_providers", "anti_entropy"]) +@pytest.mark.parametrize("configured", [False, True]) +def test_disabled_turn_recall_does_not_select_execution_helpers(configured: bool) -> None: + _run(f""" + import sys + from pathlib import Path + from loopx.capabilities.agent_turn_recall import runtime + calls = [] + status = {{'status': 'disabled', 'automatic_recall': False}} + config = {{'automation': {{'automatic_ingest': False, 'automatic_recall': False}}}} if {configured!r} else None + def resolve(**kwargs): + calls.append(kwargs) + return status, config + runtime.resolve_reward_memory_experiment = resolve + result = runtime.run_configured_agent_turn_recall_fail_open( + registry_path=Path('fixture-registry.json'), goal_id='fixture-goal', + agent_id='fixture-agent', quota_decision={{}}, turn_instance_id='fixture-turn', + execute=True) + assert len(calls) == 1 + assert result['status'] == ('explicitly_disabled' if {configured!r} else 'disabled') + assert result['context'] is None and result['provider_call_count'] == 0 + assert result['quota_spend_performed'] is False + assert result['external_writes_performed'] is False + assert result['grants_new_action_authority'] is False + assert 'loopx.capabilities.reward_memory.runtime_hooks' not in sys.modules + assert 'loopx.capabilities.reward_memory.read_authority' not in sys.modules + """) + + +@pytest.mark.parametrize("package", ["context_providers", "anti_entropy", "agent_turn_recall"]) @pytest.mark.parametrize("mode", ["attribute", "from", "star"]) def test_explicit_exports_remain_original_owner_objects( package: str, mode: str @@ -179,9 +207,13 @@ def test_explicit_exports_remain_original_owner_objects( owner = importlib.import_module(name + '.factory') assert namespace['build_context_provider'] is owner.build_context_provider assert namespace['OpenVikingContextProvider'] is importlib.import_module(name + '.openviking').OpenVikingContextProvider - else: + elif {package!r} == 'anti_entropy': owner = importlib.import_module(name + '.agent_tool') assert namespace['anti_entropy_inspect'] is owner.anti_entropy_inspect + else: + owner = importlib.import_module(name + '.runtime') + assert namespace['run_configured_agent_turn_recall'] is owner.run_configured_agent_turn_recall + assert namespace['run_agent_turn_recall'] is importlib.import_module(name + '.core').run_agent_turn_recall try: getattr(module, 'missing_fixture_export') except AttributeError: diff --git a/tests/test_core_distribution.py b/tests/test_core_distribution.py index 398b14d520..fac7542fd6 100644 --- a/tests/test_core_distribution.py +++ b/tests/test_core_distribution.py @@ -79,9 +79,13 @@ def core_python(): def _command(python, arguments): # -I excludes PYTHONPATH and the current directory. No product import may # resolve to the parent test's editable source checkout. - return [python, "-I", "-c", - "import json,sys;from loopx.entrypoint import main;raise SystemExit(main(json.loads(sys.argv[1])))", - json.dumps(arguments)] + source = "import json,sys;from loopx.entrypoint import main;code=main(json.loads(sys.argv[1]));" + if any(arguments[index:index + 2] == ["turn", "run-once"] for index in range(len(arguments) - 1)): + # These task fixtures leave reward memory disabled. Check the executed + # CLI and replay rather than inferring their closure from helper tests. + source += ("assert 'loopx.capabilities.reward_memory.runtime_hooks' not in sys.modules;" + "assert 'loopx.capabilities.reward_memory.read_authority' not in sys.modules;") + return [python, "-I", "-c", source + "raise SystemExit(code)", json.dumps(arguments)] def _environment(python, overrides=None):