OUT-3663 | Auto-archive: daily cron job & activity log#1198
OUT-3663 | Auto-archive: daily cron job & activity log#1198arpandhakal merged 11 commits intoOUT-3662from
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Greptile SummaryThis PR introduces a nightly Trigger.dev cron job that auto-archives completed tasks (and their descendants via ltree path) for workspaces with Confidence Score: 5/5Safe to merge; no P0 or P1 issues found — only minor UI consistency and forward-compatibility P2 notes. All previously flagged concerns (activity log entries, subtask cascade, per-workspace error isolation) have been addressed. Remaining findings are P2: a missing DotSeparator in the system-activity render path and an overly specific isSystemActivity type guard. No files require special attention beyond the P2 notes on ActivityLog.tsx. Important Files Changed
Sequence DiagramsequenceDiagram
participant Trigger as Trigger.dev (2 AM cron)
participant Job as auto-archive job
participant DB as PostgreSQL
Trigger->>Job: run(payload)
Job->>DB: SELECT workspaces WHERE autoArchiveAfterDays > 0
DB-->>Job: [{workspaceId, autoArchiveAfterDays}, ...]
loop per workspace
loop batch until 0 rows returned
Job->>DB: CTE eligible_parents (LIMIT 200) + cascade_targets<br/>UPDATE Tasks SET isArchived=true RETURNING id
DB-->>Job: archivedRows[]
Job->>DB: activityLog.createMany({userId:null, userRole:internalUser})
end
Job->>Job: log workspace totals
end
Job->>Trigger: return {totalArchived, workspaceCount}
Reviews (2): Last reviewed commit: "fix(OUT-3663): system activity logs uses..." | Re-trigger Greptile |
|
Deployment failed with the following error: Learn More: https://vercel.link/multiple-function-regions |
|
@greptileai please review |
… autoarchived in a cascading manner when their parent are elligible for autoarchived and the script runs
Changes
- Auto archives eligible tasks for a workspace. For a task to be eligible in a workspace: workspace's autoArchiveAfter days should be a valid number and:
- Task should not be deleted.
- Task should not be archived.
- Task should be completed
- Task should not have open subtasks.
- Task should only be a parent task.
- Task's completedAt should be older than workspace's autoArchiveAfterDays.
- If a parent task is eligible after checking the above conditions, their subtasks are also auto archived.
- Activity logs for all auto archived tasks + subtasks.
Testing Criteria
autoArchiveAfterDays.result : 134

Archived : 163

UnArchived : 11030

Only one workspace has autoArchived enabled:

Entries to be executed (numbers are correct):

Auto Archived completed:
