feat: coord API — no-auth, DB softfail 503, agent tracking protocol

- coord routers: removed JWT auth requirement (internal-only endpoints)
- error_handler: SQLAlchemy OperationalError/DisconnectionError → 503
  with Retry-After: 30 header instead of 500
- /health: live DB probe (SELECT 1) instead of static response
- CLAUDE.md: "Live State Tracking" section with full agent protocol
  for all projects — session start, lock claim/release, component
  state updates, softfail + local queue catch-up
- COORDINATION_PROTOCOL.md: softfail/catch-up section + server-side
  503 behavior documented

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-12 08:45:33 -07:00
parent 9855c6bb0a
commit 73573800b0
10 changed files with 70 additions and 48 deletions

View File

@@ -6,7 +6,6 @@ from fastapi import APIRouter, Depends, Query, status
from sqlalchemy.orm import Session
from api.database import get_db
from api.middleware.auth import get_current_user
from api.schemas.coord_workflow import CoordWorkflowCreate, CoordWorkflowResponse, CoordWorkflowUpdate
from api.schemas.coord_work_item import CoordWorkItemResponse
from api.services import coord_workflow_service, coord_work_item_service
@@ -21,7 +20,6 @@ def list_workflows(
skip: int = Query(default=0, ge=0),
limit: int = Query(default=100, ge=1, le=1000),
db: Session = Depends(get_db),
current_user: dict = Depends(get_current_user),
):
"""List workflows with optional filters."""
workflows, total = coord_workflow_service.get_workflows(
@@ -39,7 +37,6 @@ def list_workflows(
def create_workflow(
data: CoordWorkflowCreate,
db: Session = Depends(get_db),
current_user: dict = Depends(get_current_user),
):
"""Create a new coordination workflow."""
workflow = coord_workflow_service.create_workflow(db, data)
@@ -50,7 +47,6 @@ def create_workflow(
def get_workflow(
workflow_id: UUID,
db: Session = Depends(get_db),
current_user: dict = Depends(get_current_user),
):
"""Get a workflow by ID including its work items."""
workflow = coord_workflow_service.get_workflow_by_id(db, workflow_id)
@@ -66,7 +62,6 @@ def update_workflow(
workflow_id: UUID,
data: CoordWorkflowUpdate,
db: Session = Depends(get_db),
current_user: dict = Depends(get_current_user),
):
"""Update a workflow."""
workflow = coord_workflow_service.update_workflow(db, workflow_id, data)
@@ -77,7 +72,6 @@ def update_workflow(
def delete_workflow(
workflow_id: UUID,
db: Session = Depends(get_db),
current_user: dict = Depends(get_current_user),
):
"""Delete a workflow and its work items (cascade)."""
return coord_workflow_service.delete_workflow(db, workflow_id)