A failed job finds its way back to the queue - #258
Merged
Conversation
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Merged
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.
Fixes #216.
A failed job could only run again through the object it belonged to;
bootstrap_ontology,adjudicate_entitiesand the rest had no way back, and since #201 an out-of-credit batch fails on the first attempt — five hundred documents, one click each after the top-up.Requeue by scope.
jobs::requeue_failed(RequeueScope { kb_id, kind, failed_since })puts failed rows back (attempts = 0, due now); handlers are idempotent, which is what orphan recovery already relies on. The knowledge base is resolved from the payload —document_id,source_idorkb_id— so another base's jobs are never touched, and jobs without a base move only in the unscoped call. Two endpoints:POST /kbs/{id}/jobs/requeue(Editor) andPOST /jobs/requeue(admin, for system alerts);GET /kbs/{id}/jobs/failedcounts.The alert carries the action.
llm.out_of_creditandllm.unreachablegroups show "Run those again", scoped to the group's base and to jobs that failed since the group's earliest alert — top up, click, the batch resumes. KB settings shows "N failed jobs · Run again" for every other kind of failure. No queue page.Test:
a_failed_job_finds_its_way_back— scope by base (document, source and base-level payloads), by kind, by time window; done rows stay done; a system job moves only unscoped.0005 carries a revision note.
🤖 Generated with Claude Code