fix(ws): null-safe relay URI logging + 2.0.1 release#523
Merged
Conversation
NostrRelayClient previously logged via clientSession.getUri(), which
can return null after the WebSocket session has been closed. In
staging, this surfaced as 188 occurrences in 2 hours of:
Sending request to relay null: ["CLOSE","sub-..."]
Capture the relay URI at construction time and store it in a
final field. Use that field for all logging instead of querying
the session, so log messages remain meaningful regardless of session
state. The package-private (WebSocketSession, long) constructor used
by tests still attempts to derive the URI from the session.
No behaviour change beyond logging; all 13 nostr-java-client tests
still pass.
Refs: docs/analysis-gateway-core-relay-client-circuitbreaker-2026-05-06.md §4
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Includes the relayUri null-safety fix from 4cdd556.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ae14d8deab
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Addresses Codex review on PR #523 — repository's AGENTS.md guideline requires CHANGELOG.md updates for every version bump.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
NostrRelayClientwas loggingSending request to relay null: …(188 occurrences in a 2-hour window of staging logs) because the log statement readclientSession.getUri(), which returnsnullonce the WebSocket session has closed.private final String relayUriset in each constructor; replace 8clientSession.getUri()log call-sites.Background
Surfaced during investigation of staging incident
as_1e9d265bf1c24d04(2026-05-05). Full analysis lives in the consumer repo atimani-apps/docs/analysis-gateway-core-relay-client-circuitbreaker-2026-05-06.md. The original §2 recommendation (singleton-per-relay refactor) turned out to be a no-op — the multiplexing is already in place. The §4 fix in this PR stands on its own merits.Test plan
./mvnw -pl nostr-java-client test— 13 tests pass locally.to relay nulllog lines in staging afterimani-bombumps to 2.0.1 and downstream services redeploy.🤖 Generated with Claude Code