diff --git a/apps/presentation/dashboard/src/features/personal-workspace/machine-configuration-settings.tsx b/apps/presentation/dashboard/src/features/personal-workspace/machine-configuration-settings.tsx
index 5688bfe7d3..8189af30ad 100644
--- a/apps/presentation/dashboard/src/features/personal-workspace/machine-configuration-settings.tsx
+++ b/apps/presentation/dashboard/src/features/personal-workspace/machine-configuration-settings.tsx
@@ -529,15 +529,17 @@ export function MachineConfigurationSettings({ section, onChanged }: {
Codex
void setContextDelivery(event.target.checked ? "on" : "off")} />
- {selectedCurrent?.mode === "on"
- ? locale === "zh-CN" ? "已为 Codex 保存开启偏好;宿主就绪与实际使用尚未验证。" : "Codex preference is on; host readiness and actual use are not verified."
- : locale === "zh-CN" ? "Codex 未开启。" : "Off for Codex."}
+ {(selectedCurrent?.mode ?? selected.default?.mode) === "on"
+ ? selectedCurrent
+ ? locale === "zh-CN" ? "已开启;原生初始化与实际使用尚未验证。" : "On; native setup and use unverified."
+ : locale === "zh-CN" ? "默认开启;原生初始化与实际使用尚未验证。" : "Default on; native setup and use unverified."
+ : locale === "zh-CN" ? "Codex 已关闭。" : "Off for Codex."}
{locale === "zh-CN"
- ? "目前仅支持 Codex App 心跳和 benchmark 心跳,无法确认或不支持的跑法报错。保存偏好不代表当前会话已采用差分,也不会改变其他应用或显式关闭的实验。宿主准备就绪且旧上下文完整时才使用差分,否则保留完整上下文。私有存储与会话隔离自动管理;每轮回执显示实际传输方式。"
- : "Currently supports only Codex App and benchmark heartbeats; unknown or unsupported declarations return an error. Saving a preference does not establish use in the current session or change other applications or explicitly disabled runs. Delta requires a ready host and complete retained context; otherwise full context is preserved. Private storage and session isolation are automatic; each delivery reports its actual mode."}
+ ? "受支持的 POSIX Codex App/SSH 和 benchmark 心跳默认开启;已保存的关闭继续生效,benchmark trial 可单独显式关闭。其他应用和平台保留完整交付;显式开启遇到未知或冲突跑法会报错。保存偏好不代表当前会话已采用差分。宿主就绪且旧上下文完整时才使用差分,否则完整恢复;私有存储与会话隔离自动管理。"
+ : "Defaults on for supported POSIX Codex App/SSH and benchmark heartbeats. Saved off is preserved; benchmark trials can explicitly disable it independently. Other applications and platforms retain full delivery. Explicit on rejects unknown or conflicting modes. Saving a preference does not establish current-session adoption. Delta needs a ready host and complete retained context; otherwise full context is restored. Private storage and session isolation are automatic."}
: null}
{editorAvailable && selected.capability_id !== "context_delivery" ? <>{editorMode === "json" || !selected.configuration_editor.fields.some((field) => field.key === "enabled" && field.input_kind === "boolean") ?
changeMode(editorMode === "guided" ? "json" : "guided")} type="button">
diff --git a/benchmark/README.md b/benchmark/README.md
index ce3f038d86..f4bb9b95ea 100644
--- a/benchmark/README.md
+++ b/benchmark/README.md
@@ -878,7 +878,10 @@ must actually deliver a complete full packet and later deltas across worker
wakes; every fresh receiver must begin with a complete current full packet.
The static inference follows model-visible page cursors, and a separate byte-map
oracle checks complete delivery and retained delta bases before candidate work.
-The default remains `off`. Neither mode measures paid inference, task quality or
+This joint qualifier deliberately retains its explicit `off` control by default;
+new benchmark heartbeat workers default on and can select `--context-delivery off`.
+Do not mutate a frozen trial to adopt that changed default.
+Neither qualifier mode measures paid inference, task quality or
fees; reusing a point still does not count its source test as passed in this run.
The public fixture runs six actual native work wakes, captures the pending
diff --git a/benchmark/edgebench/run.py b/benchmark/edgebench/run.py
index 98f65a8f5e..2068e743f7 100644
--- a/benchmark/edgebench/run.py
+++ b/benchmark/edgebench/run.py
@@ -29,7 +29,7 @@
from sforge.harness.run_agent import run_agent
from sforge.harness.task_spec import make_task_spec
-from benchmark.runtime.codex import TASK_ENTRIES, turn_envelope_receipt
+from benchmark.runtime.codex import Execution, TASK_ENTRIES, turn_envelope_receipt
from loopx.reasoning_effort import REASONING_EFFORTS
from loopx.control_plane.work_items.stride_policy_codec import stride_strategy_options
from benchmark.runtime.sforge import (
@@ -121,8 +121,8 @@ def main(argv=None):
help="New-run default: native public feedback; blind/best-only are explicit controls")
parser.add_argument("--turn-envelope", action="store_true",
help="Opt-in short heartbeat context with same-invocation full captures")
- parser.add_argument("--context-delivery", choices=("off", "on"), default="off",
- help="Experimental native Codex benchmark heartbeat reuse only; off by default")
+ parser.add_argument("--context-delivery", choices=("off", "on"),
+ help="Native Codex context delivery: on by default for heartbeat workers; pass off to disable")
parser.add_argument("--provider-request-admission", action="store_true",
help="Opt-in canonical admission before each heartbeat custom Responses request")
parser.add_argument("--native-goal-continue", action="store_true",
@@ -197,6 +197,8 @@ def main(argv=None):
parser.error("--task-entry loopx-planned requires a heartbeat worker")
if args.turn_envelope and args.worker not in {"heartbeat-resume", "heartbeat-explore"}:
parser.error("--turn-envelope requires a heartbeat worker")
+ if args.context_delivery is None:
+ args.context_delivery = Execution(mode="heartbeat" if args.worker.startswith("heartbeat-") else "plain").context_delivery
if args.context_delivery != "off" and not args.worker.startswith("heartbeat-"):
parser.error("--context-delivery requires a heartbeat worker")
if args.provider_request_admission:
diff --git a/benchmark/runtime/RUNTIME.md b/benchmark/runtime/RUNTIME.md
index bc81447238..0612e59cf7 100644
--- a/benchmark/runtime/RUNTIME.md
+++ b/benchmark/runtime/RUNTIME.md
@@ -45,13 +45,17 @@ fail before execution. Set it back to `false` for the next run to roll back;
do not change a running trial's treatment. Captures contain private Goal context.
Transport tests do not establish lower token cost or better model decisions.
-For an explicitly selected native context-delivery treatment, add
-`context_delivery: "on"` to the same heartbeat agent `kwargs` (default `"off"`).
+New native heartbeat trials default to context delivery `on`. Add
+`context_delivery: "off"` to the same heartbeat agent `kwargs` to disable it.
+An explicit off is pinned into both native tools and worker preflight; it cannot
+inherit a machine-wide on. Plain, native-Goal and Turn execution remain off.
Only the existing Codex heartbeat worker accepts `"on"`; booleans, other modes and
scenario names are rejected. This is an experimental transport setting, separate
from `turn_envelope`.
The existing EdgeBench/SForge entry exposes the same selection through
-`--context-delivery on` on a heartbeat worker (`off` is the default).
+`--context-delivery off` to disable a heartbeat worker's on default. Existing
+running or frozen trials retain their recorded source and treatment; do not
+change them in place or infer a matched comparison from the new default.
The worker preserves its existing `generic_cli` scheduler profile. Its execution
owner requires `mode=heartbeat` and explicitly propagates `LOOPX_EXECUTION_MODE=heartbeat`
and `LOOPX_CONTEXT_DELIVERY=on` into the native tool environment. Generic CLI
diff --git a/benchmark/runtime/codex.py b/benchmark/runtime/codex.py
index 35980340a1..203c560678 100644
--- a/benchmark/runtime/codex.py
+++ b/benchmark/runtime/codex.py
@@ -28,11 +28,13 @@ class Execution:
validation_command: tuple[str, ...] = ()
task_entry: str | None = None
turn_envelope: bool = False
- context_delivery: str = "off"
+ context_delivery: str | None = None
def __post_init__(self) -> None:
if self.context is None:
object.__setattr__(self, "context", "resume" if self.mode in {"heartbeat", "turn"} else "fresh")
+ if self.context_delivery is None:
+ object.__setattr__(self, "context_delivery", "on" if self.mode == "heartbeat" else "off")
if self.context_delivery not in ("off", "on") or (self.context_delivery != "off" and self.mode != "heartbeat"):
raise ValueError("context_delivery supports only off or on with heartbeat execution")
if not isinstance(self.turn_envelope, bool) or (self.turn_envelope and self.mode != "heartbeat"):
@@ -157,7 +159,8 @@ def codex_settings(
# policy explicitly so model tools cannot silently lose it.
"[shell_environment_policy.set]",
'LOOPX_USAGE_PING = "0"',
- *(['LOOPX_CONTEXT_DELIVERY = "on"', 'LOOPX_EXECUTION_MODE = "heartbeat"'] if execution.context_delivery != "off" else []),
+ f"LOOPX_CONTEXT_DELIVERY = {json.dumps(execution.context_delivery)}",
+ *(['LOOPX_EXECUTION_MODE = "heartbeat"'] if execution.context_delivery != "off" else []),
"[features]",
f"goals = {str(execution.native_goal).lower()}",
"unified_exec = true",
diff --git a/benchmark/runtime/harbor.py b/benchmark/runtime/harbor.py
index 8733c3873d..e5f355fb05 100644
--- a/benchmark/runtime/harbor.py
+++ b/benchmark/runtime/harbor.py
@@ -74,7 +74,7 @@ def __init__(
task_entry=None,
planning_timeout_sec=None,
turn_envelope=False,
- context_delivery="off",
+ context_delivery=None,
provider_request_admission=False,
native_goal_continue=False,
task_objective=None,
@@ -634,7 +634,7 @@ def _worker_env(self, *, cwd: str) -> dict[str, str]:
**({"LOOPX_CHECKPOINT_REQUEST": self.checkpoint_request_path}
if self.checkpoint_request_path is not None else {}),
**({"LOOPX_TURN_ENVELOPE": "1"} if self.execution.turn_envelope else {}),
- **({"LOOPX_CONTEXT_DELIVERY": "on"} if self.execution.context_delivery != "off" else {}),
+ "LOOPX_CONTEXT_DELIVERY": self.execution.context_delivery,
**({"LOOPX_PROVIDER_REQUEST_ADMISSION": "on"} if self.provider_request_admission else {}),
**({"LOOPX_NATIVE_GOAL_CONTINUE": "1"} if self.native_goal_continue else {}),
"LOOPX_ITERATION_CONTEXT": self.execution.context,
diff --git a/benchmark/runtime/sforge.py b/benchmark/runtime/sforge.py
index 3ccb5e10cc..634647543d 100644
--- a/benchmark/runtime/sforge.py
+++ b/benchmark/runtime/sforge.py
@@ -93,7 +93,7 @@ def __init__(self, config, *, profile: str, cwd: str,
task_objective: str | None = None,
task_entry: str | None = None,
turn_envelope: bool = False,
- context_delivery: str = "off",
+ context_delivery: str | None = None,
provider_request_admission: bool = False,
native_goal_continue: bool = False,
replan_after_turns: int | None = None,
diff --git a/benchmark/runtime/worker.py b/benchmark/runtime/worker.py
index 6603790d58..27f431c1c1 100644
--- a/benchmark/runtime/worker.py
+++ b/benchmark/runtime/worker.py
@@ -450,6 +450,10 @@ def native_command(env, execution, stage, wake, session_wake):
)
if execution.context_delivery != "off":
command[-1:-1] = json.loads(env.get("LOOPX_CODEX_CONTEXT_TRUST_ARGS", "[]"))
+ if env.get("LOOPX_CONTEXT_DELIVERY") == "off":
+ # Setup failure narrows this wake to full delivery, including the
+ # native shell whose frozen settings still record the requested on.
+ command[-1:-1] = ["-c", 'shell_environment_policy.set.LOOPX_CONTEXT_DELIVERY="off"']
if stage == "plan":
command[-1:-1] = ["-c", "features.goals=false"]
return command
@@ -490,7 +494,7 @@ def run_once(env: dict[str, str]) -> dict:
validation_command=json.loads(env.get("LOOPX_VALIDATION_COMMAND_JSON", "[]")),
task_entry=env.get("LOOPX_TASK_ENTRY"),
turn_envelope=env.get("LOOPX_TURN_ENVELOPE", "0") == "1",
- context_delivery=env.get("LOOPX_CONTEXT_DELIVERY", "off"),
+ context_delivery=env.get("LOOPX_CONTEXT_DELIVERY"),
)
request_admission = False
if env.get("LOOPX_PROVIDER_REQUEST_ADMISSION", "off") != "off":
@@ -512,7 +516,7 @@ def run_once(env: dict[str, str]) -> dict:
home = Path(env["LOOPX_CODEX_HOME"])
env = process_environment(home, base=env)
# Preserve this trial's resolved off/on choice in both preflight and solver
- # subprocesses; an omitted off must not inherit a machine-wide opt-in.
+ # subprocesses; an explicit off must not inherit a machine-wide default.
env["LOOPX_CONTEXT_DELIVERY"] = execution.context_delivery
# The resolved trial treatment must not inherit an ambient parent opt-in.
if request_admission:
@@ -602,6 +606,7 @@ def run_once(env: dict[str, str]) -> dict:
# trial. Unavailable native hooks keep ordinary full IO.
env.pop("LOOPX_CODEX_CONTEXT_DIR", None)
env.pop("LOOPX_CODEX_CONTEXT_TRUST_ARGS", None)
+ env["LOOPX_CONTEXT_DELIVERY"] = "off"
receipt["context_transport"] = {"available": False, **_error_tail(exc)}
body = "Finish the task."
if stage == "plan":
diff --git a/benchmark/tests/test_resume_sessions.py b/benchmark/tests/test_resume_sessions.py
index 45fa067eaf..ef82ff3bff 100644
--- a/benchmark/tests/test_resume_sessions.py
+++ b/benchmark/tests/test_resume_sessions.py
@@ -122,6 +122,8 @@ def resume_env(tmp_path, monkeypatch):
skills.mkdir()
env.update(
LOOPX_EXECUTION_MODE="heartbeat",
+ # These legacy resume fixtures pin their original transport treatment.
+ LOOPX_CONTEXT_DELIVERY="off",
LOOPX_ITERATION_CONTEXT="resume",
LOOPX_RUNTIME_ROOT=str(tmp_path / "runtime"),
LOOPX_REGISTRY=str(tmp_path / "registry.json"),
diff --git a/benchmark/tests/test_sforge_runtime.py b/benchmark/tests/test_sforge_runtime.py
index e9fdaf9bdf..1a4ed9b521 100644
--- a/benchmark/tests/test_sforge_runtime.py
+++ b/benchmark/tests/test_sforge_runtime.py
@@ -277,7 +277,7 @@ async def installed(self, environment):
assert "turn_envelope" not in profile
assert "turn_envelope_source" not in profile
assert "LOOPX_TURN_ENVELOPE" not in env
- assert env.get("LOOPX_CONTEXT_DELIVERY") == ("on" if context_delivery != "off" else None)
+ assert env["LOOPX_CONTEXT_DELIVERY"] == context_delivery
assert profile.get("context_delivery") == (context_delivery if context_delivery != "off" else None)
assert profile.get("checkpoint_capture_enabled") is (True if capture_path else None)
with pytest.raises(ValueError, match="checkpoint_request_path"):
@@ -1414,7 +1414,7 @@ def stop_before_solver(**kwargs):
@pytest.mark.parametrize("capture", [False, True])
-@pytest.mark.parametrize("context_delivery", ["off", "on"])
+@pytest.mark.parametrize("context_delivery", [None, "off", "on"])
def test_native_checkpoint_storage_guidance_reaches_both_prompt_surfaces(tmp_path, monkeypatch, capture, context_delivery):
pytest.importorskip("sforge")
pytest.importorskip("harbor")
@@ -1433,9 +1433,10 @@ def test_native_checkpoint_storage_guidance_reaches_both_prompt_surfaces(tmp_pat
game_mode=False, submit_paths=["solver.py"], work=SimpleNamespace(agent_query="Original acceptance."),
judge=SimpleNamespace(selection="score_first", score_direction="maximize")))
monkeypatch.setattr(run, "RecordingDockerBackend", lambda **k: SimpleNamespace(image_exists=lambda image: True))
+ expected_delivery = "on" if context_delivery is None else context_delivery
def before_solver(**kwargs):
worker = kwargs["agent"]
- assert worker.context_delivery is context_delivery
+ assert worker.context_delivery == expected_delivery
assert worker.task_objective == "Original acceptance."
assert worker.feedback_prompt.startswith(worker.workspace_instructions)
assert worker.feedback_prompt.endswith("---\n\nOriginal acceptance.\n")
@@ -1450,8 +1451,8 @@ def before_solver(**kwargs):
args = ["--task", "fixture", "--tasks-dir", str(tmp_path), "--log-dir", str(tmp_path),
"--run-id", "storage", "--worker", "heartbeat-explore", "--model", "fixture",
"--effort", "xhigh", "--judge-url", "http://127.0.0.1:9999", "--feedback", "native"]
- if context_delivery != "off":
- args += ["--context-delivery", "on"]
+ if context_delivery is not None:
+ args += ["--context-delivery", context_delivery]
if capture:
declaration = tmp_path / "request.json"
declaration.write_text(json.dumps({"destination": "/logs/agent/checkpoints",
@@ -1460,4 +1461,4 @@ def before_solver(**kwargs):
with pytest.raises(RuntimeError, match="validated before model execution"):
run.main(args)
receipt = json.loads((tmp_path / "runs/storage/fixture/runtime-receipt.json").read_text())
- assert receipt.get("context_delivery") == (context_delivery if context_delivery != "off" else None)
+ assert receipt.get("context_delivery") == (expected_delivery if expected_delivery != "off" else None)
diff --git a/benchmark/tests/test_shared_codex_runtime.py b/benchmark/tests/test_shared_codex_runtime.py
index 8e6cef4805..1235f89639 100644
--- a/benchmark/tests/test_shared_codex_runtime.py
+++ b/benchmark/tests/test_shared_codex_runtime.py
@@ -8,12 +8,14 @@
import sys
import time
import tomllib
+from contextlib import contextmanager
from types import SimpleNamespace
from pathlib import Path
import pytest
from benchmark.runtime.codex import Execution, prepare_codex_home
+from benchmark.runtime import worker
from benchmark.runtime.worker import run_once, turn_command
@@ -60,7 +62,9 @@ def test_mode_default_context_preserves_explicit_fresh_and_transport_opt_ins(tmp
expected = "resume" if mode in {"heartbeat", "turn"} else "fresh"
implicit = Execution(mode=mode, **extra)
assert implicit.context == expected
- assert implicit.context_delivery == "off" and implicit.turn_envelope is False
+ assert implicit.context_delivery == ("on" if mode == "heartbeat" else "off")
+ assert implicit.turn_envelope is False
+ assert Execution(mode=mode, context_delivery="off", **extra).context_delivery == "off"
assert Execution(mode=mode, context="fresh", **extra).context == "fresh"
if expected == "fresh":
with pytest.raises(ValueError, match="resume requires"):
@@ -150,6 +154,8 @@ def worker_env(tmp_path):
binary.chmod(0o755)
return dict(os.environ) | {
"LOOPX_EXECUTION_MODE": "plain",
+ # This executable models legacy sessions, not native hook discovery.
+ "LOOPX_CONTEXT_DELIVERY": "off",
"LOOPX_PROJECT": str(tmp_path),
"LOOPX_TASK_DOC": str(task),
"LOOPX_CODEX_HOME": str(tmp_path / "home"),
@@ -314,6 +320,8 @@ def test_native_heartbeat_retry_uses_real_session_owner(tmp_path, monkeypatch, c
env, _project, _runtime, _source, _state = _environment(tmp_path, monkeypatch, "sqlite")
env["LOOPX_ITERATION_CONTEXT"] = context
+ # This fake executable models session retries, not native hook discovery.
+ env["LOOPX_CONTEXT_DELIVERY"] = "off"
monkeypatch.setattr(worker, "heartbeat_body", lambda *a, **kw: "synthetic work")
arguments = tmp_path / "native-calls.jsonl"
Path(env["CODEX_BIN"]).write_text(f"#!{sys.executable}\n" + f"""
@@ -405,7 +413,7 @@ def probe(env):
assert retained.read_bytes() == b"existing participant must remain exact"
-def test_timeout_keeps_receipt_and_reaps_child(tmp_path):
+def test_timeout_keeps_receipt_and_reaps_child(tmp_path, monkeypatch):
env = worker_env(tmp_path)
env["LOOPX_CODEX_TURN_TIMEOUT_SEC"] = "1"
Path(env["CODEX_BIN"]).write_text(
@@ -416,10 +424,25 @@ def test_timeout_keeps_receipt_and_reaps_child(tmp_path):
time.sleep(60)
"""
)
+ child_pids = []
+ original_child_process = worker.child_process
+
+ @contextmanager
+ def observe_child(*args, **kwargs):
+ with original_child_process(*args, **kwargs) as process:
+ # Observe the real OS launch even if the one-second deadline fires
+ # before this child can write its fixture file under parallel load.
+ child_pids.append(process.pid)
+ yield process
+
+ monkeypatch.setattr(worker, "child_process", observe_child)
receipt = run_once(env)
assert receipt["timed_out"] and not receipt["ok"]
+ assert len(child_pids) == 1
+ if (tmp_path / "pid").exists():
+ assert int((tmp_path / "pid").read_text()) == child_pids[0]
with pytest.raises(ProcessLookupError):
- os.kill(int((tmp_path / "pid").read_text()), 0)
+ os.kill(child_pids[0], 0)
@pytest.mark.skipif(os.name != "posix", reason="POSIX scheduler cancellation")
@@ -936,7 +959,7 @@ async def task_exec(**kwargs):
assert ("turn_envelope" in receipt) is (expected is not None)
assert receipt.get("turn_envelope_source") == expected
assert receipt.get("context_delivery") == (context_delivery if context_delivery != "off" else None)
- assert agent._worker_env(cwd="/task").get("LOOPX_CONTEXT_DELIVERY") == ("on" if context_delivery != "off" else None)
+ assert agent._worker_env(cwd="/task")["LOOPX_CONTEXT_DELIVERY"] == context_delivery
assert receipt.get("provider_request_admission") == ("on" if provider_request_admission else None)
worker_env = agent._worker_env(cwd="/task")
assert worker_env.get("LOOPX_PROVIDER_REQUEST_ADMISSION") == ("on" if provider_request_admission else None)
@@ -1205,20 +1228,21 @@ def test_native_context_opt_in_is_only_a_heartbeat_treatment(mode):
@pytest.mark.parametrize("declared_mode", [None, "heartbeat"])
-def test_context_preflight_accepts_the_resolved_heartbeat_mode(tmp_path, monkeypatch, declared_mode):
+def test_context_preflight_defaults_on_and_exports_resolved_heartbeat_mode(tmp_path, monkeypatch, declared_mode):
from benchmark.tests.test_resume_sessions import resume_env
from loopx.control_plane.turn_driver.codex_context import context_delivery_activation
env = resume_env(tmp_path, monkeypatch)
if declared_mode is None:
env.pop("LOOPX_EXECUTION_MODE")
- env["LOOPX_CONTEXT_DELIVERY"] = "on"
+ env.pop("LOOPX_CONTEXT_DELIVERY", None)
monkeypatch.setattr("benchmark.runtime.context_delivery.prepare_context_delivery", lambda *args: None)
def preflight(current, *_args, **_kwargs):
activation = context_delivery_activation("on", runtime_profile="generic_cli",
benchmark_mode=current.get("LOOPX_EXECUTION_MODE"))
assert activation["scenario"] == "codex_benchmark_heartbeat"
+ assert current["LOOPX_CONTEXT_DELIVERY"] == "on"
return "Current Todo input."
monkeypatch.setattr("benchmark.runtime.worker.heartbeat_body", preflight)
@@ -1277,7 +1301,7 @@ def test_context_selection_is_fixed_by_trial_home(tmp_path):
args = settings(tmp_path, execution=Execution(mode="heartbeat", context_delivery="on"))
prepare_codex_home(**args)
with pytest.raises(ValueError, match="settings changed"):
- prepare_codex_home(**(args | {"execution": Execution(mode="heartbeat")}))
+ prepare_codex_home(**(args | {"execution": Execution(mode="heartbeat", context_delivery="off")}))
@pytest.mark.parametrize("kind", ["public_directory", "symlink_directory", "existing_hooks"])
diff --git a/docs/heartbeat-automation-prompt.md b/docs/heartbeat-automation-prompt.md
index b9f8f8c325..b36e22985a 100644
--- a/docs/heartbeat-automation-prompt.md
+++ b/docs/heartbeat-automation-prompt.md
@@ -441,7 +441,7 @@ loopx-canary heartbeat-prompt \
### Opt-in native context delivery
-`--context-delivery {off,on}` is experimental and defaults to `off`. It reuses
+`--context-delivery {off,on}` defaults to `on` for supported native Codex App/SSH and benchmark heartbeat entries; save the machine setting as off or pass `--context-delivery off` to disable. An explicitly saved off is preserved. Other hosts and ordinary CLI keep full delivery. It reuses
existing scheduler-owned host declarations and the benchmark worker's explicit
execution settings; it does not guess a host from process names or ambient native
session variables. These declared run modes can activate it:
diff --git a/docs/reference/required-work-context.md b/docs/reference/required-work-context.md
index 842b03ccb1..3ac9139d37 100644
--- a/docs/reference/required-work-context.md
+++ b/docs/reference/required-work-context.md
@@ -72,7 +72,7 @@ change receipt replay validation or declare a model-input/token saving.
Unmarked or mixed ownership keeps the original full progressive read in
`agent_channel.required_reads`. Malformed markers, non-generated content inside
a marked region, unavailable files and invalid UTF-8 fail closed. Unknown
-narrative is never classified by headings or clipped to a size budget. For default-off and signed-envelope callers, read all
+narrative is never classified by headings or clipped to a size budget. For explicit-off and signed-envelope callers, read all
delivered context and remaining reads before dependent work; changed sources need
a fresh guard. Enabled scoped acceptance does not replace original Goal intent.
@@ -359,7 +359,7 @@ statements, source quotes and source references. Each read still supplies the
current revision, membership, keys, lifecycle state, expiry, operation lineage
and unknown fields literally; an empty view replaces earlier preferences.
The existing scope-less preference hook uses the validated capture's exact
-Goal/Agent binding, without adding fields to ordinary/default-off producer output
+Goal/Agent binding, without adding fields to ordinary/disabled producer output
or parsing its read command. Explore retains its explicit scoped hook identity.
Unknown, failed, incompatible or ambiguous hook views stay complete. A changed
scope or lost baseline still selects full delivery; reuse never makes a retired
@@ -403,7 +403,7 @@ the reconstructed context must still match its complete digest. Cold delivery,
session invalidation and authority remain unchanged. This saves transport only;
it does not establish model retention, billed-token savings or useful outcomes.
-These are presentation rules within the existing default-off option, not a new
+These are presentation rules within the existing native option, not a new
configuration or admission policy. A missing continuity basis, a changed epoch, a damaged
patch or an incompatible reader automatically recovers the same original full
capture. Recovery never reruns the guard, asks the owner, spends quota or grants
@@ -425,18 +425,23 @@ host setup or actual delta use; the settings view states this explicitly. Its
`{"schema_version":"context_delivery_machine_defaults_v0","mode":"off"}` or
the same object with `"mode":"on"`. The CLI exposes that same owner through
`machine-config preview/apply --namespace context_delivery --config-json FILE`;
-apply requires the exact preview revision. Removing the namespace restores off.
+apply requires the exact preview revision. Removing the namespace restores the on default for supported native Codex sessions; save `mode: "off"` to keep it disabled.
Sibling settings and Goal records are preserved. The application row selects Codex
within this capability; the existing `mode` remains that Codex preference, with no
additional global switch or host configuration authority. Read-only editors cannot
save it. The UI does not alter other hosts or initialize the current native session.
An explicit `--context-delivery on|off` wins; otherwise each invocation reads the
-machine default, with off when absent. The existing worker environment's explicit
-`LOOPX_CONTEXT_DELIVERY=off` also overrides inheritance; environment on alone does
-not enable delivery. Benchmark trials keep their existing `context_delivery=on`
-opt-in. Workers propagate the resolved trial choice, including default off, to
-both preflight and solver subprocesses without changing the caller's settings.
+machine preference, preserving a saved off. An absent preference defaults on only
+for supported POSIX native Codex App/SSH and declared benchmark heartbeat callers.
+Ordinary CLI, other hosts and unsupported platforms keep full delivery. Explicit
+on, or an explicitly saved on for an unknown declaration, still rejects unsupported
+or conflicting modes. The worker environment's `LOOPX_CONTEXT_DELIVERY=off` also
+overrides inheritance; environment on alone supplies no host or execution proof.
+New benchmark heartbeat trials default to `context_delivery=on`; pass `off` to
+disable. Other benchmark modes remain off. Workers pin the resolved trial choice
+in preflight and solver subprocesses; existing saved/frozen trials must not be
+rewritten or reused to qualify the new default.
Machine consumers that parse `should_run`, selected work or settlement identities
must explicitly request raw output on internal `quota should-run` calls using
@@ -721,7 +726,7 @@ context delivery 时,未标记或混合归属仅在内部桥接传路径与修
安装后重新生成旧展开式 heartbeat 提示;此 PR 不热更新 runtime/automation,
也不证明模型已采用或获得质量收益。回滚需恢复旧版本并重新生成提示。
-既有默认关闭的原生 context delivery 由同一 TypeScript codec 处理普通 quota 与
+既有原生 context delivery 由同一 TypeScript codec 处理普通 quota 与
TurnEnvelope。在基线连续性成立的口径内,两入口仍逐轮发送 `planning_horizon.core_goal` 的
原始目标、来源和可用性,包括目标改变或缺失。完整 `acceptance_contract` 与已登记
规划树按精确复用、子树变化或全量交付;累计验收树不等于原始目标句。未知 horizon
@@ -765,15 +770,18 @@ quota 能力候选沿用同一精确 codec 复用已登记 Todo 的正文、标
设置页明确区分已保存偏好与尚未验证的原生初始化、实际差分使用。机器 namespace 为 `context_delivery`,配置为
`{"schema_version":"context_delivery_machine_defaults_v0","mode":"off"}`;开启时
把 `mode` 改为 `on`。CLI 的 `machine-config preview/apply --namespace context_delivery
---config-json FILE` 使用同一 owner;应用须带原预览修订。移除此 namespace 恢复关闭,
+--config-json FILE` 使用同一 owner;应用须带原预览修订。移除此 namespace 恢复受支持 Codex 原生会话的默认开启;保持关闭须保存 `mode: "off"`,
不改写其他配置和 Goal 记录。应用行选择的是此能力下的 Codex;既有 `mode` 仍表示
该 Codex 偏好,不新增总开关或宿主配置 authority。只读编辑器不能保存;界面不会
改变其他应用或初始化当前原生会话。
-显式 `--context-delivery on|off` 优先;省略时每次读取机器设置,未配置则关闭。
-已有 worker 环境的 `LOOPX_CONTEXT_DELIVERY=off` 也覆盖继承;环境 on 本身不启用投递。
-benchmark trial 保留既有 `context_delivery=on` 启用方式。worker 将本次运行已解析的选择
-(含默认关闭)传给预检和 solver 子进程,不改写调用方原设置。
+显式 `--context-delivery on|off` 优先;省略时每次读取机器设置,已保存的关闭继续生效。
+未配置时,仅在受支持的 POSIX Codex App/SSH 和已声明的 benchmark 心跳入口默认开启;
+普通 CLI、其他宿主和不支持的平台仍完整交付。显式开启或已保存开启遇到未知/冲突声明
+仍拒绝。worker 环境的 `LOOPX_CONTEXT_DELIVERY=off` 也覆盖继承,环境 on 本身不证明宿主或执行权限。
+新 benchmark heartbeat trial 默认 `context_delivery=on`,指定 `off` 可关闭;其他跑法仍关闭。
+worker 把本次运行已解析的选择固定传给预检和 solver 子进程,不改写调用方原设置,
+不修改或复用旧的在途/冻结 trial 来宣称新默认合格。
开启接受以下原生声明:Codex App 心跳(`--codex-app` 或等价完整调度声明)、
Codex App SSH Goal(`--runtime-profile codex_app_ssh_goal`),以及现有 Codex benchmark 心跳 worker(`generic_cli` 与其显式心跳环境)。缺失、冲突、
不支持的 Codex 声明在准入前报错。机器偏好仅作用于 Codex;其他已明确解析的宿主
diff --git a/examples/control_plane/agent-onboard-host-loop-activation-smoke.py b/examples/control_plane/agent-onboard-host-loop-activation-smoke.py
index bde96ccfa7..6b810266e3 100644
--- a/examples/control_plane/agent-onboard-host-loop-activation-smoke.py
+++ b/examples/control_plane/agent-onboard-host-loop-activation-smoke.py
@@ -53,7 +53,7 @@ def run_cli(
)
-def load_bootstrap(packet: dict, cli_bin: str, home: Path) -> dict:
+def load_bootstrap(packet: dict, cli_bin: str, home: Path, *, env: dict[str, str] | None = None) -> dict:
assert packet["ok"] and packet["bootstrap"]
assert packet["interface_budget"]["within_budget"]
loader = shlex.split(packet["task_body"].split("```sh\n", 1)[1].split("\n```", 1)[0])
@@ -61,7 +61,7 @@ def load_bootstrap(packet: dict, cli_bin: str, home: Path) -> dict:
loader[0] = cli_bin
result = subprocess.run(
loader,
- env={**os.environ, "HOME": str(home), "LOOPX_PYTHON": sys.executable},
+ env=env if env is not None else {**os.environ, "HOME": str(home), "LOOPX_PYTHON": sys.executable},
check=False,
text=True,
capture_output=True,
@@ -71,6 +71,27 @@ def load_bootstrap(packet: dict, cli_bin: str, home: Path) -> dict:
return json.loads(result.stdout)
+def read_native_quota(packet: dict, cli_bin: str, *, cwd: Path, env: dict[str, str]) -> dict:
+ """Read back the returned current capture; this is not model-retention proof."""
+ command = packet["recovery"]["command"]
+ raw = bytearray()
+ while True:
+ argv = shlex.split(command)
+ if Path(argv[0]).name == "loopx":
+ argv[0] = cli_bin
+ result = subprocess.run(argv, cwd=cwd, env=env, check=True,
+ text=True, capture_output=True, timeout=120)
+ page = json.loads(result.stdout)
+ assert page["ok"] and page["offset"] == len(raw), page
+ previous = len(raw)
+ raw.extend(page["content"].encode())
+ if page["eof"]:
+ break
+ assert len(raw) > previous and page["next_offset"] == len(raw), page
+ command = page["next_command"]
+ return json.loads(raw)
+
+
def main() -> int:
catalog = build_agent_type_catalog()
agent_types = {item["agent_type"] for item in catalog["canonical_agent_types"]}
@@ -459,10 +480,14 @@ def main() -> int:
)
assert "/goal " in app_ssh_activation["host_mutation"]["host_command"]
+ app_ssh_env = {**os.environ, "HOME": str(home), "LOOPX_PYTHON": sys.executable}
+ # This fresh synthetic host tests the absent-preference default, rather
+ # than an enclosing benchmark worker's explicitly disabled treatment.
+ app_ssh_env.pop("LOOPX_CONTEXT_DELIVERY", None)
app_ssh_prompt_run = subprocess.run(
shlex.split(app_ssh_activation["activation_input_command"]),
cwd=REPO_ROOT,
- env={**os.environ, "HOME": str(home), "LOOPX_PYTHON": sys.executable},
+ env=app_ssh_env,
check=True,
text=True,
capture_output=True,
@@ -470,7 +495,8 @@ def main() -> int:
)
app_ssh_prompt = json.loads(app_ssh_prompt_run.stdout)
assert app_ssh_prompt["ok"] is True, app_ssh_prompt
- app_ssh_prompt = load_bootstrap(app_ssh_prompt, cli_bin, home)
+ app_ssh_prompt = load_bootstrap(app_ssh_prompt, cli_bin, home, env=app_ssh_env)
+ assert app_ssh_prompt["context_delivery"]["enabled"] is True, app_ssh_prompt
assert app_ssh_prompt["interface_budget"]["mode"] == "visible_goal", app_ssh_prompt
assert app_ssh_prompt["interface_budget"]["max_chars"] == 4_000, app_ssh_prompt
assert app_ssh_prompt["interface_budget"]["within_budget"] is True, app_ssh_prompt
@@ -494,13 +520,13 @@ def main() -> int:
) is False
assert "host_action=" not in app_ssh_prompt["task_body"], app_ssh_prompt
assert "automation_update stop" not in app_ssh_prompt["task_body"], app_ssh_prompt
- assert "call `update_goal` with `status=blocked`" in (
+ assert "Third identical blocked turn without progress: update_goal(status=blocked)" in (
app_ssh_prompt["task_body"]
), app_ssh_prompt
- assert "Only user `/goal resume`" in (
+ assert "no spend/LoopX completion" in (
app_ssh_prompt["task_body"]
), app_ssh_prompt
- assert "reactivates it; rerun quota after resume" in (
+ assert "Only user `/goal resume` reactivates; then rerun quota" in (
app_ssh_prompt["task_body"]
), app_ssh_prompt
app_ssh_quota_argv = shlex.split(app_ssh_prompt["quota_guard_command"])
@@ -512,13 +538,15 @@ def main() -> int:
app_ssh_quota_run = subprocess.run(
app_ssh_quota_argv,
cwd=project,
- env={**os.environ, "HOME": str(home), "LOOPX_PYTHON": sys.executable},
+ env=app_ssh_env,
check=True,
text=True,
capture_output=True,
timeout=120,
)
- app_ssh_quota = json.loads(app_ssh_quota_run.stdout)
+ app_ssh_navigation = json.loads(app_ssh_quota_run.stdout)
+ assert app_ssh_navigation["mode"] == "full", app_ssh_navigation
+ app_ssh_quota = read_native_quota(app_ssh_navigation, cli_bin, cwd=project, env=app_ssh_env)
execution_context = app_ssh_quota["scheduler_hint"]["execution_context"]
assert execution_context["source"] == (
"runtime_profile:codex_app_ssh_goal"
diff --git a/examples/control_plane/control-plane-integrated-canary-smoke.py b/examples/control_plane/control-plane-integrated-canary-smoke.py
index e31e0a3452..c1ca0a8c28 100644
--- a/examples/control_plane/control-plane-integrated-canary-smoke.py
+++ b/examples/control_plane/control-plane-integrated-canary-smoke.py
@@ -292,6 +292,8 @@ def assert_scheduler_ack_state_machine(
runtime_root,
"quota",
"should-run",
+ "--context-delivery",
+ "off",
"--goal-id",
GOAL_ID,
"--agent-id",
@@ -380,6 +382,8 @@ def assert_todo_completion_successor_state_machine(
runtime_root,
"quota",
"should-run",
+ "--context-delivery",
+ "off",
"--goal-id",
GOAL_ID,
"--agent-id",
@@ -466,6 +470,8 @@ def assert_refresh_and_spend_state_machine(
runtime_root,
"quota",
"should-run",
+ "--context-delivery",
+ "off",
"--goal-id",
GOAL_ID,
"--agent-id",
@@ -484,6 +490,8 @@ def assert_due_monitor_poll_state_machine(root: Path, *, provider: str) -> None:
runtime_root,
"quota",
"should-run",
+ "--context-delivery",
+ "off",
"--goal-id",
MONITOR_GOAL_ID,
"--agent-id",
@@ -538,6 +546,8 @@ def assert_due_monitor_poll_state_machine(root: Path, *, provider: str) -> None:
runtime_root,
"quota",
"should-run",
+ "--context-delivery",
+ "off",
"--goal-id",
MONITOR_GOAL_ID,
"--agent-id",
@@ -603,6 +613,8 @@ def assert_same_agent_continuation_read_path(root: Path, *, provider: str) -> No
runtime_root,
"quota",
"should-run",
+ "--context-delivery",
+ "off",
"--goal-id",
CONTINUATION_GOAL_ID,
"--agent-id",
@@ -679,6 +691,8 @@ def assert_same_agent_continuation_read_path(root: Path, *, provider: str) -> No
runtime_root,
"quota",
"should-run",
+ "--context-delivery",
+ "off",
"--goal-id",
CONTINUATION_GOAL_ID,
"--agent-id",
@@ -761,6 +775,8 @@ def run_fixture_canary(root: Path, *, provider: str) -> None:
runtime_root,
"quota",
"should-run",
+ "--context-delivery",
+ "off",
"--goal-id",
GOAL_ID,
"--agent-id",
diff --git a/examples/control_plane/heartbeat-quota-flow-smoke.py b/examples/control_plane/heartbeat-quota-flow-smoke.py
index 06a852430f..392999ca73 100644
--- a/examples/control_plane/heartbeat-quota-flow-smoke.py
+++ b/examples/control_plane/heartbeat-quota-flow-smoke.py
@@ -651,6 +651,8 @@ def main() -> int:
root,
"quota",
"should-run",
+ "--context-delivery",
+ "off",
"--codex-app",
"--goal-id",
GOAL_ID,
@@ -723,6 +725,8 @@ def main() -> int:
root,
"quota",
"should-run",
+ "--context-delivery",
+ "off",
"--codex-app",
"--goal-id",
GOAL_ID,
@@ -756,6 +760,8 @@ def main() -> int:
root,
"quota",
"should-run",
+ "--context-delivery",
+ "off",
"--codex-app",
"--goal-id",
GOAL_ID,
@@ -781,6 +787,8 @@ def main() -> int:
root,
"quota",
"should-run",
+ "--context-delivery",
+ "off",
"--codex-app",
"--goal-id",
GOAL_ID,
@@ -873,6 +881,8 @@ def main() -> int:
root,
"quota",
"should-run",
+ "--context-delivery",
+ "off",
"--codex-app",
"--goal-id",
GOAL_ID,
@@ -914,6 +924,8 @@ def main() -> int:
root,
"quota",
"should-run",
+ "--context-delivery",
+ "off",
"--codex-app",
"--goal-id",
GOAL_ID,
@@ -928,6 +940,8 @@ def main() -> int:
root,
"quota",
"should-run",
+ "--context-delivery",
+ "off",
"--codex-app",
"--goal-id",
GOAL_ID,
@@ -942,6 +956,8 @@ def main() -> int:
root,
"quota",
"should-run",
+ "--context-delivery",
+ "off",
"--codex-app",
"--goal-id",
GOAL_ID,
@@ -981,6 +997,8 @@ def main() -> int:
root,
"quota",
"should-run",
+ "--context-delivery",
+ "off",
"--codex-app",
"--goal-id",
GOAL_ID,
@@ -998,6 +1016,8 @@ def main() -> int:
root,
"quota",
"should-run",
+ "--context-delivery",
+ "off",
"--codex-app",
"--goal-id",
GOAL_ID,
@@ -1038,6 +1058,8 @@ def main() -> int:
root,
"quota",
"should-run",
+ "--context-delivery",
+ "off",
"--codex-app",
"--goal-id",
GOAL_ID,
@@ -1116,6 +1138,8 @@ def main() -> int:
root,
"quota",
"should-run",
+ "--context-delivery",
+ "off",
"--codex-app",
"--goal-id",
GOAL_ID,
@@ -1163,6 +1187,8 @@ def main() -> int:
root,
"quota",
"should-run",
+ "--context-delivery",
+ "off",
"--codex-app",
"--goal-id",
GOAL_ID,
@@ -1198,6 +1224,8 @@ def main() -> int:
root,
"quota",
"should-run",
+ "--context-delivery",
+ "off",
"--codex-app",
"--goal-id",
GOAL_ID,
diff --git a/examples/control_plane/monitor-poll-writeback-smoke.py b/examples/control_plane/monitor-poll-writeback-smoke.py
index 91da4eaf10..0031c1ae85 100644
--- a/examples/control_plane/monitor-poll-writeback-smoke.py
+++ b/examples/control_plane/monitor-poll-writeback-smoke.py
@@ -318,6 +318,8 @@ def assert_due_monitor_selected(registry_path: Path, *, due_count: int = 1) -> N
registry_path,
"quota",
"should-run",
+ "--context-delivery",
+ "off",
"--goal-id",
GOAL_ID,
"--agent-id",
@@ -378,6 +380,8 @@ def assert_unchanged_writeback() -> None:
registry_path,
"quota",
"should-run",
+ "--context-delivery",
+ "off",
"--goal-id",
GOAL_ID,
"--agent-id",
@@ -423,6 +427,8 @@ def assert_interleaved_monitor_stalls_replan_blocked_benchmark() -> None:
registry_path,
"quota",
"should-run",
+ "--context-delivery",
+ "off",
"--goal-id",
GOAL_ID,
"--agent-id",
@@ -449,6 +455,8 @@ def assert_stalled_monitor_does_not_preempt_runnable_advancement() -> None:
registry_path,
"quota",
"should-run",
+ "--context-delivery",
+ "off",
"--goal-id",
GOAL_ID,
"--agent-id",
@@ -622,6 +630,8 @@ def assert_material_transition_followup() -> None:
registry_path,
"quota",
"should-run",
+ "--context-delivery",
+ "off",
"--goal-id",
GOAL_ID,
"--agent-id",
@@ -657,7 +667,7 @@ def assert_material_transition_followup() -> None:
selection = contract["cli_channel"]["selection_command"]
selected = run_cli(registry_path, *shlex.split(
selection["command_args_template"].replace("{todo_id}", successor_id)
- ))
+ ), "--context-delivery", "off")
assert selected["heartbeat_receipt"]["settlement_identity"]["todo_id"] == successor_id, selected
assert selected["interaction_contract"]["agent_channel"]["delivery_allowed"] is True, selected
assert not find_todo(state_file, successor_id).get("claimed_by") # Selection is not a claim.
@@ -716,6 +726,8 @@ def assert_due_monitor_poll_allowed_with_open_user_gate() -> None:
registry_path,
"quota",
"should-run",
+ "--context-delivery",
+ "off",
"--goal-id",
GOAL_ID,
"--agent-id",
@@ -825,6 +837,8 @@ def assert_compacted_auxiliary_due_monitor_can_write_back() -> None:
registry_path,
"quota",
"should-run",
+ "--context-delivery",
+ "off",
"--goal-id",
GOAL_ID,
"--agent-id",
@@ -884,6 +898,8 @@ def assert_capability_gated_monitor_poll_requires_declaration_parity() -> None:
registry_path,
"quota",
"should-run",
+ "--context-delivery",
+ "off",
"--goal-id",
GOAL_ID,
"--agent-id",
@@ -980,6 +996,8 @@ def assert_should_run_turn_receipt_is_idempotent() -> None:
registry_path,
"quota",
"should-run",
+ "--context-delivery",
+ "off",
"--goal-id",
GOAL_ID,
"--agent-id",
@@ -995,6 +1013,8 @@ def assert_should_run_turn_receipt_is_idempotent() -> None:
registry_path,
"quota",
"should-run",
+ "--context-delivery",
+ "off",
"--goal-id",
GOAL_ID,
"--agent-id",
@@ -1011,6 +1031,8 @@ def assert_should_run_turn_receipt_is_idempotent() -> None:
command = (
"quota",
"should-run",
+ "--context-delivery",
+ "off",
"--goal-id",
GOAL_ID,
"--agent-id",
diff --git a/examples/control_plane/quota-scheduler-hint-compaction-smoke.py b/examples/control_plane/quota-scheduler-hint-compaction-smoke.py
index d1427e7e20..1d0751c1fd 100644
--- a/examples/control_plane/quota-scheduler-hint-compaction-smoke.py
+++ b/examples/control_plane/quota-scheduler-hint-compaction-smoke.py
@@ -398,6 +398,8 @@ def run_should_run_cli(
"json",
"quota",
"should-run",
+ "--context-delivery",
+ "off",
"--goal-id",
"needs-operator",
"--agent-id",
diff --git a/examples/control_plane/quota-scheduler-registry-route-smoke.py b/examples/control_plane/quota-scheduler-registry-route-smoke.py
index 6510671568..d5ec6e189f 100644
--- a/examples/control_plane/quota-scheduler-registry-route-smoke.py
+++ b/examples/control_plane/quota-scheduler-registry-route-smoke.py
@@ -99,6 +99,8 @@ def main() -> None:
str(global_registry),
"quota",
"should-run",
+ "--context-delivery",
+ "off",
"--goal-id",
GOAL_ID,
"--agent-id",
@@ -137,6 +139,8 @@ def main() -> None:
str(global_registry),
"quota",
"should-run",
+ "--context-delivery",
+ "off",
"--goal-id",
GOAL_ID,
"--agent-id",
diff --git a/examples/control_plane/quota-scheduler-state-ack-smoke.py b/examples/control_plane/quota-scheduler-state-ack-smoke.py
index cbbe235bb0..a4f181e3f5 100644
--- a/examples/control_plane/quota-scheduler-state-ack-smoke.py
+++ b/examples/control_plane/quota-scheduler-state-ack-smoke.py
@@ -34,6 +34,8 @@ def run_should_run(
return run_json_cli(
"quota",
"should-run",
+ "--context-delivery",
+ "off",
"--goal-id",
GOAL_ID,
"--agent-id",
diff --git a/examples/control_plane/status-quota-review-packet-parity-smoke.py b/examples/control_plane/status-quota-review-packet-parity-smoke.py
index 3668a2e592..844aecb83e 100644
--- a/examples/control_plane/status-quota-review-packet-parity-smoke.py
+++ b/examples/control_plane/status-quota-review-packet-parity-smoke.py
@@ -226,6 +226,8 @@ def main() -> int:
agent_worktree,
"quota",
"should-run",
+ "--context-delivery",
+ "off",
"--goal-id",
GOAL_ID,
"--agent-id",
diff --git a/examples/personal-workspace-browser/configuration-backup.mjs b/examples/personal-workspace-browser/configuration-backup.mjs
index 57d89eeb11..b2cb98c71c 100644
--- a/examples/personal-workspace-browser/configuration-backup.mjs
+++ b/examples/personal-workspace-browser/configuration-backup.mjs
@@ -199,7 +199,47 @@ export const configurationBackupScenario = {
await english.getByText(backend.source_position.provider_revision, {exact: true}).waitFor();
await english.getByRole("status").scrollIntoViewIfNeeded();
await page.screenshot({path: resolve(outputDir, "state-recovery-english.png"), animations: "disabled"});
- return {coverageEntries: context.coverageEntries, errors: context.errors, backend, verified: `Packaged configuration recovery and full archive inspection; real ${backend.source_provider} head/history after original-source loss, no Goal registration, keyboard, corrupt-input recovery, immutable history reload and narrow viewport`};
+ // Reuse this real disposable settings backend for the default/opt-out
+ // journey; no live machine preferences or Goal execution are touched.
+ await page.route("**/api/chat/machine-configuration**", async route => {
+ const response = await fetchWorkspaceBackend(route, `http://127.0.0.1:${port}`);
+ await route.fulfill({response});
+ });
+ async function openContextSettings() {
+ await page.reload();
+ const settings = page.getByRole("button", {name: "Settings", exact: true});
+ if (await settings.count()) await settings.click();
+ await page.locator(".personal-settings-tabs").getByRole("button", {name: /Capabilit/}).click();
+ await page.getByRole("button", {name: /Differential context/}).click();
+ return page.getByRole("switch", {name: "Use differential context in Codex", exact: true});
+ }
+ let contextSwitch = await openContextSettings();
+ await page.screenshot({path: resolve(outputDir, "context-default-on-desktop.png"), animations: "disabled"});
+ assert.equal(await contextSwitch.isChecked(), true, "Unconfigured Codex must show its effective on default");
+ await page.getByText("Default on; native setup and use unverified.", {exact: true}).waitFor();
+ await page.setViewportSize({width: 390, height: 844});
+ assert.equal(await page.evaluate(() => document.documentElement.scrollWidth > window.innerWidth), false);
+ await contextSwitch.scrollIntoViewIfNeeded();
+ await page.screenshot({path: resolve(outputDir, "context-default-on-mobile.png"), animations: "disabled"});
+ await page.setViewportSize({width: 1512, height: 982});
+ await contextSwitch.click();
+ await page.getByText("Off for Codex.", {exact: true}).waitFor();
+ const storedSettings = () => readFile(join(root, "runtime/machine/configuration.json"), "utf8").then(JSON.parse);
+ assert.equal((await storedSettings()).namespaces.context_delivery.mode, "off");
+ contextSwitch = await openContextSettings();
+ assert.equal(await contextSwitch.isChecked(), false, "A saved off must survive reload and the new on default");
+ const applyRoute = "**/api/chat/machine-configuration/apply";
+ await page.route(applyRoute, route => route.fulfill({status: 503, contentType: "application/json", body: JSON.stringify({ok: false, error: "Fixture unavailable"})}));
+ await contextSwitch.click();
+ await page.locator(".personal-capability-detail").getByRole("alert").waitFor();
+ assert.equal((await storedSettings()).namespaces.context_delivery.mode, "off", "Failed apply must preserve saved off");
+ await page.unroute(applyRoute);
+ await contextSwitch.click();
+ await page.getByText("On; native setup and use unverified.", {exact: true}).waitFor();
+ const afterSettings = await storedSettings();
+ assert.equal(afterSettings.namespaces.context_delivery.mode, "on");
+ assert.equal(afterSettings.namespaces.goal_storage.new_goal_provider, "sqlite", "The opt-out/on transaction must preserve sibling settings");
+ return {coverageEntries: context.coverageEntries, errors: context.errors, backend, verified: `Actual settings backend: Codex default on, saved off/reload, failed apply and explicit on; Packaged configuration recovery and full archive inspection; real ${backend.source_provider} head/history after original-source loss, no Goal registration, keyboard, corrupt-input recovery, immutable history reload and narrow viewport`};
} finally {
try {await context?.close();} finally {
if (!closed) {
diff --git a/loopx/canary/qualification_profiles.py b/loopx/canary/qualification_profiles.py
index 50a9ad641d..ef5c288b6b 100644
--- a/loopx/canary/qualification_profiles.py
+++ b/loopx/canary/qualification_profiles.py
@@ -225,6 +225,8 @@
"loopx/control_plane/scheduler/monitor_wait.py",
"loopx/control_plane/scheduler/state.py",
"loopx/control_plane/scheduler/state_transition_rules.py",
+ "loopx/cli_commands/context_machine.py",
+ "loopx/capabilities/machine_configuration/context_delivery.py",
"loopx/cli_commands/quota",
"quota-scheduler-state-ack-smoke.py",
"quota-scheduler-registry-route-smoke.py",
diff --git a/loopx/capabilities/machine_configuration/context_delivery.py b/loopx/capabilities/machine_configuration/context_delivery.py
index 349f34745b..2812556e5c 100644
--- a/loopx/capabilities/machine_configuration/context_delivery.py
+++ b/loopx/capabilities/machine_configuration/context_delivery.py
@@ -28,11 +28,11 @@ def context_delivery_machine_configuration_namespace() -> MachineConfigurationNa
apply_public_update=lambda _current, update: dict(update),
title="Differential context",
description=(
- "Reuse unchanged context for Codex App heartbeats, SSH Goals and benchmark heartbeats. Off by default; "
- "unsupported declarations fail and known context loss keeps full context. "
+ "Reuse unchanged context for Codex App heartbeats, SSH Goals and benchmark heartbeats. On by default for supported Codex sessions; "
+ "explicit unsupported activation fails and known context loss keeps full context. "
"Completed reads use an explicit native-hook continuity assumption. "
"A saved preference does not establish host readiness or actual delta use."
),
documentation={"path": "docs/reference/required-work-context.md#machine-default"},
- default_configuration={"schema_version": CONTEXT_DELIVERY_MACHINE_SCHEMA, "mode": "off"},
+ default_configuration={"schema_version": CONTEXT_DELIVERY_MACHINE_SCHEMA, "mode": "on"},
)
diff --git a/loopx/cli_commands/context_machine.py b/loopx/cli_commands/context_machine.py
index 2fe133254b..dbd9e3298e 100644
--- a/loopx/cli_commands/context_machine.py
+++ b/loopx/cli_commands/context_machine.py
@@ -93,18 +93,32 @@ def apply_context_machine_options(
return
from ..paths import effective_runtime_root
runtime_root = effective_runtime_root(registry_path, runtime_root_arg)
+ using_default = False
if explicit is None:
from ..capabilities.machine_configuration.builtins import build_builtin_machine_configuration_registry
from ..capabilities.machine_configuration.store import read_machine_configuration
- configuration = read_machine_configuration(runtime_root, registry=build_builtin_machine_configuration_registry())
+ machine_registry = build_builtin_machine_configuration_registry()
+ configuration = read_machine_configuration(runtime_root, registry=machine_registry)
value = (configuration or {}).get("namespaces", {}).get("context_delivery")
- if value is None or value["mode"] == "off":
+ using_default = value is None
+ if using_default:
+ value = machine_registry.resolve("context_delivery").public_descriptor()["configuration_template"]
+ if value["mode"] == "off" or (using_default and os.name != "posix"):
return
# Recovery does not activate a run mode or create a missing session.
if command != "context-read":
args.context_delivery = "on"
- if not context_delivery_for_arguments(args, codex_machine_preference=explicit is None)["enabled"]:
+ try:
+ enabled = context_delivery_for_arguments(args, codex_machine_preference=explicit is None)["enabled"]
+ except ValueError:
+ if not using_default:
+ raise
+ # An absent preference enables only the supported native hosts.
+ # Ordinary CLI and unknown declarations retain their original path;
+ # explicit on still rejects an unsupported or conflicting host.
+ enabled = False
+ if not enabled:
args.context_delivery = "off"
return
if command == "should-run" and args.format != "json":
diff --git a/tests/control_plane/test_context_delivery_cli.py b/tests/control_plane/test_context_delivery_cli.py
index 5984a44c3c..1ba1f3cad4 100644
--- a/tests/control_plane/test_context_delivery_cli.py
+++ b/tests/control_plane/test_context_delivery_cli.py
@@ -193,6 +193,7 @@ def test_resumed_task_keeps_its_condition_without_expanding_diagnostic_siblings(
host = ["--codex-app"] if profile == "codex_app" else ["--runtime-profile", profile]
before = state.read_bytes()
code, guard = _run_cli(registry, runtime, "quota", "should-run", *host,
+ "--context-delivery", "off",
"--goal-id", GOAL_ID, "--agent-id", AGENT_ID, "--todo-id", TODO_ID,
"--turn-instance-id", "mixed-diagnostics", cwd=project)
assert code == 0 and guard["should_run"], guard
@@ -226,6 +227,7 @@ def test_cli_capture_exact_delta_and_same_capture_recovery(tmp_path: Path, monke
before_source = state.read_bytes()
host = ["--codex-app"] if profile == "codex_app" else ["--runtime-profile", profile]
rc, guard = _run_cli(registry, runtime, "quota", "should-run", *host,
+ "--context-delivery", "off",
"--goal-id", GOAL_ID, "--agent-id", AGENT_ID, "--todo-id", TODO_ID,
"--turn-instance-id", "context-presentation", cwd=project)
assert rc == 0 and guard["should_run"] is True, guard
diff --git a/tests/control_plane/test_context_machine_configuration.py b/tests/control_plane/test_context_machine_configuration.py
index d9981136ba..137f302c4d 100644
--- a/tests/control_plane/test_context_machine_configuration.py
+++ b/tests/control_plane/test_context_machine_configuration.py
@@ -76,7 +76,7 @@ def test_machine_catalog_discovers_context_delivery_without_activation(tmp_path)
assert len(contexts) == 1
assert contexts[0]["schema_versions"] == [CONTEXT_DELIVERY_MACHINE_SCHEMA]
assert contexts[0]["configuration_template"] == {
- "schema_version": CONTEXT_DELIVERY_MACHINE_SCHEMA, "mode": "off",
+ "schema_version": CONTEXT_DELIVERY_MACHINE_SCHEMA, "mode": "on",
}
assert not registry.exists() and not (runtime / "machine/configuration.json").exists()
assert not (runtime / "context-delivery").exists()
@@ -194,9 +194,9 @@ def test_inherited_on_rejects_unknown_or_unsupported_before_admission(tmp_path,
@pytest.mark.parametrize("profile", ["codex_app", "benchmark", "codex_app_ssh_goal"])
@pytest.mark.skipif(os.name != "posix", reason="Native continuity uses POSIX private directories and locks")
-def test_native_configuration_inherits_declared_scenarios_and_later_off(tmp_path, monkeypatch, profile):
+def test_native_configuration_defaults_on_and_later_explicit_off(tmp_path, monkeypatch, profile):
registry, runtime = tmp_path / "absent.json", tmp_path / "runtime"
- assert configure(registry, runtime, tmp_path, "on")[0] == 0
+ assert not (runtime / "machine/configuration.json").exists()
if profile == "benchmark":
monkeypatch.setenv("LOOPX_CONTEXT_DELIVERY", "on")
monkeypatch.setenv("LOOPX_EXECUTION_MODE", "heartbeat")
@@ -220,8 +220,9 @@ def test_native_configuration_inherits_declared_scenarios_and_later_off(tmp_path
@pytest.mark.parametrize("provider", ["file", "sqlite"])
+@pytest.mark.parametrize("stored_mode", [None, "on"])
@pytest.mark.skipif(os.name != "posix", reason="Native continuity uses POSIX private directories and locks")
-def test_machine_on_reaches_real_guard_and_same_capture_readback_without_readmission(tmp_path, monkeypatch, provider):
+def test_machine_on_reaches_real_guard_and_same_capture_readback_without_readmission(tmp_path, monkeypatch, provider, stored_mode):
isolate_sqlite_runtime(tmp_path, monkeypatch)
monkeypatch.setenv("CODEX_THREAD_ID", "machine-context-session")
monkeypatch.delenv("CODEX_ROLLOUT_TRACE_ROOT", raising=False)
@@ -229,7 +230,10 @@ def test_machine_on_reaches_real_guard_and_same_capture_readback_without_readmis
_initialize_fixture_authority(project, runtime, provider=provider)
state = project / f".codex/goals/{GOAL_ID}/ACTIVE_GOAL_STATE.md"
original_state = state.read_bytes()
- assert configure(registry, runtime, tmp_path, "on")[0] == 0
+ if stored_mode is not None:
+ assert configure(registry, runtime, tmp_path, stored_mode)[0] == 0
+ else:
+ assert not (runtime / "machine/configuration.json").exists()
code, setup = _run_cli(registry, runtime, "quota", "context-config", "--codex-app",
"--goal-id", GOAL_ID, "--agent-id", AGENT_ID, cwd=project)
assert code == 0, setup
@@ -239,7 +243,7 @@ def test_machine_on_reaches_real_guard_and_same_capture_readback_without_readmis
capture_output=True, check=True)
args = ["quota", "should-run", "--codex-app", "--goal-id", GOAL_ID,
"--agent-id", AGENT_ID, "--todo-id", TODO_ID, "--turn-instance-id", "machine-original-turn"]
- code, wire = _run_cli(registry, runtime, *args, cwd=project)
+ code, wire = _run_cli(registry, runtime, *args, cwd=project, raw_guard=False)
assert code == 0 and wire["mode"] == "full", wire
recovery = read_context_read_reference(wire["recovery"]["reference_file"])[1]
raw = Path(recovery["path"]).read_bytes()
@@ -266,15 +270,23 @@ def complete_reader(view):
assert hashlib.sha256(observed).hexdigest() == view["sha256"]
complete_reader(wire)
- code, warm = _run_cli(registry, runtime, *args, cwd=project)
+ code, warm = _run_cli(registry, runtime, *args, cwd=project, raw_guard=False)
assert code == 0 and warm["mode"] == "delta", warm
complete_reader(warm)
- old_generation = read_context_read_reference(warm["reference_file"])[1]["navigation"]["target"]["continuity_generation"]
- old_configuration = (runtime / "machine/configuration.json").read_bytes()
+ old_generation = read_context_read_reference(
+ warm["reference_file"]
+ )[1]["navigation"]["target"].get("continuity_generation")
+ configuration_file = runtime / "machine/configuration.json"
+ old_configuration = configuration_file.read_bytes() if configuration_file.exists() else None
+ assert (old_generation is None) is (stored_mode is None)
+ assert (old_configuration is None) is (stored_mode is None)
assert configure(registry, runtime, tmp_path, "off")[0] == 0
assert configure(registry, runtime, tmp_path, "on")[0] == 0
- assert (runtime / "machine/configuration.json").read_bytes() == old_configuration
- code, fresh = _run_cli(registry, runtime, *args, cwd=project)
+ if old_configuration is not None:
+ assert configuration_file.read_bytes() == old_configuration
+ else:
+ assert json.loads(configuration_file.read_text())["namespaces"]["context_delivery"]["mode"] == "on"
+ code, fresh = _run_cli(registry, runtime, *args, cwd=project, raw_guard=False)
assert code == 0 and fresh["mode"] == "full", fresh
fresh = read_context_read_reference(fresh["reference_file"])[1]["navigation"]
assert fresh["target"]["continuity_generation"] != old_generation
@@ -370,11 +382,13 @@ def test_explicit_on_unknown_host_fails_before_first_use_directory_creation(tmp_
@pytest.mark.skipif(not os.environ.get("LOOPX_NATIVE_CHECKPOINT_BIN"), reason="Explicit native Codex; loopback inference only")
@pytest.mark.skipif(os.name != "posix", reason="Native benchmark worker qualification uses POSIX isolation")
-@pytest.mark.parametrize("provider,worker_mode,machine_on", [
- ("file", None, False), ("file", None, True),
- ("sqlite", None, False), ("sqlite", None, True), ("sqlite", "off", True),
+@pytest.mark.parametrize("provider,worker_mode,machine_on,transport_ready", [
+ ("file", "off", False, True), ("file", "off", True, True),
+ ("sqlite", "off", False, True), ("sqlite", "off", True, True),
+ ("file", None, False, True), ("sqlite", None, False, True),
+ ("file", None, False, False), ("sqlite", None, False, False),
])
-def test_native_worker_default_off_isolates_machine_on(tmp_path, monkeypatch, provider, worker_mode, machine_on):
+def test_native_worker_default_on_and_explicit_off_isolation(tmp_path, monkeypatch, provider, worker_mode, machine_on, transport_ready):
from benchmark.runtime.worker import run_once
from tests.control_plane.codex_checkpoint_fixture import local_inference_provider
from tests.control_plane.test_codex_context_boundary import _input_text, _native_fixture
@@ -397,6 +411,10 @@ def test_native_worker_default_off_isolates_machine_on(tmp_path, monkeypatch, pr
OPENAI_API_KEY="synthetic-loopback-only", LOOPX_CODEX_TURN_TIMEOUT_SEC="60", LOOPX_USAGE_PING="0")
if worker_mode is not None:
env["LOOPX_CONTEXT_DELIVERY"] = worker_mode
+ if not transport_ready:
+ def unavailable(*_args):
+ raise ValueError("Fixture native hooks unavailable")
+ monkeypatch.setattr("benchmark.runtime.context_delivery.prepare_context_delivery", unavailable)
observed, errors = [], []
saved = workspace / "original-guard.json"
@@ -404,16 +422,41 @@ def response(request, number, message):
try:
if number == 1:
body = _input_text(request)
- assert "context-project" not in body
command = next(line.strip() for line in body.splitlines() if " quota should-run " in line)
turn_assignment = next(line.strip() for line in body.splitlines() if line.startswith("LOOPX_TURN="))
observed.append(shlex.split(turn_assignment)[0].split("=", 1)[1])
+ if worker_mode is None and transport_ready:
+ assert "--context-delivery on" in command
+ if not transport_ready:
+ # An ordinary guard may omit presentation flags. The actual
+ # native tool environment must still retain runtime off.
+ words = shlex.split(command)
+ if "--context-delivery" in words:
+ index = words.index("--context-delivery")
+ # Keep the original shell quoting and $LOOPX_TURN
+ # expansion while omitting only this presentation flag.
+ command = command.replace("--context-delivery " + words[index + 1], "", 1)
return {"type": "function_call", "id": "guard-call", "call_id": "guard-call",
"name": "exec_command", "arguments": json.dumps({
"cmd": turn_assignment + "\n" + command + " > " + shlex.quote(str(saved)),
"max_output_tokens": 1000})}
decision = json.loads(saved.read_text())
- assert decision["ok"] and decision["should_run"], decision
+ if worker_mode is None and transport_ready:
+ assert decision["mode"] == "full", decision
+ # Independent byte readback checks the current capture. This
+ # is not evidence that the model retained its whole input.
+ command = decision["recovery"]["command"]
+ content = ""
+ while command:
+ page = json.loads(subprocess.check_output(shlex.split(command), text=True, cwd=project))
+ content += page["content"]
+ if page["eof"]:
+ break
+ command = page["next_command"]
+ decision = json.loads(content)
+ assert decision.get("ok") is True and decision.get("should_run") is True, json.dumps({
+ key: decision.get(key) for key in ("ok", "should_run", "error", "error_code", "error_detail", "reason")
+ })
assert decision["goal_id"] == GOAL_ID
assert decision["heartbeat_receipt"]["turn_instance_id"] == observed[0]
return message
@@ -430,6 +473,13 @@ def response(request, number, message):
assert not errors and len(requests) == 2, errors
assert env == original, "Resolved worker defaults must not mutate caller/frozen input"
assert _heartbeat_receipt_count(runtime, observed[0]) == 1 and _spend_run_count(runtime) == 0
- assert "context_transport" not in result
- assert not (runtime / "context-delivery").exists() and not (home / "loopx-context").exists()
- assert not (home / "hooks.json").exists()
+ if worker_mode == "off" or not transport_ready:
+ if worker_mode == "off":
+ assert "context_transport" not in result
+ else:
+ assert result["context_transport"]["available"] is False
+ assert not (runtime / "context-delivery").exists() and not (home / "loopx-context").exists()
+ assert not (home / "hooks.json").exists()
+ else:
+ assert result["context_delivery"] == "on" and result["context_transport"]["available"]
+ assert (home / "hooks.json").is_file()
diff --git a/tests/control_plane/test_quota_settlement_cli.py b/tests/control_plane/test_quota_settlement_cli.py
index 6de88bb775..2b64bec8bd 100644
--- a/tests/control_plane/test_quota_settlement_cli.py
+++ b/tests/control_plane/test_quota_settlement_cli.py
@@ -26,6 +26,10 @@
)
from loopx.control_plane.quota.settlement import render_settlement_progress_markdown
from loopx.control_plane.todos.active_state_todo_parser import parse_active_state_todos
+from loopx.control_plane.turn_driver.decision_capture import (
+ read_context_capture_file,
+ read_context_read_reference,
+)
from loopx.control_plane.scheduler.state import (
APP_AUTOMATION_STATEFUL_BACKOFF_STATE_KEY,
load_scheduler_state,
@@ -210,7 +214,13 @@ def _run_cli(
runtime: Path,
*args: str,
cwd: Path = REPO_ROOT,
+ raw_guard: bool = True,
) -> tuple[int, dict[str, Any]]:
+ # Existing guard observers consume the authority decision, independently of
+ # machine presentation defaults. Native lifecycle tests use raw_guard=False
+ # to exercise omitted/default activation; explicit on/off is never replaced.
+ if raw_guard and args[:2] == ("quota", "should-run") and "--context-delivery" not in args:
+ args = (*args, "--context-delivery", "off")
result = subprocess.run(
[
sys.executable,
@@ -271,7 +281,16 @@ def _run_generated_cli(
text=True,
env={**os.environ, "PYTHONPATH": str(REPO_ROOT)},
)
- return result.returncode, json.loads(result.stdout)
+ payload = json.loads(result.stdout)
+ if payload.get("mode") in {"full", "delta"} and isinstance(payload.get("recovery"), dict):
+ # Execute the generated default-on command unchanged. These policy
+ # oracles inspect its current immutable capture without another guard,
+ # admission or retention claim; native reader coverage lives separately.
+ recovery = payload["recovery"]
+ if "reference_file" in recovery:
+ recovery = read_context_read_reference(recovery["reference_file"])[1]
+ _, _, payload = read_context_capture_file(recovery["path"], recovery["sha256"], private=True)
+ return result.returncode, payload
def _spend_run_count(runtime: Path) -> int:
@@ -4162,14 +4181,13 @@ def test_visible_goal_capability_reentry_preserves_turn_through_selection(
assert first_rc == 0, first
turn_instance_id = first["heartbeat_receipt"]["turn_instance_id"]
+ reentry_packet = first["interaction_contract"]["cli_channel"]["runtime_capability_reentry"]
if fallback_available:
assert first["interaction_contract"]["cli_channel"]["selection_required"] is True
assert first["selected_todo"]["todo_id"] == TODO_ID
assert first["interaction_contract"]["agent_channel"]["next_task_action"]["kind"] == "capability_verification"
- assert first["interaction_contract"]["cli_channel"]["next_cli_actions"][0] == first["runtime_capability_reentry"]["candidates"][0]["command"]
- reentry_command = first["runtime_capability_reentry"]["candidates"][0][
- "command"
- ]
+ assert first["interaction_contract"]["cli_channel"]["next_cli_actions"][0] == reentry_packet["candidates"][0]["command"]
+ reentry_command = reentry_packet["candidates"][0]["command"]
assert f"--turn-instance-id {turn_instance_id}" in reentry_command
reentry_rc, reentry = _run_generated_cli(
diff --git a/tests/control_plane/test_saved_context_project.py b/tests/control_plane/test_saved_context_project.py
index d6ecc1beab..acdf0e14de 100644
--- a/tests/control_plane/test_saved_context_project.py
+++ b/tests/control_plane/test_saved_context_project.py
@@ -87,6 +87,7 @@ def test_enabled_cache_preparation_failure_returns_error_with_original_reference
def test_saved_projection_manages_private_cache_without_authority_io(tmp_path, monkeypatch, enabled, cache_location):
from loopx.control_plane.turn_driver.codex_context import read_codex_context_reference
+ native_enabled = enabled is True or (enabled is None and os.name == "posix")
context, root = tmp_path / "native", tmp_path / "cache"
context.mkdir(mode=0o700)
if cache_location == "existing":
@@ -100,7 +101,7 @@ def test_saved_projection_manages_private_cache_without_authority_io(tmp_path, m
digest = hashlib.sha256(raw).hexdigest()
monkeypatch.setenv("CODEX_THREAD_ID", "native-session")
monkeypatch.chdir(tmp_path)
- if enabled:
+ if native_enabled:
from loopx.control_plane.turn_driver.codex_context import codex_context_hook
codex_context_hook(str(context), {"hook_event_name": "SessionStart", "source": "startup",
"session_id": "native-session", "cwd": str(tmp_path)})
@@ -115,7 +116,8 @@ def test_saved_projection_manages_private_cache_without_authority_io(tmp_path, m
code, result = _run_cli(registry, runtime, *args, cwd=tmp_path)
assert code == 0 and result["ok"] and result["mode"] == "full", result
assert path.read_bytes() == raw and not registry.exists() and not runtime.exists()
- if enabled:
+ if native_enabled:
+ assert result["schema_version"] == "context_capture_navigation_v1", result
assert "content" not in result and "offset" not in result
machine = machine_reference_oracle(result)
assert "index_command" in machine and "select_command" in machine