Skip to content

Migrate webhook to unified review endpoint #84

Description

@sylvansys

Context

The Constellos MCP server now exposes a new POST /api/review/unified endpoint that replaces the need for the webhook to fetch .constellos/agents/code-quality.md from repos and send it as a prompt. The server handles everything: artifact type detection, review skill routing, constraint/decision context injection, and structured findings storage.

New Endpoint

POST mcp.constellos.ai/api/review/unified

Request

{
  "diff": "...",
  "changed_files": ["src/foo.ts", "supabase/migrations/001.sql"],
  "space": "constellos",
  "repo": "constellos/constellos",
  "pr_number": 123,
  "artifact_types": ["code", "database"],  // optional — auto-detected from changed_files
  "model": "deepseek/deepseek-reasoner"     // optional
}

Auth: X-Constellos-Secret header (same as existing endpoint).

Response

{
  "run_id": "uuid",
  "overall_passed": true,
  "phases": [
    {
      "phase": 5,
      "phase_name": "context_alignment",
      "status": "passed",
      "findings_count": 3,
      "started_at": "...",
      "completed_at": "..."
    }
  ],
  "findings": [
    {
      "id": "uuid",
      "skill_slug": "review-code-artifacts",
      "artifact_type": "code",
      "severity": "medium",
      "category": "quality",
      "source": "agent",
      "file_path": "src/foo.ts",
      "line_number": 42,
      "finding": "Description of the issue",
      "constraint_id": null,
      "decision_id": "uuid-of-violated-decision",
      "status": "open"
    }
  ],
  "skills_run": ["review-code-artifacts", "review-database-artifacts"],
  "constraint_findings": [...],
  "decision_findings": [...]
}

Migration Steps

  1. Replace prompt fetching — No more fetching .constellos/agents/code-quality.md from repos. Send { diff, changed_files, space } and the server handles skill routing.

  2. Format multi-agent comment — Group findings[] by skill_slug to create sections (e.g. "Code Review", "Database Review"). Each finding has severity, category, file_path, line_number for rich formatting.

  3. Use run_id — Include in the PR comment for traceability back to the Constellos review run.

  4. Backward compat — The existing POST /api/review endpoint still works unchanged. Migrate at your pace.

Key Improvements

  • Multi-skill review: Automatically routes to appropriate review skills based on changed file types (.ts → code, .sql → database, .tsx → code+ui, etc.)
  • Graph-aware: Queries governance constraints and decisions from the knowledge graph as review context
  • Two-pass model: Pass 1 checks constraint compliance, Pass 2 verifies decision materialization
  • Structured findings: Each finding has severity, category, file/line attribution, and constraint/decision traceability
  • Persistent storage: All review runs, phases, and findings stored in review_runs/review_phases/review_findings tables

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions