Skip to content

spotify-releases: notified checkpoint not persisted on partial failure → duplicate notifications #101

Description

@kjgbot

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    factory-readyReady for autonomous factory/agent pickupfactory:in-progressFactory agents are working on this issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions