donna.notifications.overdue¶
donna.notifications.overdue
¶
Overdue task detection — nudge the user when tasks run past their end time.
Background async task that runs every 15 minutes. For every scheduled or in-progress task whose estimated end time + 30-minute buffer has passed, it creates a Discord thread in #donna-tasks with an overdue nudge.
User replies in the thread
"done" → transitions task to in_progress → done (sets completed_at) "reschedule" → transitions task to in_progress → scheduled, finds next slot
Respects blackout/quiet hours via NotificationService — nudges are queued during blackout (12 AM–6 AM) and replayed at 6 AM.
See slices/slice_05_reminders_digest.md and docs/notifications.md.
OverdueDetector
¶
OverdueDetector(db: Database, service: NotificationService, bot: DonnaBot, scheduler: Scheduler, calendar_id: str, user_id: str, escalation_manager: EscalationManager | None = None, router: ModelRouter | None = None)
Detects overdue tasks and sends nudges via Discord threads.
Usage
detector = OverdueDetector(db, service, bot, scheduler, client, calendar_id, user_id)
Register the reply handler before starting the bot loop:¶
bot = DonnaBot(..., overdue_reply_handler=detector.handle_reply) asyncio.create_task(detector.run())
Source code in src/donna/notifications/overdue.py
run
async
¶
Loop forever, checking for overdue tasks every 15 minutes.
Source code in src/donna/notifications/overdue.py
handle_reply
async
¶
Handle user reply in an overdue thread.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
task_id
|
str
|
The task that was nudged. |
required |
reply
|
str
|
Normalised (lower-case stripped) user reply text. |
required |