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
9 changes: 8 additions & 1 deletion .github/workflows/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,14 @@ def read_jsonrpc(proc: subprocess.Popen, timeout: float) -> dict | None:
if not line:
return None

return json.loads(line)
try:
return json.loads(line)
except json.JSONDecodeError:
raise ValueError(
f"ACP spec violation: agent wrote non-JSON to stdout: {line.rstrip()!r}\n"
f"Per the ACP spec, agents MUST NOT write anything to stdout that is not a valid ACP message. "
f"Diagnostic output should go to stderr."
)


def run_auth_check(
Expand Down
33 changes: 31 additions & 2 deletions .github/workflows/update_versions.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,27 @@ def extract_pypi_package_name(package_spec: str) -> str:
return re.split(r"[<>=!@]", package_spec)[0]


def load_quarantine(registry_dir: Path) -> dict[str, str]:
"""Load quarantine list from registry directory.

Returns:
Dict mapping agent_id to quarantine reason.
"""
quarantine_path = registry_dir / "quarantine.json"
if not quarantine_path.exists():
return {}
try:
with open(quarantine_path) as f:
return json.load(f)
except (json.JSONDecodeError, OSError) as e:
print(f"Warning: Could not read {quarantine_path}: {e}", file=sys.stderr)
return {}


def find_all_agents(registry_dir: Path) -> list[tuple[Path, dict]]:
"""Find all agent.json files in the registry."""
"""Find all agent.json files in the registry, excluding quarantined ones."""
agents = []
quarantine = load_quarantine(registry_dir)

for scan_dir in AGENT_DIRS:
base_path = registry_dir / scan_dir if scan_dir != "." else registry_dir
Expand All @@ -182,9 +200,20 @@ def find_all_agents(registry_dir: Path) -> list[tuple[Path, dict]]:
try:
with open(agent_json) as f:
agent_data = json.load(f)
agents.append((agent_json, agent_data))
except (json.JSONDecodeError, OSError) as e:
print(f"Warning: Could not read {agent_json}: {e}", file=sys.stderr)
continue

agent_id = agent_data.get("id", entry_dir.name)
if agent_id in quarantine:
print(f" ⊘ Quarantined {agent_id}: {quarantine[agent_id]}")
continue

agents.append((agent_json, agent_data))

if quarantine:
print(f" ({len(quarantine)} agent(s) quarantined)")
print()

return agents

Expand Down
39 changes: 35 additions & 4 deletions .github/workflows/verify_agents.py
Original file line number Diff line number Diff line change
Expand Up @@ -550,10 +550,28 @@ def verify_agent(
return results


def load_quarantine(registry_dir: Path) -> dict[str, str]:
"""Load quarantine list from registry directory.

Returns:
Dict mapping agent_id to quarantine reason.
"""
quarantine_path = registry_dir / "quarantine.json"
if not quarantine_path.exists():
return {}
try:
with open(quarantine_path) as f:
return json.load(f)
except (json.JSONDecodeError, OSError) as e:
print(f"Warning: Could not read {quarantine_path}: {e}")
return {}


def load_registry(registry_dir: Path) -> list[dict]:
"""Load all agents from registry directory."""
"""Load all agents from registry directory, excluding quarantined ones."""
agents = []
skip_dirs = {".claude", ".git", ".github", ".idea", "__pycache__", "dist", "_not_yet_unsupported"}
quarantine = load_quarantine(registry_dir)

for agent_dir in sorted(registry_dir.iterdir()):
if not agent_dir.is_dir() or agent_dir.name in skip_dirs:
Expand All @@ -565,9 +583,21 @@ def load_registry(registry_dir: Path) -> list[dict]:

try:
with open(agent_json) as f:
agents.append(json.load(f))
agent = json.load(f)
except json.JSONDecodeError as e:
print(f"Warning: Invalid JSON in {agent_json}: {e}")
continue

agent_id = agent.get("id", agent_dir.name)
if agent_id in quarantine:
print(f" ⊘ Quarantined {agent_id}: {quarantine[agent_id]}")
continue

agents.append(agent)

if quarantine:
print(f" ({len(quarantine)} agent(s) quarantined)")
print()

return agents

Expand Down Expand Up @@ -640,12 +670,13 @@ def main():
print()

# Filter if specific agents requested (comma-separated)
quarantine = load_quarantine(registry_dir)
if args.agent:
requested_ids = [a.strip() for a in args.agent.split(",")]
all_agent_ids = [a["id"] for a in agents]

# Check for invalid agent IDs
invalid = [aid for aid in requested_ids if aid not in all_agent_ids]
# Check for invalid agent IDs (quarantined agents are valid but skipped)
invalid = [aid for aid in requested_ids if aid not in all_agent_ids and aid not in quarantine]
if invalid:
print(f"Unknown agent(s): {', '.join(invalid)}")
print(f"Available: {', '.join(all_agent_ids)}")
Expand Down
3 changes: 3 additions & 0 deletions quarantine.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"opencode": "ACP spec violation: writes non-JSON to stdout (database migration logs) https://github.com/anomalyco/opencode/issues/13634"
}