Repository navigation
fix: make failed alert completion recoverable - #741
Merged
Merged
Conversation
|
|
||
| revision: str = "a9c2e5f7b1d3" | ||
| down_revision: Union[str, None] = "ff5b6d1f9e3f" | ||
| branch_labels: Union[str, Sequence[str], None] = None |
| revision: str = "a9c2e5f7b1d3" | ||
| down_revision: Union[str, None] = "ff5b6d1f9e3f" | ||
| branch_labels: Union[str, Sequence[str], None] = None | ||
| depends_on: Union[str, Sequence[str], None] = None |
| # Terminal states: the queue must never resurrect these. | ||
| TERMINAL_VALIDATION_STATUSES = (WINDOW_EXHAUSTED, VALIDATION_FAILED) | ||
| # Alert completion has its own retry budget; failures must never overwrite a verdict. | ||
| COMPLETION_PENDING = "pending" |
| TERMINAL_VALIDATION_STATUSES = (WINDOW_EXHAUSTED, VALIDATION_FAILED) | ||
| # Alert completion has its own retry budget; failures must never overwrite a verdict. | ||
| COMPLETION_PENDING = "pending" | ||
| COMPLETION_COMPLETED = "completed" |
| # Alert completion has its own retry budget; failures must never overwrite a verdict. | ||
| COMPLETION_PENDING = "pending" | ||
| COMPLETION_COMPLETED = "completed" | ||
| COMPLETION_FAILED = "failed" |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #741 +/- ##
==========================================
+ Coverage 95.68% 95.73% +0.05%
==========================================
Files 65 65
Lines 3685 3732 +47
==========================================
+ Hits 3526 3573 +47
Misses 159 159
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
MateoLostanlen
left a comment
Member
There was a problem hiding this comment.
Hi @frgfm, thanks for the PR! Clean design, and the concurrency and migration tests are great.
A few small points, none blocking:
- (nit)
finish_sequence_completiononly matchescompletion_status = 'pending'. If an old worker validates a row after the migration, the status stays NULL and the row loops forever in the queue. Accepting NULL too would make this safe even if the deploy order slips. - An admin retry days later still sends Telegram/Slack/webhook notifications for an old event. Is that what we want? Maybe skip notifications on retry, or past a certain age.
- (nit) The code-quality bot comments on the Alembic globals and the
COMPLETION_*constants are false positives, safe to ignore.
Happy to merge as is, or after the first point if you want to add it.
Member
Author
|
@MateoLostanlen all addressed ✅ |
| import sqlalchemy as sa | ||
| from alembic import op | ||
|
|
||
| revision: str = "a9c2e5f7b1d3" |
| from alembic import op | ||
|
|
||
| revision: str = "a9c2e5f7b1d3" | ||
| down_revision: Union[str, None] = "f8b5c0d4e6a3" |
MateoLostanlen
approved these changes
Nov 18, 2026
MateoLostanlen
left a comment
Member
There was a problem hiding this comment.
Thanks @frgfm! I merged main and chained the migration after f8b5c0d4e6a3 to keep a single Alembic head. LGTM.
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.
Problem: After five alert-attachment failures, an already-validated sequence was permanently abandoned and its validation reason overwritten.
Change: Separate alert completion from validation and add admin APIs to list and retry failures. Recovery preserves the verdict and existing alert links, skips model inference, and sends no webhook, Telegram, or Slack notifications for the recovered event. Legacy NULL completion states can also finish safely.
Benefit: Admins can recover stranded alerts without database edits or rerunning validation.
Checks: 806 passed, 1 skipped; concurrency and migration checks passed.
Deployment: Stop old workers, apply the included migration, then restart. Existing failures require an explicit admin retry.