Overview
Add notification handlers for error and retry events with configurable behavior.
Event Matrix
| Event |
Condition |
Notification |
Priority |
permission.updated |
Always |
Permission request |
high |
session.status: idle |
After delay |
Idle notice |
default |
session.status: retry |
First OR after N |
Retry notice |
high |
session.error |
Debounced |
Error alert |
urgent |
Retry Notification Logic
const retryNotifyFirst = process.env.NTFY_RETRY_NOTIFY_FIRST !== 'false'
const retryNotifyAfter = parseInt(process.env.NTFY_RETRY_NOTIFY_AFTER || '3', 10)
let retryCount = 0
// On retry event
retryCount++
const shouldNotify = (retryNotifyFirst && retryCount === 1) ||
(retryNotifyAfter > 0 && retryCount === retryNotifyAfter)
// On idle/busy event
retryCount = 0 // Reset counter
Error Notification Logic
const errorNotify = process.env.NTFY_ERROR_NOTIFY !== 'false'
const errorDebounce = parseInt(process.env.NTFY_ERROR_DEBOUNCE_MS || '60000', 10)
let lastError = null
// On error event
if (errorNotify) {
const now = Date.now()
if (!lastError || (now - lastError) > errorDebounce) {
lastError = now
// Send notification
}
}
Tasks
Questions
- What is the exact event type for errors? Need to verify
session.error or similar.
- Does retry status include attempt count in properties?
Acceptance Criteria
- First retry triggers notification (if enabled)
- Nth retry triggers notification (if configured)
- Errors are debounced within window
- Counters reset appropriately
Overview
Add notification handlers for error and retry events with configurable behavior.
Event Matrix
permission.updatedhighsession.status: idledefaultsession.status: retryhighsession.errorurgentRetry Notification Logic
Error Notification Logic
Tasks
Questions
session.erroror similar.Acceptance Criteria