Skip to content

fix(slm): fleet sync startup reconciliation + concurrent guard (#1729, #1730)#1928

Merged
mrveiss merged 2 commits intoDev_new_guifrom
fix/fleet-sync-bugs-1729-1730
Mar 20, 2026
Merged

fix(slm): fleet sync startup reconciliation + concurrent guard (#1729, #1730)#1928
mrveiss merged 2 commits intoDev_new_guifrom
fix/fleet-sync-bugs-1729-1730

Conversation

@mrveiss
Copy link
Owner

@mrveiss mrveiss commented Mar 19, 2026

Summary

Changes

  • autobot-slm-backend/api/code_sync.py: Added reconcile_stale_fleet_sync_jobs() function and concurrent guard in sync_fleet()
  • autobot-slm-backend/main.py: Call reconciliation during lifespan startup after DB init

Test plan

  • Deploy to .19, restart SLM backend — verify startup logs show no reconciliation (clean state)
  • Manually set a job to running in DB, restart — verify it gets marked failed
  • Trigger fleet sync, then immediately trigger another — verify 409 response
  • Normal fleet sync still works end-to-end

Closes #1729
Closes #1730

…1729, #1730)

On SLM backend startup, any fleet sync job stuck in 'running' status
from a prior crash is now marked 'failed' with a timestamp. The
sync_fleet endpoint also rejects new requests with 409 Conflict when
a sync is already running, preventing duplicate deployments and git
index.lock races.
@github-actions
Copy link

github-actions bot commented Mar 19, 2026

✅ SSOT Configuration Compliance: Passing

🎉 No hardcoded values detected that have SSOT config equivalents!

…1729, #1730)

- Add asyncio.Lock to serialize check-and-insert in sync_fleet,
  preventing TOCTOU race (#1937)
- Extract assert_no_running_sync() as shared guard for reuse
- Capture stale_jobs count inside session scope (fragile pattern fix)
- Clean up _running_tasks dict after job completes (memory leak fix)
- Add try/except around reconciliation in lifespan (startup safety)
@mrveiss mrveiss merged commit 07a32e5 into Dev_new_gui Mar 20, 2026
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant