Skip to content

feat(autoplay): wire recentSkipCount into mood detection - #829

Merged
LucasSantana-Dev merged 1 commit into
release/v2.10.0from
fix/wire-recent-skip-count
May 8, 2026
Merged

LucasSantana-Dev merged 1 commit into
release/v2.10.0from
fix/wire-recent-skip-count

Conversation

@LucasSantana-Dev

@LucasSantana-Dev LucasSantana-Dev commented May 8, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • Adds guildRecentSkipCounts LRU cache (per-guild, 30-min TTL) in trackHandlers.ts to track early skips
  • Increments counter when a track is skipped before 30% completion (same threshold as implicit dislike feedback)
  • Resets counter when a track plays past 80% completion (natural session settling)
  • Exports getRecentSkipCount(guildId) for use in replenisher
  • Wires getRecentSkipCount(replenishGuildId) into detectSessionMood() in replenisher.ts — replaces the hardcoded 0 TODO

Why

detectSessionMood had a 0 /* TODO: wire recentSkipCount */ for 6 months. A guild that skips 5 tracks in a row was still being served "similar" mood recommendations instead of shifting to exploratory/energetic mode. This connects the skip signal to the mood algorithm.

Test plan

  • trackHandlers.spec.ts: 22 tests (added 2 new — skip count increments, reset on completion)
  • replenisher.spec.ts: 8 tests all pass

🤖 Generated with Claude Code

Greptile Summary

The PR wires getRecentSkipCount into detectSessionMood, replacing a 6-month-old hardcoded 0. A per-guild LRU cache tracks early skips and resets on natural track completion. One new P2 finding: the sessionMoodCache in replenisher.ts is not invalidated when the skip count resets, causing restless: true to persist for 1–2 extra replenish cycles after a settling track completes.

Confidence Score: 5/5

Safe to merge — all findings are P2; the skip count wiring is correct and tests pass.

Only P2 findings remain after prior review rounds addressed the most critical concerns. The stale mood cache window is a minor behavioral imprecision that self-corrects within 2 tracks.

No files require blocking attention; replenisher.ts has the stale-mood-cache edge case worth a follow-up.

Important Files Changed

Filename Overview
packages/bot/src/handlers/player/trackHandlers.ts Adds guildRecentSkipCounts LRU cache with increment on early skip and delete on >80% completion; updateAgeOnGet: true flag means TTL resets on every read from replenisher, not just on writes.
packages/bot/src/utils/music/autoplay/replenisher.ts Wires getRecentSkipCount into detectSessionMood; introduces a circular module dependency and a stale mood cache window of 1–2 cycles after skip count resets.
packages/bot/src/handlers/player/trackHandlers.spec.ts Adds two new tests covering skip count increment on early skip, reset on >80% completion, and no-increment on late skip; correct timer setup with existing afterEach cleanup.

Comments Outside Diff (1)

  1. packages/bot/src/handlers/player/trackHandlers.ts, line 285-292 (link)

    P2 Reset missing the durationMS > 20_000 guard present in the skip path

    handlePlayerSkip only increments the count when track.durationMS > 20_000, but handlePlayerFinish resets the count for any track duration that reaches >80% completion. A jingle or interstitial shorter than 20 s that autoplays to completion would silently clear an active "skip storm" signal. Adding the same duration guard keeps the two sides of the state machine symmetric.

    Fix in Claude Code Fix in Codex

Fix All in Claude Code Fix All in Codex

Reviews (3): Last reviewed commit: "feat(autoplay): wire recentSkipCount int..." | Re-trigger Greptile

@vercel

vercel Bot commented May 8, 2026 •

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
lucky Ready Ready Preview, Comment May 8, 2026 7:15pm

Request Review

@coderabbitai

coderabbitai Bot commented May 8, 2026 •

Copy link
Copy Markdown

Warning

Rate limit exceeded

@LucasSantana-Dev has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 19 minutes and 56 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 77d9ad36-7bae-4c9a-9687-f64adb37c526

📥 Commits

Reviewing files that changed from the base of the PR and between 54e910a and a634b91.

📒 Files selected for processing (3)
  • packages/bot/src/handlers/player/trackHandlers.spec.ts
  • packages/bot/src/handlers/player/trackHandlers.ts
  • packages/bot/src/utils/music/autoplay/replenisher.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/wire-recent-skip-count

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions Bot added bot size/m and removed bot labels May 8, 2026
@github-actions

github-actions Bot commented May 8, 2026

Copy link
Copy Markdown

Failed to generate code suggestions for PR

Comment thread packages/bot/src/utils/music/autoplay/replenisher.ts
Comment thread packages/bot/src/handlers/player/trackHandlers.ts
Comment thread packages/bot/src/utils/music/autoplay/lastFmSeeder.ts Outdated
Track early skips (< 30%) per guild with an LRU cache in trackHandlers.
The counter increments on each qualifying skip and resets when a track
plays to >80% completion.  detectSessionMood now receives the real skip
count instead of the hardcoded 0, so session mood correctly shifts
toward energetic/exploratory when the listener is skipping rapidly.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@LucasSantana-Dev
LucasSantana-Dev force-pushed the fix/wire-recent-skip-count branch from 17dcf4f to a634b91 Compare May 8, 2026 19:13
@github-actions github-actions Bot added the bot label May 8, 2026
@sonarqubecloud

sonarqubecloud Bot commented May 8, 2026

Copy link
Copy Markdown

@LucasSantana-Dev
LucasSantana-Dev merged commit 838b0d9 into release/v2.10.0 May 8, 2026
16 checks passed
LucasSantana-Dev added a commit that referenced this pull request May 13, 2026
Track early skips (< 30%) per guild with an LRU cache in trackHandlers.
The counter increments on each qualifying skip and resets when a track
plays to >80% completion.  detectSessionMood now receives the real skip
count instead of the hardcoded 0, so session mood correctly shifts
toward energetic/exploratory when the listener is skipping rapidly.

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
LucasSantana-Dev added a commit that referenced this pull request May 13, 2026
Promote [Unreleased] entries into the v2.10.0 section, bump root + workspace
versions from 2.9.0 to 2.10.0, and update the lockfile.

Release highlights:
- Spotify 429 retry hardening (#808)
- Last.fm canonical metadata + multi-artist scrobble fix (#821)
- Autoplay Spanish-gospel-block + sertanejo prioritization series
  (#817-#820, #827, #829, #830)
- Review-tools revamp: Claude review + Danger + chilled CodeRabbit
  via org-level reusable workflows (#838)
- Coverage threshold pinned for phase-2 test cleanup (#835)
- CI extended to release/** branches (#816)
@LucasSantana-Dev
LucasSantana-Dev deleted the fix/wire-recent-skip-count branch May 23, 2026 02:21

This branch was successfully deployed

1 active deployment
Preview — a634b91b Deployed May 8, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant