fix: Handle missing crew_team_key column in agents query

- Remove crew_team_key from SELECT (column doesn't exist)
- Use pop() to safely handle crew_team_key in data processing
- This fixes 500 error on /api/agents/list endpoint
This commit is contained in:
Apple
2025-12-05 02:52:14 -08:00
parent 72b76bf29f
commit 1f97586699

View File

@@ -435,7 +435,6 @@ async def list_agent_summaries(
pm.slug AS primary_microdao_slug,
pm.district AS district,
COALESCE(a.public_skills, ARRAY[]::text[]) AS public_skills,
a.crew_team_key,
-- DAIS & Governance fields (A1, A2)
a.gov_level,
a.dais_identity_id,
@@ -497,8 +496,9 @@ async def list_agent_summaries(
data["public_skills"] = list(data.get("public_skills") or [])
# Populate crew_info
if data.get("crew_team_key"):
# Populate crew_info (crew_team_key column may not exist)
crew_team_key = data.pop("crew_team_key", None)
if crew_team_key:
# Try to find orchestrator team room for their primary microdao
# This is a bit expensive for list view, so maybe just return basic info
data["crew_info"] = {