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:
@@ -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_session_lock import CoordSessionLockCreate, CoordSessionLockResponse
|
||||
from api.services import coord_lock_service
|
||||
|
||||
@@ -20,7 +19,6 @@ def list_active_locks(
|
||||
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 currently active locks with optional filters."""
|
||||
locks, total = coord_lock_service.get_active_locks(
|
||||
@@ -39,7 +37,6 @@ def check_resource_locked(
|
||||
project_key: str = Query(...),
|
||||
resource: str = Query(...),
|
||||
db: Session = Depends(get_db),
|
||||
current_user: dict = Depends(get_current_user),
|
||||
):
|
||||
"""Check whether a resource is currently locked."""
|
||||
lock = coord_lock_service.check_resource_locked(db, project_key, resource)
|
||||
@@ -52,7 +49,6 @@ def check_resource_locked(
|
||||
def claim_lock(
|
||||
data: CoordSessionLockCreate,
|
||||
db: Session = Depends(get_db),
|
||||
current_user: dict = Depends(get_current_user),
|
||||
):
|
||||
"""Claim a resource lock for a session."""
|
||||
lock = coord_lock_service.claim_lock(db, data)
|
||||
@@ -63,7 +59,6 @@ def claim_lock(
|
||||
def release_all_session_locks(
|
||||
session_id: str = Query(..., description="Release all active locks held by this session"),
|
||||
db: Session = Depends(get_db),
|
||||
current_user: dict = Depends(get_current_user),
|
||||
):
|
||||
"""Release all active locks for a session (call on session end)."""
|
||||
return coord_lock_service.release_all_session_locks(db, session_id)
|
||||
@@ -74,7 +69,6 @@ def release_lock(
|
||||
lock_id: UUID,
|
||||
session_id: str = Query(..., description="Must match the session that claimed the lock"),
|
||||
db: Session = Depends(get_db),
|
||||
current_user: dict = Depends(get_current_user),
|
||||
):
|
||||
"""Release a specific lock by ID."""
|
||||
lock = coord_lock_service.release_lock(db, lock_id, session_id)
|
||||
|
||||
Reference in New Issue
Block a user