Skip to content

fix(desktop): preserve early relay auth challenges - #3320

Open
tlongwell-block wants to merge 1 commit into
mainfrom
mari/fix-first-send-community-switch
Open

fix(desktop): preserve early relay auth challenges#3320
tlongwell-block wants to merge 1 commit into
mainfrom
mari/fix-first-send-community-switch

Conversation

@tlongwell-block

Copy link
Copy Markdown
Collaborator

Summary

  • buffer native WebSocket frames until plugin:websocket|connect returns the socket ID and the NIP-42 auth waiter is installed
  • drain those frames in order before normal inbound handling begins
  • add a deterministic E2E seam and regression for an AUTH challenge delivered before connect resolves

Root cause

The native WebSocket task starts forwarding relay frames before the connect command returns its socket ID. Buzz relay sends the NIP-42 AUTH challenge immediately on connection, so Desktop could process that challenge while wsId and authRequest were still unset. The challenge was discarded, the cold connection failed authentication, and the first plain-text send failed. Channel history still appeared because it loads through the Tauri channel-window command rather than this frontend WebSocket.

Verification

  • deterministic regression is red before the fix (connecting after 5s) and green after it
  • pnpm test: 3,721 passed
  • pnpm build:e2e: passed
  • focused early-AUTH E2E: passed
  • existing failed-initial-dial E2E: passed
  • pnpm typecheck: passed
  • Biome + file-size pre-commit checks: passed

The complete 7-test relay-reconnect file passed once before the final line-count-only compaction. After that compaction, two full-file reruns each had the same unrelated startup-seam flake in the existing initial-dial test; both the new test and that existing test pass independently at the committed HEAD.

Co-authored-by: npub1jh9wn95s0472h86ahapupaf7m6kx4v9sx2n0atj2hltcfer8k06s5n3pyf <95cae996907d7cab9f5dbf43c0f53edeac6ab0b032a6feae4abfd784e467b3f5@buzz.block.builderlab.xyz>
Signed-off-by: npub1jh9wn95s0472h86ahapupaf7m6kx4v9sx2n0atj2hltcfer8k06s5n3pyf <95cae996907d7cab9f5dbf43c0f53edeac6ab0b032a6feae4abfd784e467b3f5@buzz.block.builderlab.xyz>
@tlongwell-block
tlongwell-block requested a review from a team as a code owner July 28, 2026 14:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant