Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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 @@ -11,6 +11,7 @@
import sys
import tempfile
from pathlib import Path
from unittest.mock import patch

REPO_ROOT = Path(__file__).resolve().parents[2]
if str(REPO_ROOT) not in sys.path:
Expand Down Expand Up @@ -292,6 +293,8 @@ def main() -> int:
cli_bin="loopx",
host_surface="codex-cli-tui",
goal_text="build a deterministic onboarding path",
resolve_linked_worktree_alias=False,
runtime_root_arg=str(Path(tmp) / "runtime"),
)
assert payload["agent_type"] == "codex-cli", payload
activation = payload["host_loop_activation"]
Expand All @@ -313,7 +316,16 @@ def main() -> int:
assert "register-agent" in message, message
assert "explicit takeover" in message, message

with tempfile.TemporaryDirectory(prefix="loopx-agent-onboard-identity-") as tmp:
# Route the connected fixture's builders and CLI children through its legacy registry.
with (
tempfile.TemporaryDirectory(prefix="loopx-agent-onboard-identity-") as tmp,
patch.dict(os.environ, {"LOOPX_RUNTIME_ROOT": str(Path(tmp) / "home" / ".codex" / "loopx")}),
patch.multiple(
"loopx.paths",
DEFAULT_RUNTIME_ROOT=Path(tmp) / "home" / ".loopx",
LEGACY_RUNTIME_ROOT=Path(tmp) / "home" / ".codex" / "loopx",
),
):
root = Path(tmp)
project = root / "project"
home = root / "home"
Expand Down
24 changes: 13 additions & 11 deletions examples/control_plane/peer-agent-hard-cut-boundary-smoke.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
r"\bprimary_agent\b|\bprimary_review\b|\bside_agent\b|\bhandoff_agent\b|"
r"\bagent_profile_v0\b|\bprimary_checkout\b|"
r"\bprimary agent\b|\bside agent\b|\bside-agent\b|\bmain controller\b|"
r"controller/sub-agent|controller-subagent|controller owns|"
r"controller/sub-agent|controller-subagent|"
r'"role"\s*:\s*"(?:controller|subagent)"',
re.IGNORECASE,
)
Expand All @@ -52,14 +52,6 @@ def hierarchy_scan_line(path: Path, line: str) -> str:
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")
# Benchmark recovery assigns retries to the experiment provider or controller.
if (path == REPO_ROOT / "loopx/capabilities/benchmark_toolkit/README.md"
and line.strip() == "grading alive until it drains. The provider/controller owns bounded retry after"):
return line.replace("provider/controller owns", "benchmark provider or controller handles")
return line


Expand All @@ -83,10 +75,20 @@ def main() -> int:
"handoff_agent",
"agent_profile_v0",
"primary_checkout",
"controller owns",
"main controller",
"controller/sub-agent",
"controller-subagent",
'"role": "controller"',
'"role": "subagent"',
):
assert LEGACY_PATTERN.search(token), token
for domain_term in ("primary_reviewers", "primary_review_score"):
# Owning a domain resource does not describe an Agent hierarchy.
for domain_term in (
"primary_reviewers",
"primary_review_score",
"The benchmark controller owns the worker lock.",
"One controller owns control dialogue.",
):
assert not LEGACY_PATTERN.search(domain_term), domain_term

decoder = REPO_ROOT / "loopx/control_plane/todos/read_codec.ts"
Expand Down
2 changes: 2 additions & 0 deletions examples/control_plane/peer-agent-migration-smoke.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,13 +312,15 @@ def main() -> int:

heartbeat = build_heartbeat_prompt(
goal_id=GOAL_ID,
registry_path=fresh_registry,
thin=True,
agent_id=AGENTS[0],
agent_scopes=["peer task claims and leases"],
registered_agents=AGENTS,
)
assert heartbeat["agent_model"] == "peer_v1", heartbeat
assert heartbeat["agent_role"] == "peer-agent", heartbeat
assert str(fresh_registry) in heartbeat["task_body"], heartbeat
assert "primary_agent" not in heartbeat, heartbeat
assert "side_agent_handoff_agent" not in heartbeat, heartbeat
assert "single primary" not in heartbeat["task_body"].lower(), heartbeat
Expand Down
Loading