Skip to content

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

Open
agent-relay-code[bot] wants to merge 2 commits into
mainfrom
factory/101-agentworkforce-agents-f579f8e8
Open

101: spotify-releases: notified checkpoint not persisted on partial failure → duplicate notifications#106
agent-relay-code[bot] wants to merge 2 commits into
mainfrom
factory/101-agentworkforce-agents-f579f8e8

Conversation

@agent-relay-code

@agent-relay-code agent-relay-code Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

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 notified when delivered is true (and releases exist) to prevent re-sends.
    • Advance lastCheck only when no artist fetch failed, so failed artists are retried.
    • Added Telegram test for partial failure: one send, notified saved, last-check unchanged.

Written for commit a193dca. Summary will update on new commits.

Review in cubic

Copy link
Copy Markdown
Member

Ready for human review

PR #106 matches issue #101: delivered Spotify releases are persisted even when part of the artist scan fails, while lastCheck advances only after a fully successful scan. Fixing commit: bcda006 (current head: a193dca).

Validation:

  • npm test — 235/235 passing, including the two-run partial-failure regression (one notification, notified key persisted, lastCheck unchanged)
  • npm run typecheck — passing
  • npm run compile — all personas compile
  • GitHub: mergeable/CLEAN; Cubic check passing; no unresolved review threads

This is ready for human review and has not been merged. I’m happy to discuss status, trade-offs, or any open questions here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

1 participant