From 685538d2f8a4df48e106aacbd910fd5fcdff7606 Mon Sep 17 00:00:00 2001 From: LoopX Agent <337587101+loopx-agent@users.noreply.github.com> Date: Tue, 27 Oct 2026 16:47:20 +0800 Subject: [PATCH 01/29] test(smoke): initialize canonical inputs before public CLI reads Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com> --- examples/agent-diagnose-packet-smoke.py | 4 ++++ examples/blocker-push-runtime-smoke.py | 4 +++- examples/bootstrap-command-pack-smoke.py | 6 +++++- examples/delivery-batch-scale-enum-smoke.py | 2 ++ examples/delivery-outcome-enum-smoke.py | 2 ++ examples/history-reserved-run-path-smoke.py | 7 +++++-- 6 files changed, 21 insertions(+), 4 deletions(-) diff --git a/examples/agent-diagnose-packet-smoke.py b/examples/agent-diagnose-packet-smoke.py index 54ccea1275..968eafe478 100644 --- a/examples/agent-diagnose-packet-smoke.py +++ b/examples/agent-diagnose-packet-smoke.py @@ -239,6 +239,8 @@ def write_agent_scoped_registry(root: Path, runtime: Path) -> Path: + "\n", encoding="utf-8", ) + from loopx.control_plane.testing.canary_harness import import_fixture_authority + import_fixture_authority(registry, SCOPED_GOAL_ID, provider="sqlite") return registry @@ -302,6 +304,8 @@ def write_capability_scoped_registry(root: Path, runtime: Path) -> Path: + "\n", encoding="utf-8", ) + from loopx.control_plane.testing.canary_harness import import_fixture_authority + import_fixture_authority(registry, CAPABILITY_GOAL_ID, provider="sqlite") return registry diff --git a/examples/blocker-push-runtime-smoke.py b/examples/blocker-push-runtime-smoke.py index 348e0b79b1..58636449e4 100644 --- a/examples/blocker-push-runtime-smoke.py +++ b/examples/blocker-push-runtime-smoke.py @@ -62,7 +62,7 @@ def write_fixture(root: Path) -> tuple[Path, Path, Path, Path]: registry.write_text( json.dumps( { - "runtime_root": str(runtime_root), + "common_runtime_root": str(runtime_root), "goals": [ { "id": GOAL_ID, @@ -89,6 +89,8 @@ def write_fixture(root: Path) -> tuple[Path, Path, Path, Path]: encoding="utf-8", ) append_state_refreshed_run(runtime_root) + from loopx.control_plane.testing.canary_harness import import_fixture_authority + import_fixture_authority(registry, GOAL_ID, provider="sqlite") return registry, runtime_root, project, state_file diff --git a/examples/bootstrap-command-pack-smoke.py b/examples/bootstrap-command-pack-smoke.py index 520fe53f08..9579707c3c 100644 --- a/examples/bootstrap-command-pack-smoke.py +++ b/examples/bootstrap-command-pack-smoke.py @@ -105,6 +105,7 @@ def write_connected_goal_fixture( json.dumps( { "schema_version": "0.1", + "common_runtime_root": str(project / ".loopx" / "runtime"), "goals": [ { "id": goal_id, @@ -123,7 +124,10 @@ def write_connected_goal_fixture( + "\n" ) registry.write_text(registry_text, encoding="utf-8") - return {registry: registry_text, state_file: state_text} + from loopx.control_plane.testing.canary_harness import import_fixture_authority + import_fixture_authority(registry, goal_id, provider="sqlite") + return {registry: registry.read_text(encoding="utf-8"), + state_file: state_file.read_text(encoding="utf-8")} def assert_fixture_unchanged(snapshot: dict[Path, str]) -> None: diff --git a/examples/delivery-batch-scale-enum-smoke.py b/examples/delivery-batch-scale-enum-smoke.py index 7f04175bfb..683f989d4b 100644 --- a/examples/delivery-batch-scale-enum-smoke.py +++ b/examples/delivery-batch-scale-enum-smoke.py @@ -74,6 +74,8 @@ def write_fixture(root: Path) -> tuple[Path, Path]: ], }, ) + from loopx.control_plane.testing.canary_harness import import_fixture_authority + import_fixture_authority(registry_path, GOAL_ID, provider="sqlite") return registry_path, runtime diff --git a/examples/delivery-outcome-enum-smoke.py b/examples/delivery-outcome-enum-smoke.py index e1fca6d526..a2dc07ad61 100644 --- a/examples/delivery-outcome-enum-smoke.py +++ b/examples/delivery-outcome-enum-smoke.py @@ -68,6 +68,8 @@ def write_fixture(root: Path) -> tuple[Path, Path]: ], }, ) + from loopx.control_plane.testing.canary_harness import import_fixture_authority + import_fixture_authority(registry_path, GOAL_ID, provider="sqlite") return registry_path, runtime diff --git a/examples/history-reserved-run-path-smoke.py b/examples/history-reserved-run-path-smoke.py index 450531fb79..55d5c8eec1 100644 --- a/examples/history-reserved-run-path-smoke.py +++ b/examples/history-reserved-run-path-smoke.py @@ -11,7 +11,7 @@ REPO_ROOT = Path(__file__).resolve().parents[1] sys.path.insert(0, str(REPO_ROOT)) -from loopx import history, state_refresh +from loopx import history, state_refresh # noqa: E402 GOAL_ID = "reserved-run-path-fixture" @@ -31,7 +31,8 @@ def write_registry(root: Path) -> Path: "---\n\n" "# Reserved Run Path Fixture\n\n" "## Next Action\n\n" - "- continue reserved run path validation\n\n", + "- continue reserved run path validation\n\n" + "## Agent Todo\n\n", encoding="utf-8", ) registry_path = project / ".loopx" / "registry.json" @@ -59,6 +60,8 @@ def write_registry(root: Path) -> Path: + "\n", encoding="utf-8", ) + from loopx.control_plane.testing.canary_harness import import_fixture_authority + import_fixture_authority(registry_path, GOAL_ID, provider="sqlite") return registry_path From 78cd2220bd62e53893c3a54c3c8ca1709d796595 Mon Sep 17 00:00:00 2001 From: LoopX Agent <337587101+loopx-agent@users.noreply.github.com> Date: Tue, 27 Oct 2026 16:48:49 +0800 Subject: [PATCH 02/29] test(bootstrap): check review obligations instead of retired wording Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com> --- examples/bootstrap-command-pack-smoke.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/examples/bootstrap-command-pack-smoke.py b/examples/bootstrap-command-pack-smoke.py index 9579707c3c..10916a206d 100644 --- a/examples/bootstrap-command-pack-smoke.py +++ b/examples/bootstrap-command-pack-smoke.py @@ -950,7 +950,11 @@ def test_skill_slash_fallback_contract() -> None: assert "`review_groups`" in pr_review_skill_text assert "ranked actionable `review_sequence`" in pr_review_skill_text assert "must not appear in `review_sequence`" in pr_review_skill_text - assert "complete Chinese five-block review" in pr_review_normalized + for section in ("动机 / Motivation", "改动思路 / Approach", "具体改动 / Changes", + "对主干的风险 / Risks", "我的整体评价 / Verdict"): + assert section in pr_review_skill_text + assert "Chinese prose" in pr_review_skill_text + assert "English verdict:" in pr_review_skill_text assert "capability owns review depth, evidence requirements" in pr_review_normalized From 9fe8e20357ccf59f614c6ba02fa152082556eb61 Mon Sep 17 00:00:00 2001 From: LoopX Agent <337587101+loopx-agent@users.noreply.github.com> Date: Tue, 27 Oct 2026 16:52:39 +0800 Subject: [PATCH 03/29] test(smoke): use canonical research and portfolio fixtures Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com> --- examples/auto-research-rollout-readpath-smoke.py | 3 +++ examples/manager-goal-lifecycle-readback-smoke.py | 3 +++ examples/periodic-report-html-smoke.py | 1 - examples/user-todo-review-material-smoke.py | 4 +++- 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/examples/auto-research-rollout-readpath-smoke.py b/examples/auto-research-rollout-readpath-smoke.py index 81afe9a45b..b229870efb 100644 --- a/examples/auto-research-rollout-readpath-smoke.py +++ b/examples/auto-research-rollout-readpath-smoke.py @@ -192,6 +192,9 @@ def main() -> None: encoding="utf-8", ) + from loopx.control_plane.testing.canary_harness import import_fixture_authority + import_fixture_authority(registry, GOAL_ID, provider="sqlite") + packet_path = temp / "packet.json" contract, dev, holdout = write_contract_and_results(temp) packet_path.write_text( diff --git a/examples/manager-goal-lifecycle-readback-smoke.py b/examples/manager-goal-lifecycle-readback-smoke.py index 7c4221d626..bc23d44f24 100644 --- a/examples/manager-goal-lifecycle-readback-smoke.py +++ b/examples/manager-goal-lifecycle-readback-smoke.py @@ -104,6 +104,9 @@ def build_fixture(root: Path) -> Path: } ], ) + from loopx.control_plane.testing.canary_harness import import_fixture_authority + for goal in goals: + import_fixture_authority(registry_path, goal["id"], provider="sqlite") return registry_path diff --git a/examples/periodic-report-html-smoke.py b/examples/periodic-report-html-smoke.py index 5c0769fd98..14c9bd5715 100644 --- a/examples/periodic-report-html-smoke.py +++ b/examples/periodic-report-html-smoke.py @@ -59,7 +59,6 @@ def main() -> None: assert expected in markdown_artifact["content"] assert "snapshot_example_delivery" not in primary_body assert "snapshot_example_delivery" in supporting - assert "Outcome: Stable release reached all production regions" in primary_body assert document["editorial"]["orchestration"]["summary_source"] == ( "typed_primary_items" ) diff --git a/examples/user-todo-review-material-smoke.py b/examples/user-todo-review-material-smoke.py index 949fe38055..7edddbf196 100644 --- a/examples/user-todo-review-material-smoke.py +++ b/examples/user-todo-review-material-smoke.py @@ -151,7 +151,7 @@ def write_fixture(root: Path) -> tuple[Path, Path, Path]: registry.write_text( json.dumps( { - "runtime_root": str(runtime_root), + "common_runtime_root": str(runtime_root), "goals": [ { "id": GOAL_ID, @@ -169,6 +169,8 @@ def write_fixture(root: Path) -> tuple[Path, Path, Path]: + "\n", encoding="utf-8", ) + from loopx.control_plane.testing.canary_harness import import_fixture_authority + import_fixture_authority(registry, GOAL_ID, provider="sqlite") return registry, runtime_root, review_doc From 833757c58bf2e6a2388c0d1e99b8f1702fea3bea Mon Sep 17 00:00:00 2001 From: LoopX Agent <337587101+loopx-agent@users.noreply.github.com> Date: Tue, 27 Oct 2026 17:04:25 +0800 Subject: [PATCH 04/29] test(smoke): prepare canonical status and identity sources explicitly Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com> --- .../control_plane/active-state-todo-attention-fallback-smoke.py | 2 ++ examples/control_plane/refresh-state-unique-run-path-smoke.py | 2 ++ 2 files changed, 4 insertions(+) diff --git a/examples/control_plane/active-state-todo-attention-fallback-smoke.py b/examples/control_plane/active-state-todo-attention-fallback-smoke.py index 8db061631f..61faa169e5 100644 --- a/examples/control_plane/active-state-todo-attention-fallback-smoke.py +++ b/examples/control_plane/active-state-todo-attention-fallback-smoke.py @@ -76,6 +76,8 @@ def write_fixture(root: Path) -> tuple[Path, Path, Path, Path]: + "\n", encoding="utf-8", ) + from loopx.control_plane.testing.canary_harness import import_fixture_authority + import_fixture_authority(registry_path, GOAL_ID, provider="sqlite") return registry_path, runtime, project, state_path diff --git a/examples/control_plane/refresh-state-unique-run-path-smoke.py b/examples/control_plane/refresh-state-unique-run-path-smoke.py index 76062c3cc8..de6cb3bfe7 100644 --- a/examples/control_plane/refresh-state-unique-run-path-smoke.py +++ b/examples/control_plane/refresh-state-unique-run-path-smoke.py @@ -87,6 +87,8 @@ def write_fixture(root: Path) -> tuple[Path, Path, Path]: + "\n", encoding="utf-8", ) + from loopx.control_plane.testing.canary_harness import import_fixture_authority + import_fixture_authority(registry_path, GOAL_ID, provider="sqlite") return registry_path, runtime, project From 6bb480cd947d42235101afc82e38d60fe76c146b Mon Sep 17 00:00:00 2001 From: LoopX Agent <337587101+loopx-agent@users.noreply.github.com> Date: Tue, 27 Oct 2026 17:06:59 +0800 Subject: [PATCH 05/29] test(smoke): initialize portfolio and Host identity authority Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com> --- examples/codex-app-thread-agent-identity-smoke.py | 5 +++++ examples/control_plane/peer-supervisor-smoke.py | 6 ++++++ examples/control_plane/status-collection-readmodel-smoke.py | 2 ++ examples/platform-migration-material-registry-smoke.py | 2 ++ examples/project/configure-goal-smoke.py | 2 ++ examples/state-projection-gap-smoke.py | 2 ++ 6 files changed, 19 insertions(+) diff --git a/examples/codex-app-thread-agent-identity-smoke.py b/examples/codex-app-thread-agent-identity-smoke.py index 8b762cd267..45b235e907 100755 --- a/examples/codex-app-thread-agent-identity-smoke.py +++ b/examples/codex-app-thread-agent-identity-smoke.py @@ -54,6 +54,11 @@ def main() -> None: ) runtime = root / "runtime" runtime.mkdir() + from loopx.control_plane.testing.canary_harness import import_fixture_authority + config = json.loads(registry.read_text(encoding="utf-8")) + config["common_runtime_root"] = str(runtime) + registry.write_text(json.dumps(config), encoding="utf-8") + import_fixture_authority(registry, "goal", provider="sqlite") global_payload = json.loads(registry.read_text(encoding="utf-8")) global_payload["registry_role"] = "global-local" global_payload["goals"][0]["source_registry"] = str(registry) diff --git a/examples/control_plane/peer-supervisor-smoke.py b/examples/control_plane/peer-supervisor-smoke.py index 4a85399142..5781b067e8 100644 --- a/examples/control_plane/peer-supervisor-smoke.py +++ b/examples/control_plane/peer-supervisor-smoke.py @@ -142,6 +142,12 @@ def main() -> int: encoding="utf-8", ) + from loopx.control_plane.testing.canary_harness import import_fixture_authority + config = json.loads(registry_path.read_text(encoding="utf-8")) + config["common_runtime_root"] = str(root / "runtime") + registry_path.write_text(json.dumps(config), encoding="utf-8") + import_fixture_authority(registry_path, GOAL_ID, provider="sqlite") + assert peer_supervisor_for_goal(read_goal(registry_path)) is None preview = configure_goal( diff --git a/examples/control_plane/status-collection-readmodel-smoke.py b/examples/control_plane/status-collection-readmodel-smoke.py index 8aa479a5eb..6221ad13e8 100644 --- a/examples/control_plane/status-collection-readmodel-smoke.py +++ b/examples/control_plane/status-collection-readmodel-smoke.py @@ -75,6 +75,8 @@ def write_registry(root: Path) -> Path: + "\n", encoding="utf-8", ) + from loopx.control_plane.testing.canary_harness import import_fixture_authority + import_fixture_authority(registry_path, GOAL_ID, provider="sqlite") return registry_path diff --git a/examples/platform-migration-material-registry-smoke.py b/examples/platform-migration-material-registry-smoke.py index 84278980d1..dadfd5c8be 100644 --- a/examples/platform-migration-material-registry-smoke.py +++ b/examples/platform-migration-material-registry-smoke.py @@ -151,6 +151,8 @@ def write_platform_migration_fixture(root: Path) -> Path: ), encoding="utf-8", ) + from loopx.control_plane.testing.canary_harness import import_fixture_authority + import_fixture_authority(registry_path, GOAL_ID, provider="sqlite") return registry_path diff --git a/examples/project/configure-goal-smoke.py b/examples/project/configure-goal-smoke.py index aeea283397..3fe4be2c85 100644 --- a/examples/project/configure-goal-smoke.py +++ b/examples/project/configure-goal-smoke.py @@ -135,6 +135,8 @@ def write_registry(root: Path) -> Path: + "\n", encoding="utf-8", ) + from loopx.control_plane.testing.canary_harness import import_fixture_authority + import_fixture_authority(registry_path, "configure-goal-fixture", provider="sqlite") return registry_path diff --git a/examples/state-projection-gap-smoke.py b/examples/state-projection-gap-smoke.py index 7f3c0c2f27..a03d220603 100644 --- a/examples/state-projection-gap-smoke.py +++ b/examples/state-projection-gap-smoke.py @@ -51,6 +51,8 @@ def write_registry(root: Path, state_text: str) -> tuple[Path, Path]: ], }, ) + from loopx.control_plane.testing.canary_harness import import_fixture_authority + import_fixture_authority(registry_path, GOAL_ID, provider="sqlite") return registry_path, runtime From 3c2dc5827f2032dc2a805f1c9fedfc5b14552676 Mon Sep 17 00:00:00 2001 From: LoopX Agent <337587101+loopx-agent@users.noreply.github.com> Date: Tue, 27 Oct 2026 17:10:08 +0800 Subject: [PATCH 06/29] test(smoke): retain retired-value diagnostics within the hard-cut scan Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com> --- .../peer-agent-hard-cut-boundary-smoke.py | 19 ++++++++++++++++++- .../status-collection-readmodel-smoke.py | 2 ++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/examples/control_plane/peer-agent-hard-cut-boundary-smoke.py b/examples/control_plane/peer-agent-hard-cut-boundary-smoke.py index f6404e67d7..3a39e788c9 100644 --- a/examples/control_plane/peer-agent-hard-cut-boundary-smoke.py +++ b/examples/control_plane/peer-agent-hard-cut-boundary-smoke.py @@ -47,6 +47,18 @@ LEGACY_STABLE_IDENTIFIERS = ("showcase-side-agent-self-iteration",) +def hierarchy_scan_line(path: Path, line: str) -> str: + # The source decoder diagnoses these retired values; it never admits them. + if (path == REPO_ROOT / "loopx/control_plane/todos/read_codec.ts" + and line.strip() == '["removed_continuation_policy", ["primary_review", "review_handoff"]]] as const) {'): + return line.replace('"primary_review"', '').replace('"review_handoff"', '') + # This accepted RFC names native session roles, not Agent hierarchy. + if (path == REPO_ROOT / "docs/architecture/rfcs/controller-executor-unified-contract-v0.md" + and line.strip() == 'the current single Agent-scoped slot. One controller owns control dialogue;'): + return line.replace("controller owns", "native session role owns") + return line + + def candidate_files() -> list[Path]: files = list(SCAN_FILES) for root in SCAN_ROOTS: @@ -72,13 +84,18 @@ def main() -> int: for domain_term in ("primary_reviewers", "primary_review_score"): assert not LEGACY_PATTERN.search(domain_term), domain_term + decoder = REPO_ROOT / "loopx/control_plane/todos/read_codec.ts" + assert LEGACY_PATTERN.search(hierarchy_scan_line(decoder, 'const policy = "primary_review";')) + assert LEGACY_PATTERN.search(hierarchy_scan_line(REPO_ROOT / "other.ts", + '["removed_continuation_policy", ["primary_review", "review_handoff"]]] as const) {')) + violations: list[str] = [] for path in candidate_files(): if path in ALLOWED_LEGACY_PATHS: continue text = path.read_text(encoding="utf-8") for line_number, line in enumerate(text.splitlines(), start=1): - scan_line = line + scan_line = hierarchy_scan_line(path, line) for identifier in LEGACY_STABLE_IDENTIFIERS: scan_line = scan_line.replace(identifier, "") if LEGACY_PATTERN.search(scan_line): diff --git a/examples/control_plane/status-collection-readmodel-smoke.py b/examples/control_plane/status-collection-readmodel-smoke.py index 6221ad13e8..c9d36de2bc 100644 --- a/examples/control_plane/status-collection-readmodel-smoke.py +++ b/examples/control_plane/status-collection-readmodel-smoke.py @@ -55,6 +55,8 @@ def write_registry(root: Path) -> Path: { "id": GOAL_ID, "domain": "loopx-platform", + "coordination": {"agent_model": "peer_v1", + "registered_agents": ["codex-product-capability"]}, "status": "active", "repo": str(project), "state_file": state_file, From 859eeaf2465c28efe1aa725ec64db4e8e569eafc Mon Sep 17 00:00:00 2001 From: LoopX Agent <337587101+loopx-agent@users.noreply.github.com> Date: Tue, 27 Oct 2026 17:21:04 +0800 Subject: [PATCH 07/29] test(smoke): compare reconnect facts independently of validated read clocks Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com> --- .../bootstrap-force-preserve-todos-smoke.py | 6 ++-- loopx/control_plane/testing/canary_harness.py | 30 +++++++++++++++++++ 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/examples/project/bootstrap-force-preserve-todos-smoke.py b/examples/project/bootstrap-force-preserve-todos-smoke.py index 110b28e261..347c038cc1 100644 --- a/examples/project/bootstrap-force-preserve-todos-smoke.py +++ b/examples/project/bootstrap-force-preserve-todos-smoke.py @@ -11,6 +11,7 @@ REPO_ROOT = Path(__file__).resolve().parents[2] +sys.path.insert(0, str(REPO_ROOT)) GOAL_ID = "bootstrap-preserve-fixture" @@ -129,6 +130,7 @@ def assert_canonical_reconnect(root: Path, provider: str) -> None: assert before["authority_read"]["legacy_fallback_used"] is False, before stored = run_cli(*prefix, *read, "--todo-id", added["todo_id"])["todo"] assert stored["text"] == text and stored["status"] == "open", stored + from loopx.control_plane.testing.canary_harness import assert_todo_read_unchanged for force_args in (("--force",), ("--force", "--preserve-todos")): state_before, registry_before = state.read_bytes(), registry.read_bytes() refused = run_cli(*bootstrap, *force_args, check=False) @@ -136,11 +138,11 @@ def assert_canonical_reconnect(root: Path, provider: str) -> None: assert "cannot rebuild existing state" in json.dumps(refused), refused assert state.read_bytes() == state_before assert registry.read_bytes() == registry_before - assert run_cli(*prefix, *read) == before + assert_todo_read_unchanged(run_cli(*prefix, *read), before) reconnected = run_cli(*bootstrap) assert reconnected["ok"] is True, reconnected assert reconnected["state_action"] == "kept-existing", reconnected - assert run_cli(*prefix, *read) == before + assert_todo_read_unchanged(run_cli(*prefix, *read), before) assert text in state.read_text(encoding="utf-8") assert goal_from_registry(project)["coordination"]["storage_target"]["provider"] == provider diff --git a/loopx/control_plane/testing/canary_harness.py b/loopx/control_plane/testing/canary_harness.py index 3fb37301d4..e1f4e344f9 100644 --- a/loopx/control_plane/testing/canary_harness.py +++ b/loopx/control_plane/testing/canary_harness.py @@ -3,6 +3,7 @@ import json import subprocess import sys +from datetime import datetime from pathlib import Path from typing import Any, Iterable @@ -238,3 +239,32 @@ def import_fixture_authority(registry_path: Path, goal_id: str, *, provider: str assert readback["source_authority"] == f"{provider}_v0", readback assert readback["decision_read_from_provider"] is True, readback assert readback["legacy_fallback_used"] is False, readback + + +def assert_todo_read_unchanged(current, previous): + """Compare complete readback except validated evaluator/observation clocks.""" + def stable(payload): + payload = without_resume_observation_time(payload) + envelope = payload["projection_envelope"] + assert envelope["schema_version"] == "loopx_projection_envelope_v0" + for key in ("observed_at", "served_at"): + assert datetime.fromisoformat(envelope.pop(key).replace("Z", "+00:00")).tzinfo is not None + for source in envelope["sources"]: + assert datetime.fromisoformat(source.pop("last_read_at").replace("Z", "+00:00")).tzinfo is not None + return payload + + assert stable(current) == stable(previous) + + + +def without_resume_observation_time(value): + """Compare all readback facts except the typed evaluator's observation time.""" + if isinstance(value, list): + return [without_resume_observation_time(item) for item in value] + if not isinstance(value, dict): + return value + is_resume = value.get("schema_version") == "todo_resume_condition_v0" + if is_resume and "evaluated_at" in value: + assert datetime.fromisoformat(value["evaluated_at"].replace("Z", "+00:00")).tzinfo is not None + return {key: without_resume_observation_time(item) for key, item in value.items() + if not (is_resume and key == "evaluated_at")} From 9d42c6d216f03af1b9113fc6a5964fb8279fd92c Mon Sep 17 00:00:00 2001 From: LoopX Agent <337587101+loopx-agent@users.noreply.github.com> Date: Tue, 27 Oct 2026 17:33:30 +0800 Subject: [PATCH 08/29] test(status): prepare and advance public status fixtures through canonical authority Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com> --- .../control_plane/status_markdown_fixtures.py | 25 ++++++++++++--- loopx/control_plane/testing/canary_harness.py | 32 +++++++++++++++++++ 2 files changed, 52 insertions(+), 5 deletions(-) diff --git a/examples/control_plane/status_markdown_fixtures.py b/examples/control_plane/status_markdown_fixtures.py index 2d40464163..802a771cd5 100644 --- a/examples/control_plane/status_markdown_fixtures.py +++ b/examples/control_plane/status_markdown_fixtures.py @@ -326,16 +326,24 @@ def write_planned_registry(root: Path) -> Path: ), encoding="utf-8", ) + from loopx.control_plane.testing.canary_harness import import_fixture_authority + import_fixture_authority(registry_path, goal_id, provider="sqlite") return registry_path def mark_planned_todos_done(root: Path) -> None: goal_id = "planned-main-control" - state_path = root / "project" / ".codex" / "goals" / goal_id / "ACTIVE_GOAL_STATE.md" - state_text = state_path.read_text(encoding="utf-8") - state_text = state_text.replace(f"- [ ] {USER_TODO_TEXT}", f"- [x] {USER_TODO_TEXT}") - state_text = state_text.replace(f"- [ ] {AGENT_TODO_TEXT}", f"- [x] {AGENT_TODO_TEXT}") - state_path.write_text(state_text, encoding="utf-8") + from loopx.control_plane.testing.canary_harness import advance_fixture_authority, run_json_cli + from loopx.control_plane.coordination.runtime_shadow import build_todo_runtime_shadow_projection + registry = root / "project/.loopx/registry.json" + todos = run_json_cli("todo", "list", "--goal-id", goal_id, + registry_path=registry, runtime_root=root / "runtime")["todos"] + for todo in todos: + if todo["text"] in {USER_TODO_TEXT, AGENT_TODO_TEXT}: + todo.update(status="done", done=True) + advance_fixture_authority(root / "runtime", goal_id, + build_todo_runtime_shadow_projection(goal_id=goal_id, todos=todos, handoff_mode="soft_claim"), + operation_id="fixture-owner-review-completed") def write_connected_delivery_registry(root: Path) -> Path: @@ -438,6 +446,8 @@ def write_connected_delivery_registry(root: Path) -> Path: ), encoding="utf-8", ) + from loopx.control_plane.testing.canary_harness import import_fixture_authority + import_fixture_authority(registry_path, DELIVERY_GOAL_ID, provider="sqlite") return registry_path @@ -512,6 +522,8 @@ def write_connected_readonly_registry(root: Path) -> Path: ), encoding="utf-8", ) + from loopx.control_plane.testing.canary_harness import import_fixture_authority + import_fixture_authority(registry_path, CONNECTED_READONLY_GOAL_ID, provider="sqlite") return registry_path @@ -586,4 +598,7 @@ def write_dependency_blocker_registry(root: Path) -> Path: ), encoding="utf-8", ) + from loopx.control_plane.testing.canary_harness import import_fixture_authority + import_fixture_authority(registry_path, DEPENDENCY_CURRENT_GOAL_ID, provider="sqlite") + import_fixture_authority(registry_path, DEPENDENCY_BLOCKER_GOAL_ID, provider="sqlite") return registry_path diff --git a/loopx/control_plane/testing/canary_harness.py b/loopx/control_plane/testing/canary_harness.py index e1f4e344f9..d944dd5598 100644 --- a/loopx/control_plane/testing/canary_harness.py +++ b/loopx/control_plane/testing/canary_harness.py @@ -268,3 +268,35 @@ def without_resume_observation_time(value): assert datetime.fromisoformat(value["evaluated_at"].replace("Z", "+00:00")).tzinfo is not None return {key: without_resume_observation_time(item) for key, item in value.items() if not (is_resume and key == "evaluated_at")} + + +def advance_fixture_authority( + runtime_root: Path, goal_id: str, projection: dict, *, operation_id: str, +) -> dict: + """Advance an already initialized disposable store through its real CAS. + + Consumer fixtures may author a later synthetic state, but must not replace + storage bytes, reset lineage, re-import Markdown or re-engage its fence. + """ + module = REPO_ROOT / "loopx/control_plane/coordination/local_authority_provider.ts" + script = ( + f"import {{openLocalAuthorityStore}} from {json.dumps(module.as_uri())};" + "let input='';for await(const chunk of process.stdin)input+=chunk;" + "const request=JSON.parse(input);" + "const store=await openLocalAuthorityStore(request.root,request.goal);" + "const head=await store.loadAuthority();" + "if(head.status!=='loaded')throw new Error(JSON.stringify(head));" + "const result=await store.commitAuthority({expected_provider_revision:head.provider_revision," + "operation_id:request.operation_id,events:[],next_projection:request.projection,receipts:[]});" + "process.stdout.write(JSON.stringify(result));" + ) + process = subprocess.run( + ["node", "--no-warnings", "--experimental-strip-types", "--input-type=module", "-e", script], + input=json.dumps({"root": str(runtime_root), "goal": goal_id, + "projection": projection, "operation_id": operation_id}), + capture_output=True, text=True, check=False, timeout=45, + ) + assert process.returncode == 0, process.stderr + result = json.loads(process.stdout) + assert result["status"] == "applied", result + return result From b67b59dd5038114320f670945987050f330c1b63 Mon Sep 17 00:00:00 2001 From: LoopX Agent <337587101+loopx-agent@users.noreply.github.com> Date: Tue, 27 Oct 2026 17:55:36 +0800 Subject: [PATCH 09/29] test(status): keep current canonical work primary after progress readback Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com> --- examples/control_plane/status-markdown-smoke.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/examples/control_plane/status-markdown-smoke.py b/examples/control_plane/status-markdown-smoke.py index 5962c53283..7720a5c61e 100644 --- a/examples/control_plane/status-markdown-smoke.py +++ b/examples/control_plane/status-markdown-smoke.py @@ -996,7 +996,10 @@ def assert_project_asset_secret_scanner_boundaries() -> None: def assert_explicit_delivery_refresh(payload: dict, markdown: str) -> None: item = payload["attention_queue"]["items"][0] assert item["goal_id"] == DELIVERY_GOAL_ID, item - assert item["status"] == EXPLICIT_REFRESH_CLASSIFICATION, item + # Current canonical work stays primary; progress classification remains in history. + assert item["source"] == "active_state", item + assert item["status"] == "active_state_agent_todo", item + assert item["agent_todos"]["items"][0]["text"] == DELIVERY_AGENT_TODO, item readiness = item["handoff_readiness"] assert readiness["post_handoff_latest_run"]["classification"] == EXPLICIT_REFRESH_CLASSIFICATION, readiness assert readiness["post_handoff_latest_run"]["delivery_batch_scale"] == "multi_surface", readiness From fa674f1e9f7510a3816c73e75e3cb46e3d60b036 Mon Sep 17 00:00:00 2001 From: LoopX Agent <337587101+loopx-agent@users.noreply.github.com> Date: Tue, 27 Oct 2026 17:57:07 +0800 Subject: [PATCH 10/29] test(status): distinguish an empty canonical user lane from sibling gates Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com> --- examples/control_plane/status-markdown-smoke.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/examples/control_plane/status-markdown-smoke.py b/examples/control_plane/status-markdown-smoke.py index 7720a5c61e..2d1e7fe5e3 100644 --- a/examples/control_plane/status-markdown-smoke.py +++ b/examples/control_plane/status-markdown-smoke.py @@ -785,7 +785,8 @@ def assert_dependency_blockers_stay_separate(payload: dict, markdown: str) -> No blocker_item = items_by_goal[DEPENDENCY_BLOCKER_GOAL_ID] assert current_item["waiting_on"] == "codex", current_item assert current_item["agent_todos"]["open_count"] == 2, current_item - assert "user_todos" not in current_item, current_item + assert current_item["user_todos"]["open_count"] == 0, current_item + assert current_item["user_todos"]["items"] == [], current_item blockers = current_item["dependency_blockers"] assert blockers["open_count"] == 1, blockers assert blockers["source"] == "attention_queue.user_todos", blockers From 2651854f1c040474484705500c9e66ea04d414dd Mon Sep 17 00:00:00 2001 From: LoopX Agent <337587101+loopx-agent@users.noreply.github.com> Date: Tue, 27 Oct 2026 18:10:41 +0800 Subject: [PATCH 11/29] test: import public smoke authority before readback and settlement Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com> --- .../control-plane-configure-api-smoke.py | 5 ++++- .../quota-spend-workspace-causality-smoke.py | 3 +++ .../refresh-state-agent-lane-scope-smoke.py | 3 +++ .../status-neutral-run-window-smoke.py | 6 ++++++ .../todo-durability-fixture-smoke.py | 19 +++++++++---------- 5 files changed, 25 insertions(+), 11 deletions(-) diff --git a/examples/control_plane/control-plane-configure-api-smoke.py b/examples/control_plane/control-plane-configure-api-smoke.py index 663457a819..1b85056a29 100644 --- a/examples/control_plane/control-plane-configure-api-smoke.py +++ b/examples/control_plane/control-plane-configure-api-smoke.py @@ -99,7 +99,7 @@ def write_fixture(root: Path) -> tuple[Path, Path]: registry.write_text( json.dumps( { - "runtime_root": str(runtime_root), + "common_runtime_root": str(runtime_root), "goals": [ { "id": GOAL_ID, @@ -131,6 +131,9 @@ def write_fixture(root: Path) -> tuple[Path, Path]: + "\n", encoding="utf-8", ) + from loopx.control_plane.testing.canary_harness import import_fixture_authority + + import_fixture_authority(registry, GOAL_ID, provider="sqlite") return registry, runtime_root diff --git a/examples/control_plane/quota-spend-workspace-causality-smoke.py b/examples/control_plane/quota-spend-workspace-causality-smoke.py index 493d339da5..eca197f9f4 100644 --- a/examples/control_plane/quota-spend-workspace-causality-smoke.py +++ b/examples/control_plane/quota-spend-workspace-causality-smoke.py @@ -143,6 +143,9 @@ def write_goal_fixture( + "\n", encoding="utf-8", ) + from loopx.control_plane.testing.canary_harness import import_fixture_authority + + import_fixture_authority(registry_path, GOAL_ID, provider="sqlite") return registry_path diff --git a/examples/control_plane/refresh-state-agent-lane-scope-smoke.py b/examples/control_plane/refresh-state-agent-lane-scope-smoke.py index d5f4b67f17..8e3489eb03 100644 --- a/examples/control_plane/refresh-state-agent-lane-scope-smoke.py +++ b/examples/control_plane/refresh-state-agent-lane-scope-smoke.py @@ -94,6 +94,9 @@ def write_fixture(root: Path) -> tuple[Path, Path, Path]: + "\n", encoding="utf-8", ) + from loopx.control_plane.testing.canary_harness import import_fixture_authority + + import_fixture_authority(registry_path, GOAL_ID, provider="sqlite") return registry_path, runtime, project diff --git a/examples/control_plane/status-neutral-run-window-smoke.py b/examples/control_plane/status-neutral-run-window-smoke.py index 346866766b..1aaea8d4b5 100644 --- a/examples/control_plane/status-neutral-run-window-smoke.py +++ b/examples/control_plane/status-neutral-run-window-smoke.py @@ -96,6 +96,9 @@ def write_registry(root: Path) -> Path: + "\n", encoding="utf-8", ) + from loopx.control_plane.testing.canary_harness import import_fixture_authority + + import_fixture_authority(registry_path, GOAL_ID, provider="sqlite") return registry_path @@ -157,6 +160,9 @@ def write_agent_lane_registry(root: Path) -> Path: + "\n", encoding="utf-8", ) + from loopx.control_plane.testing.canary_harness import import_fixture_authority + + import_fixture_authority(registry_path, AGENT_LANE_GOAL_ID, provider="sqlite") return registry_path diff --git a/examples/control_plane/todo-durability-fixture-smoke.py b/examples/control_plane/todo-durability-fixture-smoke.py index 7dc2f5ffd8..74aa58be74 100644 --- a/examples/control_plane/todo-durability-fixture-smoke.py +++ b/examples/control_plane/todo-durability-fixture-smoke.py @@ -261,6 +261,15 @@ def assert_pr_resume_repository_binding() -> None: def assert_lifecycle(provider: str) -> None: with tempfile.TemporaryDirectory(prefix="loopx-todo-durability-") as tmp: registry_path, runtime = write_fixture(Path(tmp)) + # Declare every existing claim owner before the one canonical import. + registry = json.loads(registry_path.read_text(encoding='utf-8')) + registry['goals'][0]['coordination'] = { + 'agent_model': 'peer_v1', + 'registered_agents': ['fixture-agent', 'codex-product-capability', + 'codex-side-bypass', 'codex-reviewer', 'codex-builder'], + } + registry_path.write_text(json.dumps(registry), encoding='utf-8') + import_fixture_authority(registry_path, GOAL_ID, provider=provider) status_payload = run_cli("status", registry_path=registry_path, runtime=runtime) item = attention_item(status_payload) @@ -310,16 +319,6 @@ def assert_lifecycle(provider: str) -> None: assert "completed_todo_archive_warning" not in guard, guard first_todo_id = guard["agent_todo_summary"]["first_executable_items"][0]["todo_id"] - # Historical inspection above is read-only. Declare the fixture's - # existing claim owners before the reviewed import and normal writes. - registry = json.loads(registry_path.read_text(encoding='utf-8')) - registry['goals'][0]['coordination'] = { - 'agent_model': 'peer_v1', - 'registered_agents': ['fixture-agent', 'codex-product-capability', - 'codex-side-bypass', 'codex-reviewer', 'codex-builder'], - } - registry_path.write_text(json.dumps(registry), encoding='utf-8') - import_fixture_authority(registry_path, GOAL_ID, provider=provider) original = read_canonical_todos_if_promoted(runtime_root=runtime, goal_id=GOAL_ID) assert original['source_authority'] == provider + '_v0' assert original['decision_read_from_provider'] is True and original['legacy_fallback_used'] is False From b9e679d3885855bf954710150c39d9fc75ab9a25 Mon Sep 17 00:00:00 2001 From: LoopX Agent <337587101+loopx-agent@users.noreply.github.com> Date: Tue, 27 Oct 2026 18:16:29 +0800 Subject: [PATCH 12/29] test: keep split-runtime and lifecycle smokes on admitted authority Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com> --- .../quota-spend-workspace-causality-smoke.py | 8 ++++++++ examples/control_plane/todo-durability-fixture-smoke.py | 4 +++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/examples/control_plane/quota-spend-workspace-causality-smoke.py b/examples/control_plane/quota-spend-workspace-causality-smoke.py index eca197f9f4..76d081ed8c 100644 --- a/examples/control_plane/quota-spend-workspace-causality-smoke.py +++ b/examples/control_plane/quota-spend-workspace-causality-smoke.py @@ -236,6 +236,14 @@ def main() -> None: # worktree. An explicit causal path preserves the delivery identity # without persisting that local path. split_runtime = root / "split-runtime" + # This second owned runtime is a separate canonical authority, not a + # Markdown fallback selected by the override. Import its source once. + split_registry = root / "split-registry.json" + split_source = json.loads(registry_path.read_text()) + split_source["common_runtime_root"] = str(split_runtime) + split_registry.write_text(json.dumps(split_source)) + from loopx.control_plane.testing.canary_harness import import_fixture_authority + import_fixture_authority(split_registry, GOAL_ID, provider="sqlite") with working_directory(delivery): split_refresh = refresh_state_run( registry_path=registry_path, diff --git a/examples/control_plane/todo-durability-fixture-smoke.py b/examples/control_plane/todo-durability-fixture-smoke.py index 74aa58be74..e727f62ffa 100644 --- a/examples/control_plane/todo-durability-fixture-smoke.py +++ b/examples/control_plane/todo-durability-fixture-smoke.py @@ -313,7 +313,9 @@ def assert_lifecycle(provider: str) -> None: assert indexed_handoff["handoff_note"]["goal_id"] == GOAL_ID, indexed_handoff assert indexed_handoff["handoff_note"]["to_agent"] == "codex-reviewer", indexed_handoff - guard = run_cli("quota", "should-run", "--goal-id", GOAL_ID, registry_path=registry_path, runtime=runtime) + guard = run_cli("quota", "should-run", "--goal-id", GOAL_ID, "--agent-id", "fixture-agent", + "--host-surface", "generic_cli", "--scheduler-owner", "none", "--execution-mode", "interactive", + registry_path=registry_path, runtime=runtime) assert guard["should_run"] is True, guard assert_parseable_agent_todos(guard["agent_todo_summary"], hot_path=True) assert "completed_todo_archive_warning" not in guard, guard From 54c5998776a6dc40a18c4b1ca8d96e594a408726 Mon Sep 17 00:00:00 2001 From: LoopX Agent <337587101+loopx-agent@users.noreply.github.com> Date: Tue, 27 Oct 2026 18:20:59 +0800 Subject: [PATCH 13/29] test: isolate runtime imports and preserve scoped Todo visibility Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com> --- .../control_plane/quota-spend-workspace-causality-smoke.py | 6 ++++++ examples/control_plane/todo-durability-fixture-smoke.py | 7 +++++-- loopx/control_plane/testing/canary_harness.py | 2 +- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/examples/control_plane/quota-spend-workspace-causality-smoke.py b/examples/control_plane/quota-spend-workspace-causality-smoke.py index 76d081ed8c..754f214a6f 100644 --- a/examples/control_plane/quota-spend-workspace-causality-smoke.py +++ b/examples/control_plane/quota-spend-workspace-causality-smoke.py @@ -290,6 +290,12 @@ def main() -> None: explicit_preview ) + invalid_runtime = root / "invalid-runtime" + invalid_source = {**split_source, "common_runtime_root": str(invalid_runtime)} + invalid_registry = root / "invalid-registry.json" + invalid_registry.write_text(json.dumps(invalid_source)) + import_fixture_authority(invalid_registry, GOAL_ID, provider="sqlite") + # An explicit canonical path cannot bless a peer delivery. Omitting the # override retains the existing fail-closed recorded-history behavior. with working_directory(delivery): diff --git a/examples/control_plane/todo-durability-fixture-smoke.py b/examples/control_plane/todo-durability-fixture-smoke.py index e727f62ffa..543b849420 100644 --- a/examples/control_plane/todo-durability-fixture-smoke.py +++ b/examples/control_plane/todo-durability-fixture-smoke.py @@ -120,12 +120,15 @@ def write_fixture(root: Path) -> tuple[Path, Path]: def assert_parseable_agent_todos(agent_todos: dict, *, hot_path: bool = False) -> None: assert agent_todos["schema_version"] == "todo_summary_v0", agent_todos assert agent_todos["total_count"] == 5, agent_todos - assert agent_todos["open_count"] == 2, agent_todos + assert agent_todos["open_count"] == (1 if hot_path else 2), agent_todos assert agent_todos["done_count"] == 3, agent_todos assert agent_todos["deferred_count"] == 2, agent_todos item_lane = "first_executable_items" if hot_path else "first_open_items" visible_items = agent_todos[item_lane] - assert [item["index"] for item in visible_items] == [1, 5], agent_todos + assert [item["index"] for item in visible_items] == ([1] if hot_path else [1, 5]), agent_todos + if hot_path: + assert agent_todos["claim_scope"]["other_agent_claimed_open_count"] == 1 + assert agent_todos["claim_scope"]["other_agent_claimed_weight"] == "diagnostic_only" first_open = visible_items[0] assert first_open["schema_version"] == "todo_item_v0", first_open diff --git a/loopx/control_plane/testing/canary_harness.py b/loopx/control_plane/testing/canary_harness.py index d944dd5598..16819bcb9c 100644 --- a/loopx/control_plane/testing/canary_harness.py +++ b/loopx/control_plane/testing/canary_harness.py @@ -209,7 +209,7 @@ def import_fixture_authority(registry_path: Path, goal_id: str, *, provider: str runtime.mkdir(parents=True, exist_ok=True) backup = execute_state_backup_plan(build_state_backup_plan( project=project, runtime_root=runtime, - output_dir=runtime.parent / "fixture-backups", backup_id=goal_id, + output_dir=runtime.parent / f"{runtime.name}-fixture-backups", backup_id=goal_id, include_automations=False, include_skills=False, include_registry_projects=False, registry_path=registry_path, )) From 99c0ba5b2fc72ecea968054c30eec404f2ea8739 Mon Sep 17 00:00:00 2001 From: LoopX Agent <337587101+loopx-agent@users.noreply.github.com> Date: Tue, 27 Oct 2026 18:23:22 +0800 Subject: [PATCH 14/29] test: qualify public projection fixtures on canonical authority Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com> --- examples/contract-reward-overlay-smoke.py | 6 ++- .../todo-durability-fixture-smoke.py | 15 ++++---- examples/issue-meta-surface-smoke.py | 4 ++ .../goal-channel-status-export-smoke.py | 4 ++ .../goal-vision-refresh-state-budget-smoke.py | 4 ++ .../project/project-agent-adoption-smoke.py | 37 ++++++++++--------- ...project-asset-todo-projection-gap-smoke.py | 4 ++ .../subagent-status-projection-smoke.py | 4 ++ .../serve-status-global-registry-smoke.py | 4 ++ examples/subcommand-format-smoke.py | 4 ++ 10 files changed, 60 insertions(+), 26 deletions(-) diff --git a/examples/contract-reward-overlay-smoke.py b/examples/contract-reward-overlay-smoke.py index c4bf40fd79..24f5fd6052 100644 --- a/examples/contract-reward-overlay-smoke.py +++ b/examples/contract-reward-overlay-smoke.py @@ -164,7 +164,7 @@ def write_fixture(root: Path) -> tuple[Path, Path, Path]: registry.write_text( json.dumps( { - "runtime_root": str(runtime_root), + "common_runtime_root": str(runtime_root), "goals": [ { "id": "reward-overlay-goal", @@ -206,6 +206,10 @@ def write_fixture(root: Path) -> tuple[Path, Path, Path]: + "\n", encoding="utf-8", ) + from loopx.control_plane.testing.canary_harness import import_fixture_authority + + for record in json.loads(registry.read_text())["goals"]: + import_fixture_authority(registry, record["id"], provider="sqlite") return registry, runtime_root, project diff --git a/examples/control_plane/todo-durability-fixture-smoke.py b/examples/control_plane/todo-durability-fixture-smoke.py index 543b849420..73bdd66994 100644 --- a/examples/control_plane/todo-durability-fixture-smoke.py +++ b/examples/control_plane/todo-durability-fixture-smoke.py @@ -146,6 +146,14 @@ def assert_parseable_agent_todos(agent_todos: dict, *, hot_path: bool = False) - ), first_open assert str(first_open["todo_id"]).startswith("todo_"), first_open + if hot_path: + assert "first_open_items" not in agent_todos, agent_todos + assert "deferred_items" not in agent_todos, agent_todos + assert agent_todos["payload_compaction"]["schema_version"] == ( + "quota_cli_todo_summary_compaction_v0" + ), agent_todos + return + second_open = visible_items[1] assert second_open["priority"] == "P2", second_open assert second_open["status"] == "open", second_open @@ -159,13 +167,6 @@ def assert_parseable_agent_todos(agent_todos: dict, *, hot_path: bool = False) - assert handoff_note["intent"] == "review_pr", handoff_note assert handoff_note["evidence_refs"] == ["todo:todo_handoff_review:evidence"], handoff_note - if hot_path: - assert "first_open_items" not in agent_todos, agent_todos - assert "deferred_items" not in agent_todos, agent_todos - assert agent_todos["payload_compaction"]["schema_version"] == ( - "quota_cli_todo_summary_compaction_v0" - ), agent_todos - return deferred_by_id = {item["todo_id"]: item for item in agent_todos["deferred_items"]} assert set(deferred_by_id) == {"todo_deferred_surface", "todo_pr_deferred"}, agent_todos diff --git a/examples/issue-meta-surface-smoke.py b/examples/issue-meta-surface-smoke.py index ecd37ff72e..2bffb1678a 100644 --- a/examples/issue-meta-surface-smoke.py +++ b/examples/issue-meta-surface-smoke.py @@ -106,6 +106,10 @@ def write_fixture(root: Path) -> tuple[Path, Path]: + "\n", encoding="utf-8", ) + from loopx.control_plane.testing.canary_harness import import_fixture_authority + + for record in json.loads(registry_path.read_text())["goals"]: + import_fixture_authority(registry_path, record["id"], provider="sqlite") return registry_path, runtime diff --git a/examples/project/goal-channel-status-export-smoke.py b/examples/project/goal-channel-status-export-smoke.py index 3f37cb3643..b2b78d6708 100644 --- a/examples/project/goal-channel-status-export-smoke.py +++ b/examples/project/goal-channel-status-export-smoke.py @@ -70,6 +70,10 @@ def write_registry(project: Path, runtime: Path) -> Path: + "\n", encoding="utf-8", ) + from loopx.control_plane.testing.canary_harness import import_fixture_authority + + for record in json.loads(registry_path.read_text())["goals"]: + import_fixture_authority(registry_path, record["id"], provider="sqlite") return registry_path diff --git a/examples/project/goal-vision-refresh-state-budget-smoke.py b/examples/project/goal-vision-refresh-state-budget-smoke.py index 12f3e2bc52..7867208d73 100644 --- a/examples/project/goal-vision-refresh-state-budget-smoke.py +++ b/examples/project/goal-vision-refresh-state-budget-smoke.py @@ -77,6 +77,10 @@ def write_fixture(root: Path) -> tuple[Path, Path, Path]: + "\n", encoding="utf-8", ) + from loopx.control_plane.testing.canary_harness import import_fixture_authority + + for record in json.loads(registry_path.read_text())["goals"]: + import_fixture_authority(registry_path, record["id"], provider="sqlite") return registry_path, runtime, project diff --git a/examples/project/project-agent-adoption-smoke.py b/examples/project/project-agent-adoption-smoke.py index 0ab64edc18..f088d467c3 100644 --- a/examples/project/project-agent-adoption-smoke.py +++ b/examples/project/project-agent-adoption-smoke.py @@ -144,6 +144,25 @@ def assert_adoption(provider: str) -> None: registry_path = write_planned_fixture(root) project = root / "project" + add_gate = ( + "todo", "add", "--goal-id", GOAL_ID, "--role", "user", + "--task-class", "user_gate", "--global-gate", "--text", USER_TODO, + ) + state = project / f".codex/goals/{GOAL_ID}/ACTIVE_GOAL_STATE.md" + before_state, before_registry = state.read_bytes(), registry_path.read_bytes() + refused = run_cli(root, registry_path, *add_gate, check=False) + assert refused["ok"] is False, refused + assert refused["error_code"] == "canonical_authority_required", refused + assert state.read_bytes() == before_state + assert registry_path.read_bytes() == before_registry + import_fixture_authority(registry_path, GOAL_ID, provider=provider) + imported = run_cli(root, registry_path, "todo", "list", "--goal-id", GOAL_ID) + assert imported["authority_read"]["source_authority"] == f"{provider}_v0", imported + assert imported["authority_read"]["legacy_fallback_used"] is False, imported + assert len(imported["todos"]) == 1, imported + original = imported["todos"][0] + assert original["text"] == AGENT_TODO and original["status"] == "open", original + missing_context_quota = quota_should_run( root, registry_path, @@ -182,24 +201,6 @@ def assert_adoption(provider: str) -> None: assert first_quota["agent_todo_summary"]["open_count"] == 1, first_quota assert first_quota["selected_todo"]["text"] == AGENT_TODO, first_quota - add_gate = ( - "todo", "add", "--goal-id", GOAL_ID, "--role", "user", - "--task-class", "user_gate", "--global-gate", "--text", USER_TODO, - ) - state = project / f".codex/goals/{GOAL_ID}/ACTIVE_GOAL_STATE.md" - before_state, before_registry = state.read_bytes(), registry_path.read_bytes() - refused = run_cli(root, registry_path, *add_gate, check=False) - assert refused["ok"] is False, refused - assert refused["error_code"] == "canonical_authority_required", refused - assert state.read_bytes() == before_state - assert registry_path.read_bytes() == before_registry - import_fixture_authority(registry_path, GOAL_ID, provider=provider) - imported = run_cli(root, registry_path, "todo", "list", "--goal-id", GOAL_ID) - assert imported["authority_read"]["source_authority"] == f"{provider}_v0", imported - assert imported["authority_read"]["legacy_fallback_used"] is False, imported - assert len(imported["todos"]) == 1, imported - original = imported["todos"][0] - assert original["text"] == AGENT_TODO and original["status"] == "open", original todo_payload = run_cli(root, registry_path, *add_gate) assert todo_payload["ok"] is True, todo_payload assert todo_payload["added"] is True, todo_payload diff --git a/examples/project/project-asset-todo-projection-gap-smoke.py b/examples/project/project-asset-todo-projection-gap-smoke.py index 03d2396ef3..13e28687a8 100644 --- a/examples/project/project-asset-todo-projection-gap-smoke.py +++ b/examples/project/project-asset-todo-projection-gap-smoke.py @@ -70,6 +70,10 @@ def write_fixture(root: Path) -> tuple[Path, Path]: + "\n", encoding="utf-8", ) + from loopx.control_plane.testing.canary_harness import import_fixture_authority + + for record in json.loads(registry_path.read_text())["goals"]: + import_fixture_authority(registry_path, record["id"], provider="sqlite") return registry_path, runtime diff --git a/examples/project/subagent-status-projection-smoke.py b/examples/project/subagent-status-projection-smoke.py index 94e7c72800..0a34a87b0a 100644 --- a/examples/project/subagent-status-projection-smoke.py +++ b/examples/project/subagent-status-projection-smoke.py @@ -130,6 +130,10 @@ def write_fixture(root: Path) -> tuple[Path, Path]: with (run_dir / "index.jsonl").open("w", encoding="utf-8") as f: for run in runs: f.write(json.dumps(run, ensure_ascii=False, sort_keys=True) + "\n") + from loopx.control_plane.testing.canary_harness import import_fixture_authority + + for record in json.loads(registry_path.read_text())["goals"]: + import_fixture_authority(registry_path, record["id"], provider="sqlite") return registry_path, runtime diff --git a/examples/serve-status-global-registry-smoke.py b/examples/serve-status-global-registry-smoke.py index 8ba098cdf9..afe65c1c1c 100644 --- a/examples/serve-status-global-registry-smoke.py +++ b/examples/serve-status-global-registry-smoke.py @@ -68,6 +68,10 @@ def write_project_registry(project: Path, runtime: Path, goal_id: str, title: st + "\n", encoding="utf-8", ) + from loopx.control_plane.testing.canary_harness import import_fixture_authority + + for record in json.loads(registry_path.read_text())["goals"]: + import_fixture_authority(registry_path, record["id"], provider="sqlite") return registry_path diff --git a/examples/subcommand-format-smoke.py b/examples/subcommand-format-smoke.py index 01cc1a4216..20d53050d4 100644 --- a/examples/subcommand-format-smoke.py +++ b/examples/subcommand-format-smoke.py @@ -67,6 +67,10 @@ def write_fixture(root: Path) -> Path: + "\n", encoding="utf-8", ) + from loopx.control_plane.testing.canary_harness import import_fixture_authority + + for record in json.loads(registry_path.read_text())["goals"]: + import_fixture_authority(registry_path, record["id"], provider="sqlite") return registry_path From d1876d5d09fdf0d2576a8d79785e6a4db300a14e Mon Sep 17 00:00:00 2001 From: LoopX Agent <337587101+loopx-agent@users.noreply.github.com> Date: Tue, 27 Oct 2026 18:26:33 +0800 Subject: [PATCH 15/29] test: distinguish migration refusals from canonical empty projections Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com> --- .../goal-channel-status-export-smoke.py | 1 + .../goal-vision-refresh-state-budget-smoke.py | 13 +++++++----- ...project-asset-todo-projection-gap-smoke.py | 20 ++++++++++--------- .../serve-status-global-registry-smoke.py | 2 +- 4 files changed, 21 insertions(+), 15 deletions(-) diff --git a/examples/project/goal-channel-status-export-smoke.py b/examples/project/goal-channel-status-export-smoke.py index b2b78d6708..1acf316835 100644 --- a/examples/project/goal-channel-status-export-smoke.py +++ b/examples/project/goal-channel-status-export-smoke.py @@ -60,6 +60,7 @@ def write_registry(project: Path, runtime: Path) -> Path: "repo": str(project), "state_file": write_state(project), "adapter": {"kind": "smoke_v0", "status": "connected"}, + "coordination": {"registered_agents": ["codex-side-bypass"]}, "authority_sources": [], } ], diff --git a/examples/project/goal-vision-refresh-state-budget-smoke.py b/examples/project/goal-vision-refresh-state-budget-smoke.py index 7867208d73..854fd688dc 100644 --- a/examples/project/goal-vision-refresh-state-budget-smoke.py +++ b/examples/project/goal-vision-refresh-state-budget-smoke.py @@ -77,10 +77,6 @@ def write_fixture(root: Path) -> tuple[Path, Path, Path]: + "\n", encoding="utf-8", ) - from loopx.control_plane.testing.canary_harness import import_fixture_authority - - for record in json.loads(registry_path.read_text())["goals"]: - import_fixture_authority(registry_path, record["id"], provider="sqlite") return registry_path, runtime, project @@ -215,7 +211,14 @@ def assert_vision_budget(provider: str) -> None: else: raise AssertionError("unmigrated fixture must not admit a normal Todo write") assert state_path.read_bytes() == source_before - assert read_canonical_todos_if_promoted(runtime_root=runtime, goal_id=GOAL_ID) is None + try: + read_canonical_todos_if_promoted(runtime_root=runtime, goal_id=GOAL_ID) + except LocalCoordinationAuthorityUnavailable as error: + assert error.code == "canonical_authority_required" + assert error.payload["write_admitted"] is False + assert error.payload["legacy_fallback_used"] is False + else: + raise AssertionError("an unmigrated read must refuse without Markdown fallback") import_fixture_authority(registry_path, GOAL_ID, provider=provider) original = read_canonical_todos_if_promoted(runtime_root=runtime, goal_id=GOAL_ID) assert original["source_authority"] == provider + "_v0" diff --git a/examples/project/project-asset-todo-projection-gap-smoke.py b/examples/project/project-asset-todo-projection-gap-smoke.py index 13e28687a8..9035102bc0 100644 --- a/examples/project/project-asset-todo-projection-gap-smoke.py +++ b/examples/project/project-asset-todo-projection-gap-smoke.py @@ -150,6 +150,7 @@ def main() -> int: assert incomplete["ok"] is False, incomplete assert any("missing required Todo section(s): Agent Todo" in error for error in incomplete["contract_errors"]), incomplete + before = run_cli(registry_path, runtime, "todo", "list", "--goal-id", GOAL_ID) state = registry_path.parent.parent / f".codex/goals/{GOAL_ID}/ACTIVE_GOAL_STATE.md" state.write_text(state.read_text(encoding="utf-8") + "\n## Agent Todo\n", encoding="utf-8") @@ -157,16 +158,17 @@ def main() -> int: assert payload["ok"] is True, payload item = attention_item(payload) # type: ignore[arg-type] project_asset = item["project_asset"] - projected_gap = project_asset["todo_projection_gap"] - assert projected_gap["kind"] == "project_asset_todo_projection_gap", projected_gap - assert projected_gap["missing_roles"] == ["user"], projected_gap - assert "user_todos" not in project_asset, project_asset - assert project_asset["agent_todos"]["open"] == 0, project_asset - assert item["todo_projection_gap"]["missing_roles"] == ["user"], item - + # Canonical empty roles are available facts even when the old display + # omitted a section. The pure gap cases above still cover missing data. + assert "todo_projection_gap" not in project_asset + assert "todo_projection_gap" not in item + assert project_asset["user_todos"]["open"] == 0 + assert project_asset["agent_todos"]["open"] == 0 + after = run_cli(registry_path, runtime, "todo", "list", "--goal-id", GOAL_ID) + assert after["todos"] == before["todos"] == [] + assert after["authority_read"] == before["authority_read"] markdown = run_cli(registry_path, runtime, "status", output_format="markdown") - assert "todo_projection_gap" in markdown, markdown - assert "missing_roles=user" in markdown, markdown + assert "todo_projection_gap" not in markdown, markdown print("project-asset-todo-projection-gap-smoke ok") return 0 diff --git a/examples/serve-status-global-registry-smoke.py b/examples/serve-status-global-registry-smoke.py index afe65c1c1c..0aed384a83 100644 --- a/examples/serve-status-global-registry-smoke.py +++ b/examples/serve-status-global-registry-smoke.py @@ -94,7 +94,7 @@ def main() -> None: runtime = root / "runtime" local_project = root / "local-project" global_project = root / "global-project" - local_registry = write_project_registry(local_project, runtime, "local-only-goal", "Local Only Goal") + local_registry = write_project_registry(local_project, root / "local-runtime", "local-only-goal", "Local Only Goal") global_source_registry = write_project_registry(global_project, runtime, "global-goal", "Global Goal") global_registry = runtime / "registry.global.json" From e9f9f4efebf392f7fbdef937c80456b4fea338cc Mon Sep 17 00:00:00 2001 From: LoopX Agent <337587101+loopx-agent@users.noreply.github.com> Date: Tue, 27 Oct 2026 18:32:37 +0800 Subject: [PATCH 16/29] test: keep a stale display separate from canonical projection availability Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com> --- .../project/project-asset-todo-projection-gap-smoke.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/examples/project/project-asset-todo-projection-gap-smoke.py b/examples/project/project-asset-todo-projection-gap-smoke.py index 9035102bc0..c8f9d052ee 100644 --- a/examples/project/project-asset-todo-projection-gap-smoke.py +++ b/examples/project/project-asset-todo-projection-gap-smoke.py @@ -70,10 +70,12 @@ def write_fixture(root: Path) -> tuple[Path, Path]: + "\n", encoding="utf-8", ) + original_display = state_path.read_bytes() from loopx.control_plane.testing.canary_harness import import_fixture_authority for record in json.loads(registry_path.read_text())["goals"]: import_fixture_authority(registry_path, record["id"], provider="sqlite") + state_path.write_bytes(original_display) return registry_path, runtime @@ -147,9 +149,10 @@ def main() -> int: with tempfile.TemporaryDirectory(prefix="loopx-project-asset-todo-gap-") as raw_tmp: registry_path, runtime = write_fixture(Path(raw_tmp)) incomplete = run_cli(registry_path, runtime, "status", check=False) - assert incomplete["ok"] is False, incomplete - assert any("missing required Todo section(s): Agent Todo" in error - for error in incomplete["contract_errors"]), incomplete + assert incomplete["ok"] is True, incomplete + assert incomplete["contract_errors"] == [], incomplete + assert any("state_projection_gap" in warning + for warning in incomplete["contract_warnings"]), incomplete before = run_cli(registry_path, runtime, "todo", "list", "--goal-id", GOAL_ID) state = registry_path.parent.parent / f".codex/goals/{GOAL_ID}/ACTIVE_GOAL_STATE.md" state.write_text(state.read_text(encoding="utf-8") + "\n## Agent Todo\n", From 6f6409773e7048b6c016b50ea2389f6db98c3432 Mon Sep 17 00:00:00 2001 From: LoopX Agent <337587101+loopx-agent@users.noreply.github.com> Date: Tue, 27 Oct 2026 18:37:45 +0800 Subject: [PATCH 17/29] docs: reconcile machine settings discovery with shipped defaults Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com> --- docs/concepts/interaction-pattern-catalog.md | 15 ++++++++++++--- .../public_entry/readme-demo-surface-smoke.py | 4 ++-- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/docs/concepts/interaction-pattern-catalog.md b/docs/concepts/interaction-pattern-catalog.md index 43a0f3a8bc..944581b480 100644 --- a/docs/concepts/interaction-pattern-catalog.md +++ b/docs/concepts/interaction-pattern-catalog.md @@ -1211,13 +1211,14 @@ main blocker or keeps following a stale local-only benchmark staging todo. **Trigger** - a typed machine-configuration namespace is about to change; the built-in - namespaces are `change_quality_qualification`, `codex_chat`, `goal_storage`, - `manager_runtime`, `periodic_report`, `pull_request_review`, + namespaces are `change_quality_qualification`, `codex_chat`, `context_delivery`, + `explore_harness`, `goal_storage`, `manager_runtime`, `periodic_report`, `pull_request_review`, `steward_executor`, and `todo_replan_cadence`. The public catalog returned by `loopx machine-config describe` is authoritative, so this inventory has to stay complete rather than approximate; - `goal_storage` carries the storage target a newly created Goal is fixed to - (`new_goal_provider`, `file` by default or `sqlite` after reviewed promotion). + (`new_goal_provider`, canonical `sqlite` with hard leases by default; explicit + `file` and soft-claim creation choices remain available). It does not promote existing Goals or migrate their data, and existing Goals keep the selection they were created with; see `docs/reference/local-authority-provider-selection.md`; @@ -1227,6 +1228,14 @@ main blocker or keeps following a stale local-only benchmark staging todo. attached Agent, or a LoopX Agent Loop, and it grants no permissions and stores no credentials; see `docs/integrations/session-runtime-control-plane-adapter.md#projection-boundary`; +- `context_delivery` controls differential native Codex context (`off` by default). + A saved preference neither proves host readiness nor actual delta use; known + context loss keeps full context and unsupported declarations refuse. It grants + no execution authority; see `docs/reference/required-work-context.md#machine-default`; +- `explore_harness` sets the default exploration mode (`off` by default) for new + and existing Goals; explicit Goal modes take precedence. Planning supplies + evidence and read-only guidance, while execution authority stays separate; + see `loopx/capabilities/explore/README.md#machine-default`; - `pull_request_review` carries `review_order` (`forward` by default, or `reverse`) and Goal-owned `agent_orders` for registered Agent overrides. Commands resolve explicit direction, Agent, Goal, then machine; reverse inverts diff --git a/examples/public_entry/readme-demo-surface-smoke.py b/examples/public_entry/readme-demo-surface-smoke.py index 3127f068c1..5211e37993 100644 --- a/examples/public_entry/readme-demo-surface-smoke.py +++ b/examples/public_entry/readme-demo-surface-smoke.py @@ -30,8 +30,8 @@ def main() -> int: compact_demo = compact(demo) for required in [ '