Skip to content

Fix validator sync timeouts and add AI review calibration endpoint#509

Merged
JoaquinBN merged 1 commit intodevfrom
JoaquinBN/fix-sync-validators
Mar 31, 2026
Merged

Fix validator sync timeouts and add AI review calibration endpoint#509
JoaquinBN merged 1 commit intodevfrom
JoaquinBN/fix-sync-validators

Conversation

@JoaquinBN
Copy link
Copy Markdown
Collaborator

Summary

  • Validator sync fix: The sync endpoint was timing out (504) because it ran synchronously. Now runs in a background thread with a database-backed lock (SyncLock model using SELECT FOR UPDATE) to prevent concurrent syncs across gunicorn workers. Includes stale lock recovery after 30 minutes.
  • Sync logging: Added detailed per-network logging to the sync service for better production debugging.
  • GitHub Actions workflow: Handle 409 (sync already in progress) as a non-failure status.
  • AI review calibration endpoint: New GET /api/v1/ai-review/reviewed/ endpoint that gives the AI agent read access to reviewed submissions that had proposals, including staff replies and internal notes — enabling the agent to learn from past review decisions.
  • Documentation: Updated backend/CLAUDE.md with validator and AI review endpoint references.

- Fix sync endpoint to run in background thread with DB-based lock (SyncLock model)
  to prevent concurrent syncs across gunicorn workers
- Add detailed logging to sync service for better debugging
- Handle 409 (sync in progress) as non-failure in GitHub Actions workflow
- Add GET /api/v1/ai-review/reviewed/ endpoint for AI agent to access
  reviewed submissions with proposals, staff replies, and internal notes
- Update backend CLAUDE.md with validator and AI review documentation
@JoaquinBN JoaquinBN merged commit d6f76d0 into dev Mar 31, 2026
@JoaquinBN JoaquinBN deleted the JoaquinBN/fix-sync-validators branch March 31, 2026 13:09
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