101: spotify-releases: notified checkpoint not persisted on partial failure → duplicate notifications
Where
spotify-releases/agent.ts (checkpoint persistence)
if (delivered && failed.length === 0) {
await saveLastCheck(ctx, today());
if (releases.length > 0) {
await saveNotified(ctx, [...notified, ...releases.map(releaseKey)].slice(-500));
}
} else {
ctx.log?.('warn', 'spotify-releases.checkpoint-not-advanced', { since, failedArtists: failed.length, delivered });
}
Problem
Both saveLastCheck and saveNotified are gated on delivered && failed.length === 0. When messages were delivered (delivered === true) but some artist fetch failed (failed.length > 0), saveNotified is skipped — so the already-notified releases are re-sent on the next run (duplicate notifications).
Suggested fix
Persist notified whenever delivered is true (records what was successfully sent), and keep advancing lastCheck gated on delivered && failed.length === 0 so failed artists are rescanned:
if (delivered && releases.length > 0) {
await saveNotified(ctx, [...notified, ...releases.map(releaseKey)].slice(-500));
}
if (delivered && failed.length === 0) {
await saveLastCheck(ctx, today());
}
Found by CodeRabbit while reviewing vendored snapshots in AgentWorkforce/skills#87.
Fixes #101
Summary by cubic
Fix duplicate Spotify release notifications when some artist fetches fail. We now record delivered releases after successful sends and only advance the last-check after a complete, error-free scan. Fixes #101.
- Bug Fixes
- Persist
notifiedwhendeliveredis true (and releases exist) to prevent re-sends. - Advance
lastCheckonly when no artist fetch failed, so failed artists are retried. - Added Telegram test for partial failure: one send,
notifiedsaved,last-checkunchanged.
- Persist