fix(slm): fleet sync startup reconciliation + concurrent guard (#1729, #1730)#1928
Merged
mrveiss merged 2 commits intoDev_new_guifrom Mar 20, 2026
Merged
fix(slm): fleet sync startup reconciliation + concurrent guard (#1729, #1730)#1928mrveiss merged 2 commits intoDev_new_guifrom
mrveiss merged 2 commits intoDev_new_guifrom
Conversation
…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.
✅ 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)
This was referenced Mar 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
runningstatus from a prior crash is now reconciled — markedfailedwithcompleted_attimestamp and a warning logPOST /api/code-sync/fleet/syncendpoint now rejects new sync requests with409 Conflictwhen a sync is already in progress, preventing duplicate deployments and gitindex.lockrace conditionsChanges
autobot-slm-backend/api/code_sync.py: Addedreconcile_stale_fleet_sync_jobs()function and concurrent guard insync_fleet()autobot-slm-backend/main.py: Call reconciliation during lifespan startup after DB initTest plan
runningin DB, restart — verify it gets markedfailedCloses #1729
Closes #1730