diff --git a/examples/control_plane/quota_plan_fixtures.py b/examples/control_plane/quota_plan_fixtures.py index 1dd0d4d857..25e0487a22 100644 --- a/examples/control_plane/quota_plan_fixtures.py +++ b/examples/control_plane/quota_plan_fixtures.py @@ -321,7 +321,7 @@ def write_codex_heartbeat_fixture(root: Path, *, goal_id: str, agent_id: str, rr path.write_text("\n".join(f"{key} = {json.dumps(value)}" for key, value in fields.items()) + "\n", encoding="utf-8") -def write_cli_fixture(root: Path, *, scoped_agents: bool = False) -> tuple[Path, Path, Path]: +def write_cli_fixture(root: Path, *, scoped_agents: bool = False, provider: str = "sqlite") -> tuple[Path, Path, Path]: project = root / "project" runtime = root / "runtime" registry_path = project / ".loopx" / "registry.json" @@ -444,7 +444,7 @@ def write_cli_fixture(root: Path, *, scoped_agents: bool = False) -> tuple[Path, for record in registry_goals: initialize_canonical_authority(runtime, record["id"], build_todo_runtime_shadow_projection(goal_id=record["id"], todos=[], handoff_mode="soft_claim"), - state_path=project / record["state_file"], provider="sqlite") + state_path=project / record["state_file"], provider=provider) return registry_path, runtime, project diff --git a/tests/test_scheduler_native_launcher.py b/tests/test_scheduler_native_launcher.py index c2779751b3..cd479e205d 100644 --- a/tests/test_scheduler_native_launcher.py +++ b/tests/test_scheduler_native_launcher.py @@ -15,13 +15,7 @@ write_codex_heartbeat_fixture, ) from loopx.control_plane.testing.canary_harness import run_json_cli_result -from loopx.control_plane.coordination.runtime_shadow import build_todo_runtime_shadow_projection -from loopx.control_plane.coordination.coordination_state_contract import ( - TODO_DOMAIN_READ_RECORD_SCHEMA_VERSION, - TODO_DOMAIN_RECORD_FIELDS, -) from tests.control_plane.canonical_authority_fixture import ( - initialize_canonical_authority, isolate_sqlite_runtime, ) @@ -272,18 +266,10 @@ def test_launcher_binds_ack_to_current_host_readback( tmp_path: Path, monkeypatch, provider: str, host: str, launcher: str, ) -> None: isolate_sqlite_runtime(tmp_path, monkeypatch) - registry, runtime, project = write_cli_fixture(tmp_path / "fixture", scoped_agents=True) + # Select the provider at creation, never reinitialize the authority already + # created by write_cli_fixture under the same operation id. + registry, runtime, project = write_cli_fixture(tmp_path / "fixture", scoped_agents=True, provider=provider) goal = "needs-operator" - state = project / f".codex/goals/{goal}/ACTIVE_GOAL_STATE.md" - projection = build_todo_runtime_shadow_projection( - goal_id=goal, todos=[], handoff_mode="soft_claim", - ) - projection["todo_read_model"] = { - **projection["todo_read_model"], - "schema_version": TODO_DOMAIN_READ_RECORD_SCHEMA_VERSION, - "contract_fields": list(TODO_DOMAIN_RECORD_FIELDS), - } - initialize_canonical_authority(runtime, goal, projection, state_path=state, provider=provider) codex_home = tmp_path / "codex-home" monkeypatch.setenv("CODEX_HOME", str(codex_home)) monkeypatch.setenv("CODEX_THREAD_ID", "scheduler-fixture")