Skip to content

Commit 0c2debb

Browse files
committed
Merge remote-tracking branch 'origin/main' into HEAD
Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
2 parents 34e9675 + d0d5af9 commit 0c2debb

82 files changed

Lines changed: 208893 additions & 220 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.gitattributes‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,8 @@ benchmark/frontiercs2-single-host-v1/** text eol=lf
55
# Published study archives bind sha256 of their own LF bytes in index.json, so
66
# a CRLF checkout must not rewrite them either.
77
benchmark/edgebench/studies/**/data/** text eol=lf
8+
9+
# The fold-meter verifier compares these files to the pinned npm archive.
10+
loopx/control_plane/meter_assets/** -text
11+
# The upstream o200k rank table ends with a blank line.
12+
loopx/control_plane/meter_assets/cjs/bpeRanks/o200k_base.js whitespace=-blank-at-eof

‎MANIFEST.in‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
graft loopx/web/chat
22
exclude loopx/semantics/project_registry_io_manifest_v1.json
3+
recursive-include scripts/vendor/fold_meter *.py *.md *.txt

‎benchmark/runtime/worker.py‎

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,68 @@ def _turn_phase_work_budget_exhausted(
4646
return remaining_seconds - reserve_seconds < TURN_NATIVE_HOST_MIN_TIMEOUT_SECONDS
4747

4848

49+
def _is_predispatch_superseded_turn_rejection(result: Mapping[str, object]) -> bool:
50+
"""Return True only when a pre-dispatch rejection proves zero effects."""
51+
if result.get("error_code") not in {
52+
"current_turn_work_changed",
53+
"current_turn_selection_changed",
54+
"goal_launch_not_allowed",
55+
}:
56+
return False
57+
effects = result.get("effects")
58+
if not isinstance(effects, Mapping) or "host_invoked" not in effects:
59+
return False
60+
# `build_turn_error_payload(..., execution_started=True)` emits `effects["host_invoked"] = None`
61+
# for `current_invocation` exceptions unless explicit `execution_effects` are attached,
62+
# while `journal_observation.recorded_effects` carries the authoritative original-turn proof.
63+
invoked = effects.get("host_invoked")
64+
if invoked is not False and invoked is not None:
65+
return False
66+
if effects.get("durable_writeback") or effects.get("quota_spent"):
67+
return False
68+
journal_obs = result.get("journal_observation")
69+
if not isinstance(journal_obs, Mapping):
70+
return False
71+
if journal_obs.get("available") is False:
72+
return False
73+
if journal_obs.get("status") != "observed" or journal_obs.get("scope") != "original_turn":
74+
return False
75+
if journal_obs.get("error") is not None or journal_obs.get("readback_error") is not None:
76+
return False
77+
if journal_obs.get("journal_consistent") is not True:
78+
return False
79+
recorded = journal_obs.get("recorded_effects")
80+
if not isinstance(recorded, Mapping):
81+
return False
82+
state_written = (
83+
recorded.get("state_written")
84+
if "state_written" in recorded
85+
else recorded.get("durable_writeback")
86+
)
87+
if any(value is not False for value in (
88+
state_written, recorded.get("quota_spent"), recorded.get("scheduler_acknowledged"),
89+
)):
90+
return False
91+
host_recorded = recorded.get("host_invoked")
92+
if host_recorded is False:
93+
return True
94+
# When Core increments `host_attempt_count` to 1 immediately before running
95+
# a pre-dispatch guard (`current_turn_work_changed`), `recorded_effects["host_invoked"]`
96+
# conservatively reports `None`; only accept that on a first attempt where
97+
# `effects["host_invoked"]` is explicitly `False`, `completed_phases` is `[]`,
98+
# and `host_failure` confirms `contract_rejected` on `attempt == 1`.
99+
host_failure = result.get("host_failure")
100+
return (
101+
host_recorded is None
102+
and effects.get("host_invoked") is False
103+
and journal_obs.get("completed_phases") == []
104+
and isinstance(host_failure, Mapping)
105+
and host_failure.get("kind") == "contract_rejected"
106+
and type(host_failure.get("attempt")) is int
107+
and host_failure["attempt"] == 1
108+
)
109+
110+
49111
def read_json(text: str) -> dict:
50112
payload = json.loads(text)
51113
if not isinstance(payload, dict):
@@ -1161,6 +1223,9 @@ def _turn_before_popen_guard() -> list[str]:
11611223
)
11621224
if receipt["ok"]:
11631225
pending_path.unlink()
1226+
elif _is_predispatch_superseded_turn_rejection(result):
1227+
pending_path.unlink(missing_ok=True)
1228+
receipt["pending_turn_retired_reason"] = str(result["error_code"])
11641229
elif frozen_postcondition_failed:
11651230
if recovery_decision.get("can_continue") is False:
11661231
pending_path.unlink(missing_ok=True)

0 commit comments

Comments
 (0)