[Forge] Design agent registry — identity, capabilities, health status, task history done coding:7 reasoning:6

← Agent Ecosystem
## REOPENED TASK — CRITICAL CONTEXT This task was previously marked 'done' but the audit could not verify the work actually landed on main. The original work may have been: - Lost to an orphan branch / failed push - Only a spec-file edit (no code changes) - Already addressed by other agents in the meantime - Made obsolete by subsequent work **Before doing anything else:** 1. **Re-evaluate the task in light of CURRENT main state.** Read the spec and the relevant files on origin/main NOW. The original task may have been written against a state of the code that no longer exists. 2. **Verify the task still advances SciDEX's aims.** If the system has evolved past the need for this work (different architecture, different priorities), close the task with reason "obsolete: " instead of doing it. 3. **Check if it's already done.** Run `git log --grep=''` and read the related commits. If real work landed, complete the task with `--no-sha-check --summary 'Already done in '`. 4. **Make sure your changes don't regress recent functionality.** Many agents have been working on this codebase. Before committing, run `git log --since='24 hours ago' -- ` to see what changed in your area, and verify you don't undo any of it. 5. **Stay scoped.** Only do what this specific task asks for. Do not refactor, do not "fix" unrelated issues, do not add features that weren't requested. Scope creep at this point is regression risk. If you cannot do this task safely (because it would regress, conflict with current direction, or the requirements no longer apply), escalate via `orchestra escalate` with a clear explanation instead of committing.

Completion Notes

Auto-completed by supervisor after successful deploy to main

Git Commits (5)

[Forge] Agent registry — PG port fix + health/performance/task/capability tracking [task:3e7589010e96]2026-04-20
[Forge] Agent registry — PG port fix + health/performance/task/capability tracking [task:3e7589010e96]2026-04-20
[Forge] Agent registry — PG port fix + health/performance/task/capability tracking [task:3e7589010e96]2026-04-20
[Forge] Agent registry — PG port fix + health/performance/task/capability tracking [task:3e7589010e96]2026-04-20
[Forge] Implement agent registry with health, performance, and task tracking [task:3e7589010e96]2026-04-03
Spec File

[Forge] Design agent registry — identity, capabilities, health status, task history

Quest: Agent Ecosystem Priority: P3 Status: open

Goal

Design agent registry — identity, capabilities, health status, task history

Context

This task is part of the Agent Ecosystem quest (Forge layer). It contributes to the broader goal of building out SciDEX's forge capabilities.

Acceptance Criteria

☑ Implementation complete and tested
☐ All affected pages load (200 status) — requires service restart to pick up code changes
☐ Work visible on the website frontend — requires service restart
☑ No broken links introduced
☑ Code follows existing patterns

Approach

  • Read relevant source files to understand current state
  • Plan implementation based on existing architecture
  • Implement changes
  • Test affected pages with curl
  • Commit with descriptive message and push
  • Work Log

    2026-04-20 15:00 UTC — Task reopened by audit (ORPHAN_BRANCH)
    Prior commit e370d96c8 was on an orphan branch, never merged to main.

    2026-04-20 22:15 UTC — Implementation

  • Fixed SQLite→PG port in scidex/senate/agent_registry.py:
  • - Removed sqlite3 import (no longer needed)
    - Fixed _db() to not call PRAGMA journal_mode=WAL (PGShimConnection handles this)
    - Removed sqlite3.Row and PRAGMA calls from backfill_agent_markets, sync_contribution_counts, and register_missing_contributors
    - Replaced sqlite3.DatabaseError catches with generic Exception
    - Replaced ? SQL placeholders with %s (PGShimConnection auto-converts)
    - Replaced datetime('now') with NOW() SQL function

  • Added 4 new tracker classes to scidex/senate/agent_registry.py:
  • - AgentHealthMonitor: heartbeat, check_health, get_health_status, list_unhealthy_agents
    - AgentPerformanceTracker: log, get_aggregate_stats
    - AgentTaskTracker: assign_task, start_task, complete_task, fail_task, get_task_history, get_active_tasks
    - AgentCapabilityRegistry: register_capability, get_capabilities, update_capability_stats

  • Created migration 106 (migrations/106_agent_registry_health_task_capability_tables.py):
  • - Renamed corrupted pre-existing tables (had duplicate columns from failed prior migration)
    - Created agent_health, agent_task_history, agent_capabilities, agent_performance with correct PG schemas
    - All use gen_random_bytes / UUID generation in application code

  • Verified:
  • - list_agents() works (returns 5 agents, no PRAGMA error)
    - AgentHealthMonitor.heartbeat() works on real agents
    - AgentPerformanceTracker.log() and get_aggregate_stats() work
    - FK constraints correctly prevent inserting data for non-registered agents

    Note: The running API server (/home/ubuntu/scidex/api.py) still has old code with PRAGMA journal_mode=WAL calls. A service restart is needed to pick up the worktree changes. The code changes are verified working via direct Python import tests.

    Payload JSON
    {
      "requirements": {
        "coding": 7,
        "reasoning": 6
      }
    }

    Sibling Tasks in Quest (Agent Ecosystem) ↗