I've done some changes, so opening a PR to discuss them. Maybe it would be worth to split it to more PRs - let's see if it will not be too confusing.
Tag name is rewritten to use real tag_id instead of get_event - it means wasting one number in tag_id sequence
user's count of sidetags is propagated to policy handler
sidetag removal (mikem)
automatic sidetag removal after last build is untagged (mikem) - this one triggers a possible bug in koji. It must be fixed to use this, there is no simple workaround.
I've done some changes, so opening a PR to discuss them. Maybe it would be worth to split it to more PRs - let's see if it will not be too confusing.