feat: clear free plan workflow run logs#29494
Merged
hjlarry merged 57 commits intolanggenius:mainfrom Jan 12, 2026
Merged
Conversation
LIHUA919 approved these changes Dec 11, 2025
hj24 requested changes Dec 11, 2025
This comment was marked as outdated.
This comment was marked as outdated.
hj24 requested changes Dec 11, 2025
This comment was marked as outdated.
This comment was marked as outdated.
Contributor
There was a problem hiding this comment.
Code Review
This pull request introduces a new feature to clean up expired workflow run logs for free-tier tenants. It includes a new CLI command, a scheduled Celery task, a database migration to add a necessary index, and the core service logic for performing the cleanup in batches. The implementation is robust, with good test coverage for the new components. My review includes a suggestion to optimize the database deletion logic for better performance and memory efficiency.
hj24 requested changes Dec 12, 2025
MRZHUH previously approved these changes Dec 18, 2025
crazywoola previously approved these changes Dec 24, 2025
5 tasks
hj24 reviewed Jan 12, 2026
hj24 reviewed Jan 12, 2026
Contributor
hj24 left a comment
There was a problem hiding this comment.
except the migration version, others LGTM
5 tasks
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.
Important
Fixes #<issue number>.Summary
fix #29776
related PR:
#29842
#29829
#29638
Todo:
rm
api/services/clear_free_plan_tenant_expired_logs.pyin the future.Usage
1. update db
to use the
created_atindex ofworkflow_runstable2. dry run
then you can get some logs like:
you can compare with the sql result (maybe slow):
4. run
To clear run logs within a specified time range.
To clear the run logs before 90 days:
To schedule run the clear task:
Screenshots
Checklist
dev/reformat(backend) andcd web && npx lint-staged(frontend) to appease the lint gods