Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
ac0feb1
feat(context): enable supported Codex and benchmark delivery by default
loopx-agent Nov 1, 2026
714a565
test(context): cover unset preferences and native default opt-out
loopx-agent Nov 1, 2026
8996323
test(context): exercise native setup failure and async setting readback
loopx-agent Nov 1, 2026
937285b
fix(context): retain full delivery after native setup failure
loopx-agent Nov 1, 2026
b3a21af
test(context): retain original Turn expansion in fallback oracle
loopx-agent Nov 1, 2026
614d9fe
docs(context): clarify supported defaults and preserve diagnostic errors
loopx-agent Nov 1, 2026
5d5f0e2
test(benchmark): verify default on and explicit off through SForge CLI
loopx-agent Nov 1, 2026
5413305
feat(context): enable supported Codex and benchmark delivery by default
loopx-agent Nov 1, 2026
de5c609
test(context): cover unset preferences and native default opt-out
loopx-agent Nov 1, 2026
532e645
test(context): exercise native setup failure and async setting readback
loopx-agent Nov 1, 2026
5d0d0d5
fix(context): retain full delivery after native setup failure
loopx-agent Nov 1, 2026
42a3b07
test(context): retain original Turn expansion in fallback oracle
loopx-agent Nov 1, 2026
628ce2e
docs(context): clarify supported defaults and preserve diagnostic errors
loopx-agent Nov 1, 2026
b250484
test(benchmark): verify default on and explicit off through SForge CLI
loopx-agent Nov 1, 2026
cee0d47
test(context): isolate default-on projection assertions
huangruiteng Nov 1, 2026
5b918bc
Merge main while preserving default-on context readback assertions
loopx-agent Nov 1, 2026
54261da
test(context): qualify native defaults and explicit raw guard consumers
loopx-agent Nov 1, 2026
dc57be7
test(context): distinguish raw observers from native default activation
loopx-agent Nov 1, 2026
f6a244a
test: inspect generated native guards without replaying admission
loopx-agent Nov 1, 2026
18726cd
Merge maintainer context defaults and retain native guard policy oracles
loopx-agent Nov 1, 2026
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
Original file line number Diff line number Diff line change
Expand Up @@ -529,15 +529,17 @@ export function MachineConfigurationSettings({ section, onChanged }: {
<div className="personal-capability-fields"><label className="is-boolean">
<span>Codex</span>
<input aria-label={locale === "zh-CN" ? "在 Codex 中使用差分上下文" : "Use differential context in Codex"}
type="checkbox" role="switch" checked={selectedCurrent?.mode === "on"} disabled={Boolean(busy) || !editorAvailable}
type="checkbox" role="switch" checked={(selectedCurrent?.mode ?? selected.default?.mode) === "on"} disabled={Boolean(busy) || !editorAvailable}
onChange={(event) => void setContextDelivery(event.target.checked ? "on" : "off")} />
</label></div>
<p role="status">{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."}</p>
<p role="status">{(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."}</p>
<ContextHelp label={locale === "zh-CN" ? "Codex 支持范围与生效条件" : "Codex support and activation requirements"}><p>{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."}</p></ContextHelp>
? "受支持的 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."}</p></ContextHelp>
</section> : null}
{editorAvailable && selected.capability_id !== "context_delivery" ? <>{editorMode === "json" || !selected.configuration_editor.fields.some((field) => field.key === "enabled" && field.input_kind === "boolean") ? <div className="personal-capability-editor-mode">
<button disabled={Boolean(busy)} onClick={() => changeMode(editorMode === "guided" ? "json" : "guided")} type="button">
Expand Down
5 changes: 4 additions & 1 deletion benchmark/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 5 additions & 3 deletions benchmark/edgebench/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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:
Expand Down
10 changes: 7 additions & 3 deletions benchmark/runtime/RUNTIME.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 5 additions & 2 deletions benchmark/runtime/codex.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"):
Expand Down Expand Up @@ -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",
Expand Down
4 changes: 2 additions & 2 deletions benchmark/runtime/harbor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion benchmark/runtime/sforge.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
9 changes: 7 additions & 2 deletions benchmark/runtime/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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":
Expand All @@ -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:
Expand Down Expand Up @@ -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":
Expand Down
2 changes: 2 additions & 0 deletions benchmark/tests/test_resume_sessions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand Down
13 changes: 7 additions & 6 deletions benchmark/tests/test_sforge_runtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"):
Expand Down Expand Up @@ -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")
Expand All @@ -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")
Expand All @@ -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",
Expand All @@ -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)
Loading
Loading