RejectCode
Why a host refused a joiner's AdmitMessage.Hello.
The structured companion to AdmitMessage.Reject.reason, which stays free text for humans reading a log. Before this existed a consumer had to string-match the reason to tell a transient refusal from a permanent one — and the two most consequential cases were not even distinguishable in principle, because the host sent the same words for both.
Open hierarchy (interface, not enum), mirroring us.tractat.kuilt.core.discovery.DiscoveryKind: a module outside :kuilt-session can supply its own code without amending this file. A code kuilt does not recognise — including one from a newer build, or from a peer that sends none at all — decodes as Unknown.
retryable defaults to true, deliberately. Retrying is what the joiner did before typed codes existed, so an unrecognised code preserves that behaviour exactly; only a code that explicitly declares itself terminal changes it. The dangerous direction is the other one: treating an unknown refusal as terminal would end a joiner's reconnect on a refusal its host meant as passing, such as HostFailed, and the retry a moment later would have succeeded.
Samples
when (reason.code) {
// Terminal: the wrong room, a protocol version the host can't speak, a key proof that
// failed, or another device holding this peer id. The same Hello fails the same way.
RejectCode.RoomMismatch, RejectCode.ProtocolMismatch,
RejectCode.BadProof, RejectCode.KeyConflict,
-> false
// Transient: the host could not do its own half of the exchange this time.
RejectCode.HostFailed -> true
// Anything else, including a code this build has never heard of.
else -> reason.code.retryable
}Inheritors
Types
The host's AdmissionPolicy threw while deciding the joiner (#3220): the app's own lookup failed, say, or its own timeout fired. Retryable: nothing about the joiner was judged, and the policy may answer the next Hello. A policy that does not answer at all in time gets no Reject: the joiner's own admit deadline ends that attempt.
The joiner's proof of its device key failed (#3211): it was not signed by the key its Hello named, or it answered another challenge, room or host. Terminal: the same device answering the same way fails the same way.
The host could not do its own half of the key-proving exchange (#3211): signing its challenge, or checking the joiner's proof, failed on the host's platform. Retryable: the fault is the host's, and nothing about the joiner's credentials was judged.
The joiner claimed the peer id of a connected member under a different device key (#3159). Terminal: another device is using that id.
The joiner declared an admit-protocol version this host cannot speak — outside ProtocolVersion.MIN_SUPPORTED..ProtocolVersion.MAX_SUPPORTED (#1569). Terminal: retrying a version you don't support is futile; the peer must upgrade or downgrade its build. A joiner that sends no version (a peer predating the field) is refused with it too.
The joiner named a room this host does not serve. Terminal.
The joiner said Hello under a peer id whose seat another id of the same device took over, and under the key that was superseded (Decided 32, #3695). The Reject names the successor (AdmitMessage.Reject.supersededBy), and the joiner ends Left(self, LeaveReason.Superseded(by)) rather than an admission failure. Terminal: another process of this device holds the membership, and a Hello from this one would take it back.
A code this build does not know: a peer that predates typed codes (empty id), a newer build's addition, or another module's own code, such as one an app's AdmissionPolicy refused with.