fix(task): complete pending deletions with bounded retries - #2742
Merged
openai0229 merged 7 commits intoSep 10, 2026
Merged
Conversation
Deleting a task with a published artifact renames the file to a hidden .task-delete-<uuid> staging name and physically deletes it only after the task record removal commits. A crash inside that window left the staged file orphaned forever (record gone) or the user's artifact stuck hidden (record alive), with no recovery path - the events journal recovered -event deletions only. Staged artifact deletions are now journaled to task-artifact-deletions.json next to the task data and replayed at startup: surviving task restores the artifact to its published name, missing task sweeps the staged file.
HandSonic
force-pushed
the
fix/task-artifact-delete-recovery
branch
from
September 3, 2026 21:41
2df4940 to
a11ada6
Compare
10 tasks
Contributor
Author
|
Exhaustive cross-PR integration update: the full 72-PR pairwise scan found the expected ArtifactService/test overlap among #2800, #2742, and #2802. I resolved it semantically in an isolated combined tree (atomic publication + durable deletion recovery + input cleanup), adapted the post-merge constructor/method signatures, and ran the full 9-module reactor: tools 68, domain-api 27, SPI 142, domain-core 256, storage 64, web 95 (1 environment skip), all with 0 failures/errors. |
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.
Related issue
N/A — incomplete task/artifact deletion discovered during review of the task-system rebuild.
Summary
Deleting a completed task can stop halfway when the application exits or a filesystem operation fails. Persist the deletion request before changing the file or task record, then finish remaining work on startup.
All requests live in one
task-artifact-deletions.jsonfile containing a JSON array. Each item stores the task ID, original artifact path, unique staged path, attempt count, and last error. The deletion sequence is: save the intent and attempt count, stage the artifact, remove the task record, delete the staged artifact, then remove the completed queue item. After task removal, cleanup only touches the staged path, preserving any newer export at the original filename.Startup makes one pass through the queue. Automatic processing stops at three total attempts, including the initial delete; exhausted entries retain their error. An explicit delete of a surviving task can try again. Already-completed entries are cleared even at the limit.
Service contracts live in domain-api:
ArtifactServiceandTaskDeletionService. Their domain-core implementations areArtifactServiceImplfor file operations andTaskDeletionServiceImplfor the deletion queue and retries. TaskServiceImpl and the task runtime consume these interfaces. PendingTaskDeletion holds per-operation state; JsonFileUtils handles JSON file I/O. The queue is loaded for each synchronized operation, without a persistent in-memory copy.Affected surfaces
Verification
Risk and compatibility
Reviewer map
Contributor declaration
AI assistance: implementation, review, simplification, interface extraction, and tests used AI assistance. The reported verification was executed locally.