-
-
Notifications
You must be signed in to change notification settings - Fork 1
Closed
Labels
Description
Problem
Nothing prevents triggering a second fleet sync via POST /api/code-sync/fleet/sync while one is already running. Two concurrent syncs could:
- Deploy to the same nodes simultaneously
- Cause Ansible playbook conflicts
- Trigger git index.lock race conditions (CLAUDE.md already warns: use batch_size=1)
- Produce confusing job status (two "running" jobs for same nodes)
Expected
The endpoint should reject a new fleet sync if one is already status='running', returning a 409 Conflict with the existing job_id.
Fix
In sync_fleet(), before creating a new job:
# Check for running jobs
running = await db.execute(
select(FleetSyncJobModel).where(FleetSyncJobModel.status == "running")
)
if running.scalar_one_or_none():
raise HTTPException(409, "Fleet sync already in progress")Impact
Severity: medium — can cause deployment failures and confusing state
Discovered During
Implementing #1707 — fleet sync job DB persistence
Location
autobot-slm-backend/api/code_sync.py — sync_fleet() endpoint
Reactions are currently unavailable