Skip to content
Merged
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
48 changes: 48 additions & 0 deletions pmoves/scripts/validate_agent_registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,54 @@ def main(argv: list[str]) -> int:
f"room {manifest.name}: owner agent_id {owner!r} resolves to neither "
f"a registry agent ({kebab_to_snake(owner)!r}) nor an external contributor")

# --- Registry rooms: -> catalog (advisory) ------------------------------
# The mirror of the check above. That one asks "does this room's owner exist";
# this asks "do the rooms an agent claims exist". Nothing enforced it, and a
# fabricated name shipped: PR #2612 bound pmoves_minimax_mcp to
# "minimax-mcp.room.model", which is in no catalog and no manifest. The
# binding resolved to nothing and the agent could not be discovered through
# the room plane at all.
#
# Advisory, like the owner check. `rooms:` has no schema and its semantics are
# not settled -- see the note in ROOM_MANIFEST_CONTRACT.md -- so this asserts
# only the part that is unambiguous: a named room must exist.
catalog_path = ROOMS_DIR / "catalog.json"
known_rooms: set = set()
if catalog_path.is_file():
try:
cat = json.loads(catalog_path.read_text(encoding="utf-8"))
entries = cat.get("rooms", cat) if isinstance(cat, dict) else cat
if isinstance(entries, list):
for r in entries:
if isinstance(r, dict):
rid = r.get("room_id") or r.get("id") or r.get("name")
if rid:
known_rooms.add(rid)
elif isinstance(entries, dict):
known_rooms.update(entries.keys())
except Exception as exc: # noqa: BLE001
warnings.append(f"rooms catalog unreadable ({exc})")
# A manifest on disk counts too: catalog and manifests can lag each other.
for manifest in ROOMS_DIR.glob("*.json"):
if manifest.name != "catalog.json":
known_rooms.add(manifest.name[: -len(".json")])
Comment on lines +197 to +199

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Resolve manifest room IDs instead of filename stems

When a manifest filename differs from its embedded room_id, this adds a nonexistent alias to known_rooms. For example, demo.room.json declares demo.room.rehearsal, so a broken registry claim for demo.room passes silently; sidecars such as demo.room.extras.json similarly make demo.room.extras appear valid even though the canonical manifest validator excludes *.extras.json. Because P7 resolves rooms by catalog/manifest room_id, these claims remain undiscoverable—the exact defect this check is intended to catch. Parse the manifest's room_id and exclude sidecars rather than using the filename stem.

AGENTS.md reference: AGENTS.md:L7-L7

Useful? React with 👍 / 👎.


if known_rooms:
# `rooms:` lives under BOTH agents: and mcp_servers: -- today every
# occurrence is under mcp_servers:, which is why an earlier draft of this
# check scanned agents: only and caught nothing when the fabricated name
# was reinjected. Scan both so the check cannot go quiet if the field
# moves or spreads.
for section in ("agents", "mcp_servers"):
for entry_key, spec in sorted((reg_raw.get(section) or {}).items()):
if not isinstance(spec, dict):
continue
for room in spec.get("rooms") or []:
if room not in known_rooms:
warnings.append(
f"{section}[{entry_key}]: rooms entry {room!r} is in neither "
f"pmoves/config/rooms/catalog.json nor a room manifest")

# --- Report ------------------------------------------------------------
print(f"registry agents: {len(registry_keys)} | team agents: {len(teamed)} "
f"| external contributors: {len(external)}")
Expand Down
Loading