Skip to content

feat(tasks): self cleaning tasks#5121

Merged
brunozoric merged 18 commits intonextfrom
bruno/feat/tasks/self-cleaning-tasks
Apr 29, 2026
Merged

feat(tasks): self cleaning tasks#5121
brunozoric merged 18 commits intonextfrom
bruno/feat/tasks/self-cleaning-tasks

Conversation

@brunozoric
Copy link
Copy Markdown
Contributor

@brunozoric brunozoric commented Apr 21, 2026

Changes

This PR gives a task to self-delete after it is done. If turned on, it will delete everything in the database related to that task: run, logs, child tasks, their logs....

It is configurable via the regular task definition.

How Has This Been Tested?

Jest and manually.

@brunozoric brunozoric self-assigned this Apr 21, 2026
@brunozoric brunozoric requested a review from Pavel910 April 21, 2026 07:47
@brunozoric brunozoric added this to the 6.3.0 milestone Apr 21, 2026
@brunozoric brunozoric force-pushed the bruno/feat/tasks/self-cleaning-tasks branch from 3555370 to 62fd37e Compare April 22, 2026 08:07
brunozoric and others added 14 commits April 29, 2026 08:52
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Implements recursive best-effort deletion of a task subtree (task +
descendants + their logs when databaseLogs=true), wired into
createTaskCrud as context.tasks.cleanupTaskSubtree(id).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… to ApiContext

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Adds 5 integration tests covering all selfCleanup scenarios (onSuccess, onError,
always, parent cascade, onAbort). Also fixes a bug in RunnableTaskDecorator
where selfCleanup was not forwarded to the SelfCleaningTaskDecorator, causing
cleanup to never trigger.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- Integration: onError cleanup, array form, user-hook ordering,
  3-level cascade, mixed databaseLogs in cascade, explicit never.
- Unit: cleanupTaskSubtree cycle guard.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@brunozoric brunozoric force-pushed the bruno/feat/tasks/self-cleaning-tasks branch from b8171f3 to 9884d3a Compare April 29, 2026 07:02
brunozoric and others added 4 commits April 29, 2026 09:32
Remove the context-in-ITaskLifecycleHook approach (Tasks 1 & 2) and
replace with the CleanupTaskSubtreeUseCase UseCase/DI pattern that was
actually implemented.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
@brunozoric brunozoric marked this pull request as ready for review April 29, 2026 09:35
@brunozoric brunozoric merged commit b35f16d into next Apr 29, 2026
25 checks passed
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