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
6 changes: 5 additions & 1 deletion loopx/todos.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,11 @@ def list_goal_todos(
if goal is None:
raise ValueError(f"goal {goal_id!r} is not present in the registry")

runtime_root = resolve_runtime_root(registry, runtime_root_arg)
runtime_root = resolve_runtime_root(
registry,
runtime_root_arg,
registry_path=registry_path,
)
rollout_events = load_rollout_events(
rollout_event_log_path(runtime_root, goal_id),
limit=MAX_TODO_INDEX_ROLLOUT_EVENTS_PER_GOAL,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import pytest

from canonical_authority_fixture import initialize_canonical_authority
from examples.control_plane.quota_plan_fixtures import write_cli_fixture
from loopx.capabilities.explore.result_log import (
append_explore_result_event,
Expand All @@ -17,6 +18,9 @@
from loopx.capabilities.issue_fix.explore_projection import (
project_issue_fix_explore_graph,
)
from loopx.control_plane.coordination.runtime_shadow import (
build_todo_runtime_shadow_projection,
)


REPO_ROOT = Path(__file__).resolve().parents[2]
Expand Down Expand Up @@ -117,6 +121,68 @@ def test_history_and_quota_anchor_relative_runtime_to_registry_project(
assert decision["decision"] == "run"


def test_todo_list_anchors_promoted_authority_to_registry_project(
tmp_path: Path,
) -> None:
registry_path, runtime_root, project = write_cli_fixture(tmp_path / "fixture")
target_runtime = _make_runtime_paths_project_relative(
registry_path=registry_path,
runtime_root=runtime_root,
project=project,
)
state_path = (
project / ".codex" / "goals" / "half-speed" / "ACTIVE_GOAL_STATE.md"
)
state_path.write_text(
"# half-speed\n\n"
"## Agent Todo\n\n"
"- [ ] Stale Markdown work\n"
" <!-- loopx:todo todo_id=todo_stale status=open -->\n",
encoding="utf-8",
)
projection = build_todo_runtime_shadow_projection(
goal_id="half-speed",
todos=[
{
"schema_version": "todo_item_v0",
"todo_id": "todo_canonical",
"index": 1,
"role": "agent",
"status": "open",
"done": False,
"text": "Canonical provider work",
"archive_state": "active",
"source_section": "Agent Todo",
}
],
)
initialize_canonical_authority(
target_runtime,
"half-speed",
projection,
state_path=state_path,
)
independent_worktree = tmp_path / "independent-worktree"
independent_worktree.mkdir()

payload = _run_cli(
"--format",
"json",
"--registry",
str(registry_path),
"todo",
"list",
"--goal-id",
"half-speed",
cwd=independent_worktree,
)

assert [todo["todo_id"] for todo in payload["todos"]] == ["todo_canonical"]
assert payload["authority_read"]["decision_read_from_provider"] is True
assert payload["authority_read"]["legacy_fallback_used"] is False
assert not (independent_worktree / ".loopx" / "runtime").exists()


def test_issue_fix_explore_projection_anchors_relative_runtime_to_registry_project(
tmp_path: Path,
monkeypatch: pytest.MonkeyPatch,
Expand Down
Loading