Skip to content

fix(buzz): bound NIP-11 relay information responses - #119182

Merged
steipete merged 1 commit into
openclaw:mainfrom
zhangguiping-xydt:fix/problem-buzz-relay-info-bounded-json
Aug 25, 2026
Merged

steipete merged 1 commit into
openclaw:mainfrom
zhangguiping-xydt:fix/problem-buzz-relay-info-bounded-json

Conversation

@zhangguiping-xydt

@zhangguiping-xydt zhangguiping-xydt commented Aug 4, 2026 •

Copy link
Copy Markdown
Contributor
Additional instructions

MUST: Keep Allow edits from maintainers enabled for this PR so maintainers
can help update the branch when needed.

What Problem This Solves

Fixes an issue where enabling Buzz against a relay with an oversized NIP-11 information response could make the Gateway buffer the response without a limit. Malformed or non-object relay information could also surface a raw JavaScript error instead of a stable Buzz diagnostic.

Why This Change Was Made

Buzz relay discovery now uses the existing shared provider JSON object reader, which bounds response reads at 16 MiB and normalizes malformed or non-object documents. This keeps the limit, shape validation, and cancellation behavior aligned with the canonical HTTP response helper rather than adding a Buzz-specific parser or policy.

User Impact

Gateways stop reading oversized Buzz relay-information responses, remain running, and report clear bounded-response or malformed-JSON errors. JSON primitives and arrays are rejected as malformed NIP-11 documents, while valid objects continue through the existing relay-key validation path.

Evidence

Focused regression tests (6 files, 27 tests):

Test Files  6 passed (6)
     Tests  27 passed

Real Gateway proof using the development Gateway starter and a loopback HTTP/WebSocket relay that performs NIP-42 authentication before serving NIP-11 information:

LIVE trigger mode=oversized gateway=real relay=http+websocket nip11_requests=1
LIVE transition mode=oversized gateway_ready=true nip42_authenticated=true auth_frames=1
LIVE transition mode=oversized nip11_client_closed=true bytes_sent=20381786 response_completed=false
LIVE outcome mode=oversized gateway_alive=true error="Buzz relay information: JSON response exceeds 16777216 bytes"
LIVE trigger mode=malformed gateway=real relay=http+websocket nip11_requests=1
LIVE transition mode=malformed gateway_ready=true nip42_authenticated=true auth_frames=1
LIVE transition mode=malformed nip11_response_bytes=8 response_completed=true
LIVE outcome mode=malformed gateway_alive=true error="Buzz relay information: malformed JSON response"

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. P2 Normal backlog priority with limited blast radius. labels Aug 4, 2026
@clawsweeper

clawsweeper Bot commented Aug 4, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 19, 2026, 2:45 PM ET / 18:45 UTC.

ClawSweeper review

What this changes

The PR makes Buzz validate relay NIP-11 metadata through the shared bounded JSON-object reader and updates relay-fetch tests to use real Response bodies.

Regression provenance

Possible regression — suspected (reviewed change). No predecessor PR is attributed.

Merge readiness

⚠️ Ready for maintainer review - 4 items remain

Keep open. Current main still fully buffers Buzz relay metadata; the patch uses the existing canonical bounded reader and has no correctness finding, but maintainers should explicitly accept the new 16 MiB compatibility boundary and refresh the behind branch before merge.

Priority: P2
Reviewed head: 6d8b2319b6c82091d8d1f9492cfebe081f207378
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The focused implementation and real after-fix trace are strong; only an explicit compatibility decision and normal exact-head refresh remain.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): The PR body records after-fix Gateway runs against a loopback HTTP/WebSocket relay, showing early oversized-response closure, stable malformed-JSON diagnostics, and a surviving Gateway.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The PR body records after-fix Gateway runs against a loopback HTTP/WebSocket relay, showing early oversized-response closure, stable malformed-JSON diagnostics, and a surviving Gateway.
Evidence reviewed 6 items Current-main defect: Current main still directly calls response.json() for relay metadata, with no response-size bound or shared malformed-object normalization.
PR owner-boundary change: The PR replaces only that direct parse with the public shared provider HTTP reader while retaining SSRF checks, key validation, and cleanup.
Shared reader contract: The shared helper enforces the 16 MiB default, cancels overflow reads, and rejects malformed, null, array, and primitive JSON before Buzz key validation.
Findings None None.
Security None None.

Live Verification

Command: pnpm openclaw --help

Result: FAIL (failed) — execution before step 1 run: live-proof package manager pnpm is unavailable after its official installer (curl -fsSL https://get.pnpm.io/install.sh | sh -): command failed without output

live-proof package manager pnpm is unavailable after its official installer (curl -fsSL https://get.pnpm.io/install.sh | sh -): command failed without output

Assertions:

  • FAIL expect_output: Usage:

How this fits together

Buzz Gateway startup authenticates with a relay and fetches its NIP-11 metadata before verifying relay identity and discovering rooms. This parsing step feeds all authenticated Buzz session consumers, including normal bus startup and room discovery.

flowchart LR
  A[Gateway starts Buzz account] --> B[Authenticate with relay]
  B --> C[Fetch NIP-11 metadata]
  C --> D[Bounded JSON-object reader]
  D --> E[Validate relay identity]
  E --> F[Discover rooms and deliver messages]
Loading

Decision needed

Question Recommendation
Should Buzz reject otherwise valid existing NIP-11 relay metadata once it exceeds the shared 16 MiB response limit? Accept the shared size ceiling: Merge after recording that relay metadata above 16 MiB is unsupported and must fail setup.

Why: The parser choice is architecturally sound, but changing acceptance for already configured relays is an operator-facing compatibility policy decision.

Before merge

  • Resolve merge risk (P1) - Merging changes any relay with an otherwise valid NIP-11 object over 16 MiB from accepted metadata to a Buzz setup failure.
  • Resolve merge risk (P1) - The branch is behind main; rebase or refresh the exact head and required checks before merge.
  • Complete next step (P2) - Maintainer acceptance of the oversized-metadata compatibility tradeoff is required before the normal branch refresh and merge checks.
Agent review details

Security

None.

PR surface

Source -2, Tests +62. Total +60 across 8 files.

View PR surface stats
Area Files Added Removed Net
Source 1 2 4 -2
Tests 7 111 49 +62
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 8 113 53 +60

Review metrics

Metric Value Why it matters
Production versus test delta production +2/-4, tests +111/-49 Production replaces a local parser with an existing SDK helper; the larger test delta provides real Response fixtures and boundary regression coverage.

Stored data model

Persistent data-model change detected: serialized state: extensions/buzz/src/buzz-bus.archived-rooms.test.ts, serialized state: extensions/buzz/src/buzz-bus.history-catchup.test.ts, serialized state: extensions/buzz/src/buzz-bus.lifecycle.test.ts, serialized state: extensions/buzz/src/buzz-bus.mentions.test.ts, serialized state: extensions/buzz/src/directory.test.ts, serialized state: extensions/buzz/src/qa/relay-client.test.ts, and 1 more. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Accept the bounded metadata contract (recommended)
    Approve the 16 MiB limit for Buzz NIP-11 metadata, then refresh the branch and recheck the exact head.
  2. Preserve legacy relay acceptance
    Do not merge this limit until a different upgrade-safe metadata policy is selected.

Technical review

Best possible solution:

Adopt the shared bounded-reader path as the sole parser after explicitly accepting 16 MiB as Buzz’s supported relay-metadata ceiling.

Do we have a high-confidence way to reproduce the issue?

Yes. Current main’s direct response.json() call provides a clear source path, and the PR supplies focused boundary tests plus an after-fix loopback Gateway/relay trace.

Is this the best way to solve the issue?

Yes, conditionally. Reusing the shared reader at the authenticated relay-session owner avoids Buzz-specific duplicate parsing; only the 16 MiB compatibility policy needs maintainer acceptance.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 5976e74d1cc8.

Labels

Label justifications:

  • P2: This fixes a bounded startup reliability problem in the optional Buzz channel surface.
  • merge-risk: 🚨 compatibility: A valid relay metadata document exceeding 16 MiB will newly fail Buzz setup.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The PR body records after-fix Gateway runs against a loopback HTTP/WebSocket relay, showing early oversized-response closure, stable malformed-JSON diagnostics, and a surviving Gateway.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body records after-fix Gateway runs against a loopback HTTP/WebSocket relay, showing early oversized-response closure, stable malformed-JSON diagnostics, and a surviving Gateway.

Evidence

What I checked:

Likely related people:

  • Shakker: Refactored the Buzz authenticated relay setup and later bounded relay-session setup in the central auth path. (role: recent relay-session owner; confidence: high; commits: b9eec01e7705, f1e049b08655; files: extensions/buzz/src/relay-auth.ts)
  • Patrick Erichsen: Introduced the Buzz channel plugin that owns this relay-discovery path. (role: original Buzz plugin author; confidence: medium; commits: aa0d3192d270; files: extensions/buzz/src/relay-auth.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Record maintainer acceptance of the 16 MiB NIP-11 metadata ceiling.
  • Refresh the behind branch and obtain exact-head review/check status.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (8 earlier review cycles)
  • reviewed 2026-08-04T11:04:15.490Z sha 50d5c1d4d408ddaec3ce0858b63149ce208e3c43 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-04T11:13:16.035Z sha 50d5c1d4d408ddaec3ce0858b63149ce208e3c43 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-04T17:05:03.178Z sha 0880069d66d8385302043136deba832d2ef7ff15 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-04T17:32:47.303Z sha 0880069d66d8385302043136deba832d2ef7ff15 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-05T01:03:18.876Z sha 6953d2220184bce75bc52c9cbb44b6a88da86723 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-05T23:42:20.818Z sha 6953d2220184bce75bc52c9cbb44b6a88da86723 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-07T06:50:13.516Z sha 6d8b2319b6c82091d8d1f9492cfebe081f207378 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-15T16:47:56.991Z sha 6d8b2319b6c82091d8d1f9492cfebe081f207378 :: needs maintainer review before merge. :: none

@clawsweeper clawsweeper Bot added merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Aug 4, 2026
@zhangguiping-xydt
zhangguiping-xydt force-pushed the fix/problem-buzz-relay-info-bounded-json branch from 6953d22 to 6d8b231 Compare August 7, 2026 06:21
@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. labels Aug 15, 2026
Reject malformed relay metadata and cancel oversized response streams at the existing 16 MiB provider boundary.

Co-authored-by: zhang-guiping <[email protected]>
@steipete
steipete force-pushed the fix/problem-buzz-relay-info-bounded-json branch from 6d8b231 to 8ae37b0 Compare August 25, 2026 23:00
@steipete
steipete merged commit b0526f7 into openclaw:main Aug 25, 2026
177 checks passed
@steipete

Copy link
Copy Markdown
Contributor

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 26, 2026
Reject malformed relay metadata and cancel oversized response streams at the existing 16 MiB provider boundary.

Co-authored-by: Peter Steinberger <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: buzz merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants