Skip to content

fix(server): bound live sideband websocket frames - #1398

Merged
Wibias merged 1 commit into
lidge-jun:devfrom
Wibias:agent/bound-live-sideband-frames
Aug 10, 2026
Merged

fix(server): bound live sideband websocket frames#1398
Wibias merged 1 commit into
lidge-jun:devfrom
Wibias:agent/bound-live-sideband-frames

Conversation

@Wibias

@Wibias Wibias commented Aug 10, 2026

Copy link
Copy Markdown
Collaborator

Supersedes #1381 (branch was accidentally reset during rebase).

  • Apply 50 MiB WebSocket frame ceiling to both directions of Live/Realtime sideband relays
  • Cap client frames retained while upstream connects at 32 frames and 1 MiB total
  • Raise macOS CI test timeout for 50 MiB frame relay test

Summary by CodeRabbit

  • Bug Fixes
    • Improved live connection stability by enforcing maximum WebSocket frame sizes.
    • Limited queued pending data to prevent excessive memory usage.
    • Oversized messages are now rejected and connections close gracefully.
    • Added support for accurately handling binary messages at the maximum allowed size.

Supersedes lidge-jun#1381. Rebased onto latest dev.

- Apply 50 MiB WebSocket frame ceiling to both directions
- Cap pending client frames at 32 frames and 1 MiB total
- Raise macOS CI test timeout for 50 MiB frame relay test
@github-actions

Copy link
Copy Markdown
Contributor

Deterministic PR hygiene checks passed.

@github-actions github-actions Bot added the bug Something isn't working label Aug 10, 2026
@coderabbitai

coderabbitai Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 6cb87ff6-d209-4d85-9b28-8de5ba6fb719

📥 Commits

Reviewing files that changed from the base of the PR and between dc4dd45 and bc5d253.

📒 Files selected for processing (3)
  • src/server/index.ts
  • src/server/ws-bridge.ts
  • tests/server-live.test.ts

📝 Walkthrough

Walkthrough

Live sideband WebSocket handling now enforces a 50 MiB frame limit and a 1 MiB pending-queue byte limit. It tracks queued bytes, resets accounting across lifecycle transitions, closes oversized connections with code 1009, and adds boundary-focused tests.

Changes

Live sideband WebSocket bounds

Layer / File(s) Summary
Limits and pending-byte state
src/server/index.ts, src/server/ws-bridge.ts
Adds shared frame and pending-byte predicates, byte-aware enqueue results, and WsData.livePendingBytes accounting.
Relay enforcement and lifecycle wiring
src/server/index.ts
Initializes and resets pending-byte state, applies MAX_WS_FRAME_BYTES to WebSocket payloads, and rejects oversized client or upstream frames with code 1009.
Frame and queue limit coverage
tests/server-live.test.ts
Tests exact limits, one-byte overflow, frame-count overflow, queue immutability after rejection, and maximum-size binary-frame relay behavior.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

Suggested reviewers: ingwannu, lidge-jun

Sequence Diagram(s)

sequenceDiagram
  participant Client
  participant LiveSideband as Live sideband relay
  participant Upstream
  Client->>LiveSideband: Send WebSocket frame
  LiveSideband->>LiveSideband: Check frame size
  LiveSideband->>Upstream: Forward or queue frame
  Upstream-->>LiveSideband: Send upstream frame
  LiveSideband->>LiveSideband: Check frame size
  LiveSideband-->>Client: Forward valid frame
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: bounding Live sideband WebSocket frames and traffic.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@Wibias
Wibias merged commit 2773540 into lidge-jun:dev Aug 10, 2026
24 of 25 checks passed
@Wibias
Wibias deleted the agent/bound-live-sideband-frames branch August 10, 2026 04:04
lidge-jun added a commit that referenced this pull request Aug 10, 2026
The A-phase audit of WP7 found the unit still described a train that had
stopped. Corrections:

- 011 records the re-pick to 9c05134 and voids the omission risk
  acceptance: #1398, #1396, and #1010 are all ancestors of the new RC, so
  nothing is being left out. Old-RC gate evidence is explicitly not reused.
- 012 states that the reviewed tree and the released tree differ only by
  012 itself, proves 0de4fd2 is a real ancestor, and marks the owner
  decision packet resolved rather than pending.
- 010 names the concrete clean main worktree and drops the stale
  out-of-scope line about #1398.

Also withholds the file path of SEC-03, which is still unfixed. Naming the
file of an open finding is the disclosure the rest of the record avoids;
the audit that reviewed these docs missed it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant