Skip to content

fix(relay): a relay text frame that is not an object no longer stops the PC's server - #2905

Closed
devswha wants to merge 1 commit into
feat/relay-pair-codefrom
fix/relay-null-frame
Closed

devswha wants to merge 1 commit into
feat/relay-pair-codefrom
fix/relay-null-frame

Conversation

@devswha

@devswha devswha commented Nov 5, 2026

Copy link
Copy Markdown
Owner

Fixes #2884

Stacked on #2883 (feat/relay-pair-code): the bug lives in server/relay/pair-code.ts, which only exists on that branch. When #2883 merges, this PR retargets to main.

Problem

In hold(), the PC parsed each text frame the relay sends on a pairing host socket and read .type on the result without checking that it was an object. A null frame from the relay threw a TypeError inside the WebSocket message listener. Nothing in server/ catches that error, so the Ovis server exited. The relay is treated as untrusted (docs/relay.md).

Fix

Values parsed from the relay that are not plain objects are now ignored, the same way relay/pair-room.ts already handles the host's text.

Validation

  • New test in server/relay/pair-code.test.ts: it sends null, 1 and [] on the host socket and expects the code to stay showing. Before the fix it fails with TypeError: null is not an object (evaluating 'message.type') at pair-code.ts:153. After the fix it passes. bun test ./server/relay/pair-code.test.ts gives 5 pass.
  • bun run check fast passed (run on the heavy runner).

…the PC's server

The pairing host socket read .type on whatever JSON.parse returned, so a
null frame from the relay threw inside the message listener and the Ovis
server exited. Ignore parsed values that are not plain objects, as
relay/pair-room.ts does for the host's text.

Fixes #2884
@coderabbitai

coderabbitai Bot commented Nov 5, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@devswha

devswha commented Nov 5, 2026

Copy link
Copy Markdown
Owner Author

Folded into #2883: this fix (530019d) was cherry-picked there as a2cf452, together with its test in server/relay/pair-code.test.ts. #2884 closes when #2883 merges. Closing this one; the fix/relay-null-frame branch stays until a2cf452 is on #2883's head.

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