Files
pitchfast/backlog/tasks/task-16 - Orchestrate-recurring-Convex-agent-jobs-and-audit-lifecycle.md

60 lines
2.2 KiB
Markdown

---
id: TASK-16
title: Orchestrate recurring Convex agent jobs and audit lifecycle
status: Done
assignee: []
created_date: '2026-06-03 19:14'
updated_date: '2026-06-10 19:27'
labels:
- mvp
- convex
- jobs
dependencies:
- TASK-6
- TASK-12
- TASK-15
references:
- PRD.md
priority: high
ordinal: 16000
---
## Description
<!-- SECTION:DESCRIPTION:BEGIN -->
Implement the scheduled and manual background workflow using Convex. The MVP permits only one active agent run at a time, supports campaign cron runs and manual Jetzt ausführen runs, and manages public audit lifecycle notifications and deactivation.
<!-- SECTION:DESCRIPTION:END -->
## Acceptance Criteria
<!-- AC:BEGIN -->
- [x] #1 Convex cron or scheduled functions trigger active campaigns according to cadence
- [x] #2 Jetzt ausführen starts a campaign run immediately only when no other agent run is active
- [x] #3 Cron skips or queues safely when an agent run is already active, with visible run logs
- [x] #4 Published audits older than 30 days create dashboard notifications asking whether to keep active
- [x] #5 Published audits older than 60 days auto-deactivate unless manually extended or later reactivated
<!-- AC:END -->
## Implementation Plan
<!-- SECTION:PLAN:BEGIN -->
1. Add global agent-run lock or equivalent single-active-run guard.
2. Implement scheduled campaign runner using Convex cron/scheduling.
3. Wire manual Jetzt ausführen to the same runner and limits.
4. Add run logs and dashboard-visible status updates.
5. Add audit lifecycle checks for 30-day notification, 60-day deactivation, and reactivation.
<!-- SECTION:PLAN:END -->
## Implementation Notes
<!-- SECTION:NOTES:BEGIN -->
Started implementation pass for recurring Convex agent jobs, run locking, logs, and audit lifecycle.
Implemented and verified Convex crons, due-campaign runner, single-active-run guard, visible campaign run logs, and audit lifecycle notification/deactivation controls. Verification: pnpm test 305/305; pnpm lint 0 errors.
<!-- SECTION:NOTES:END -->
## Final Summary
<!-- SECTION:FINAL_SUMMARY:BEGIN -->
Closed per explicit user request while switching project tracking to pitchfast.
<!-- SECTION:FINAL_SUMMARY:END -->