Skip to content

Conversation

@PascalThuet
Copy link

Summary

Fixes #4944

  • Fix misplaced parenthesis in ContentSteeringSelector._onAddBlackList() where 1 was passed as fromIndex to indexOf() instead of as deleteCount to splice()
  • Before: blacklistResetTimeout.splice(blacklistResetTimeout.indexOf(timer, 1)) — skips index 0 and removes all elements from found index
  • After: blacklistResetTimeout.splice(blacklistResetTimeout.indexOf(timer), 1) — correctly finds timer at any position and removes only that one entry

Test plan

  • Verify content steering blacklist timers are correctly removed after TTL expiry
  • Verify blacklistResetTimeout array does not grow unboundedly during long sessions
  • Run existing unit tests

🤖 Generated with Claude Code

…mer cleanup

The `1` was incorrectly passed as the `fromIndex` parameter to `indexOf()`
instead of as the `deleteCount` parameter to `splice()`. This caused two bugs:

1. `indexOf(timer, 1)` skips index 0, so timers at position 0 are never found
2. `splice(index)` without a second argument removes ALL elements from that
   index onward, instead of removing just the one timer

This results in timer references leaking in the array and valid timers being
incorrectly removed, causing memory leaks during long content steering sessions.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@dsilhavy dsilhavy added this to the 5.2.0 milestone Feb 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

ContentSteeringSelector: incorrect splice/indexOf arguments cause timer leak

2 participants