guard-on-every-trigger-path
Installation
SKILL.md
Guard on every trigger path
Some features are started from two places on purpose:
- a polling loop that watches progress and fires when a threshold is crossed
(
timeRemaining in 1..threshold, checked every ~200 ms), and - an end-of-item callback that fires when the item actually finishes.
The callback exists as the fallback for every case where polling did not fire: the loop was not running, the item was too short for the window, the item ended early. It therefore opens with an early return so the two cannot both start the feature:
private fun handleTrackEndInternal() {
if (isCrossfading) return // the poll path already started it
val shouldStart = enabled && hasNext() && !isVideo() && !isTooShort() && !isInAlbum()
...
}