This issue was written by Claude (Opus 4.8).
Symptom
Resending an already-resent message produces duplicate resent tags. A first resend gets […original tags…, resent]; resending that copies its tags and appends resent again → […, resent, resent]. Each further resend adds another, so the badge row grows resent resent resent ….
Cause
STS\Postmaster\Mail\ResentMessage::build() (around line 67):
foreach ((array) $this->record->tags as $tag) {
$this->tag($tag);
}
return $this->tag('resent');
It copies every tag from the source record — which already includes resent when the source was itself a resend — then unconditionally adds resent again.
Suggested fix
Don't re-add resent if it's already carried over (and, defensively, dedupe the copied tags):
foreach (array_unique((array) $this->record->tags) as $tag) {
$this->tag($tag);
}
if (! in_array('resent', (array) $this->record->tags, true)) {
$this->tag('resent');
}
return $this;
The resent tag is a boolean-style marker ("this send is a resend"); resend depth is already tracked precisely by the resent_from_id chain (resendChain()), so a single resent tag is all that's meaningful.
Workaround in the meantime
Consuming app dedupes on display (array_unique($message->tags)), but the stored tags column still accumulates, so the fix is best at the write side.
Happy to PR.
Symptom
Resending an already-resent message produces duplicate
resenttags. A first resend gets[…original tags…, resent]; resending that copies its tags and appendsresentagain →[…, resent, resent]. Each further resend adds another, so the badge row growsresent resent resent ….Cause
STS\Postmaster\Mail\ResentMessage::build()(around line 67):It copies every tag from the source record — which already includes
resentwhen the source was itself a resend — then unconditionally addsresentagain.Suggested fix
Don't re-add
resentif it's already carried over (and, defensively, dedupe the copied tags):The
resenttag is a boolean-style marker ("this send is a resend"); resend depth is already tracked precisely by theresent_from_idchain (resendChain()), so a singleresenttag is all that's meaningful.Workaround in the meantime
Consuming app dedupes on display (
array_unique($message->tags)), but the storedtagscolumn still accumulates, so the fix is best at the write side.Happy to PR.