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_work_item import CoordWorkItemCreate, CoordWorkItemResponse, CoordWorkItemUpdate
from api.services import coord_work_item_service
@@ -22,7 +21,6 @@ def list_work_items(
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 work items with optional filters."""
items, total = coord_work_item_service.get_work_items(
@@ -46,7 +44,6 @@ def list_work_items(
def create_work_item(
data: CoordWorkItemCreate,
db: Session = Depends(get_db),
current_user: dict = Depends(get_current_user),
):
"""Create a new work item within a workflow."""
item = coord_work_item_service.create_work_item(db, data)
@@ -57,7 +54,6 @@ def create_work_item(
def get_work_item(
item_id: UUID,
db: Session = Depends(get_db),
current_user: dict = Depends(get_current_user),
):
"""Get a work item by ID."""
item = coord_work_item_service.get_work_item_by_id(db, item_id)
@@ -69,7 +65,6 @@ def update_work_item(
item_id: UUID,
data: CoordWorkItemUpdate,
db: Session = Depends(get_db),
current_user: dict = Depends(get_current_user),
):
"""Update a work item."""
item = coord_work_item_service.update_work_item(db, item_id, data)
@@ -80,7 +75,6 @@ def update_work_item(
def delete_work_item(
item_id: UUID,
db: Session = Depends(get_db),
current_user: dict = Depends(get_current_user),
):
"""Delete a work item."""
return coord_work_item_service.delete_work_item(db, item_id)