i should also point out that i don't get this bug on nostr.wine or eden.nostr.land but i get it from events that my new ingestr tool pulls from relay.primal.net
i bet the same thing happens to parameterized ephemeral events too, as they are in the same block
this is my version of the code, i made functions that make the kind range checks more compact

https://github.com/fiatjaf/khatru/blob/master/adding.go#L28
this is the original
the problem is exactly the same, except in my client it didn't expect this disconnection to occur so i hadn't written retry logic to it yet
i'm not absolutely certain on which side the websocket is being closed though, still trying to trace it
Discussion
this is the log of what my relay prints when this happens
1707244734.975199900 trc adding event {"id":"9ea6cc486b289f63f268bc5df29d6dad5a35786822b1e2d1c5739dca38464360","pubkey":"4c800257a588a82849d049817c2bdaad984b25a45ad9f6dad66e47d3b47e3b2f","created_at":1706292659,"kind":10002,"tags":[["r","wss://nostr.wine/","read"],["r","wss://atlas.nostr.land/","read"],["r","wss://eden.nostr.land/","read"],["r","wss://filter.nostr.wine/4c800257a588a82849d049817c2bdaad984b25a45ad9f6dad66e47d3b47e3b2f?broadcast=true","read"],["r","wss://Bevo.nostr1.com/","read"],["r","wss://a.nos.lol/","read"],["r","wss://astral.ninja/","read"],["r","wss://brb.io/","read"],["r","wss://creatr.nostr.wine/","read"],["r","wss://electra.nostr.land/","read"],["r","wss://freespeech.casa/","read"],["r","wss://lightningrelay.com/","read"],["r","wss://nostr.einundzwanzig.space/","read"],["r","wss://translate.nostr.wine/","read"],["client","Coracle","31990:97c70a44366a6535c145b333f973ea86dfdc2d7a99da618c40c64705ad98e322:1685968093690"]],"content":"","sig":"1a40196246876791779bd84ffd3f50c10a5133a6d7272922fe2e3976e21e9de99a8a3717b700fca2e04709973ed054fdda48f0e2c5eee364537d2fbc1e331951"} /replicatr/app/wsprocess.go:114
1707244734.975350556 trc replaceable event /replicatr/app/adding.go:42
this is derived from khatru code, and you can see that the event kind is 10002, which is a replaceable event
so yeah, i'm now dead certain i'm gonna find the problem in the khatru codebase somewhere
my client needs to have retry built into it of course but it was fine with those other two relays but not with primal.net and it sounds like the exact same bug, nip42, not sending an ok to continue and return the message
on the client side there is a problem too, i already added a piece where when it receives an AUTH challenge it sends a signal on a channel (this is in the client code) which then allows me pick up if there is an auth being required... this is from the go-nostr code, the "relay" client code in the root directory
the things haven't been connected together, and there is another one here... gonna spend the next day or so hunting this one and i'll nail it
these two problems i discovered because i tried to build a mirroring tool for events from one relay to another, to a relay that enforces NIP-42 auth for access, which i just got working the day before yesterday