1
0
forked from wrenn/wrenn
Co-authored-by: Tasnim Kabir Sadik <tksadik@omukk.dev>

Reviewed-on: wrenn/wrenn#50
This commit is contained in:
2026-05-24 21:10:37 +00:00
parent 4707f16c76
commit 05ddf62399
203 changed files with 15815 additions and 9344 deletions

View File

@ -101,6 +101,10 @@ func (d *Dispatcher) handleMessage(ctx context.Context, msg redis.XMessage) {
return
}
if isRedundantSystemFollowup(event) {
return
}
teamID, err := id.ParseTeamID(event.TeamID)
if err != nil {
slog.Warn("channels: invalid team ID in event", "team_id", event.TeamID, "error", err)
@ -181,3 +185,23 @@ func (d *Dispatcher) decryptConfig(configJSON []byte) (map[string]string, error)
func isGroupExistsError(err error) bool {
return err != nil && err.Error() == "BUSYGROUP Consumer Group name already exists"
}
// isRedundantSystemFollowup filters out capsule lifecycle events emitted by
// the SandboxService background goroutine / host-agent callback after a
// user-initiated action. The corresponding handler already publishes a
// user-actor event for the same intent; without this filter, every user
// action delivers two notifications.
//
// Genuinely system-only emitters (TTL auto-pause, host_monitor reconciler,
// host-reported failures) always set Metadata["reason"], so they pass.
func isRedundantSystemFollowup(e events.Event) bool {
if e.Actor.Type != events.ActorSystem {
return false
}
switch e.Event {
case events.CapsuleCreate, events.CapsulePause, events.CapsuleResume, events.CapsuleDestroy:
default:
return false
}
return e.Metadata["reason"] == ""
}