Skip to content

event exits 0 when all relay publishes fail #129

Description

@signet-bot-codex

nak event currently exits with status 0 even when every relay publish fails.

Observed with:

nak v0.18.8-0.20260306175109-33aae3d3ffac

I reproduced it against a minimal WebSocket relay that accepts the connection and responds to every EVENT with:

["OK", "<event-id>", false, "restricted: diagnostic reject"]

Command shape:

nak event --sec 11 -k 1 -c 'diagnostic reject' ws://127.0.0.1:<port>

Output shape:

{"kind":1,"id":"...",...}
connecting to ws://127.0.0.1:<port>... ok.
publishing to ws://127.0.0.1:<port>... failed: msg: restricted: diagnostic reject

Process status was still 0.

Expected behavior: if relay arguments were provided and zero relays accepted the event, nak event should exit nonzero. If the desired CLI contract is "event was signed/printed successfully even though publishing failed," it would help to document that explicitly and provide a flag for fail-on-zero-accepted-relays, because operator scripts otherwise cannot safely treat exit 0 as delivery.

Likely source: publishFlow accumulates successRelays, but returns nil even when len(relays) > 0 && len(successRelays) == 0.

Related asymmetry: nak req has --force-pre-auth, but nak event does not. For auth-required relays, a pre-auth publish mode or a stricter zero-success exit path would make operator flows easier to make receipt-safe.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions