Fix/orphan proofs sweeper - #86
Open
Devadakene wants to merge 12 commits into
Open
Conversation
cybermax4200
requested changes
Aug 22, 2026
cybermax4200
left a comment
Contributor
There was a problem hiding this comment.
The ci checks are failing please fix them
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.
Closes #79
Description
This PR introduces a recovery sweeper to handle
PENDINGproofs that become permanently stuck. Previously, ifenqueueVerificationfailed and the subsequent database rollback transaction also failed, the proof would remain in aPENDINGstate forever without a corresponding verification job.This change adds
recoverOrphanedProofstotaskService.tswhich automatically detects orphaned proofs older than a configurable threshold (PROOF_ORPHAN_MAX_AGE_MS, defaulting to 30 minutes) and escalates them by rejecting them with a system failure note. The sweeper is integrated intoexpiryWorker.tsto run periodically.Fixes #5 (and addresses the related permanently-stuck proofs rollback issue).
Type of Change
How Has This Been Tested?
npm testpassesnpm run buildsucceeds(Added unit tests in
taskService.test.tsto verify orphaned proof detection and rejection, and updatedexpiryWorker.test.tsto ensure the sweeper is called on schedule).Checklist
Additional Context
PROOF_ORPHAN_MAX_AGE_MSenvironment variable, which defaults to 30 minutes (1800000ms).REJECTEDand a verification note appended reading: "Proof orphaned due to system failure".