Skip to content

FIX: RealtimeTarget converts mixed-case HTTPS:// endpoints to wss:// - #4804

Queued
Akshay Hitesh Shah (AkshayShah03) wants to merge 3 commits into
microsoft:mainfrom
AkshayShah03:fix/realtime-https-scheme-case
Queued

Akshay Hitesh Shah (AkshayShah03) wants to merge 3 commits into
microsoft:mainfrom
AkshayShah03:fix/realtime-https-scheme-case

Conversation

@AkshayShah03

Copy link
Copy Markdown
Contributor

Description

Fixes #4785. RealtimeTarget now treats the endpoint scheme case-insensitively (RFC 3986 §3.1), so HTTPS://... becomes wss://... like https://... already did. This is the same kind of fix #4601 / #4603 made for the MCP config and HTTPTarget.

  • New helpers _url_scheme and _to_websocket_url in openai_realtime_target.py. _to_websocket_url rewrites an https or wss scheme in any case to wss:// and leaves other schemes alone.
  • _get_openai_client and _validate_url_for_target use _to_websocket_url, so the websocket URL is valid and the "should use 'wss://' or 'https://' scheme" warning no longer fires for HTTPS://.
  • _warn_if_irregular_realtime_endpoint checks the scheme with _url_scheme and matches its patterns with re.IGNORECASE. Nothing calls it right now; I changed it so it stays consistent if it gets called again.
  • New tests: HTTPS://, Https:// and WSS:// endpoints all produce a wss:// websocket_base_url with no scheme warning, and the irregular-endpoint check doesn't warn on an uppercase scheme. 5 of the 6 cases fail on main; the lowercase https:// case is a control.

Disclosure: this change and its tests were written with the help of an AI coding assistant (Claude). The prompt_target unit suite passes locally.

Copilot AI balanced review requested due to automatic review settings December 2, 2026 12:12

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues remain for the mixed-case HTTPS/WSS scheme handling changes.

No open issues 🎉

What changed in this PR

Fixes #4785 by making RealtimeTarget accept mixed-case HTTPS and WSS schemes, consistent with earlier HTTP scheme fixes.

Changes:

  • Normalizes supported schemes to wss:// for validation and client creation.
  • Makes irregular-endpoint checks case-insensitive.
  • Adds regression tests for URL conversion and warning behavior.
File Description
tests/​unit/​prompt_target/​target/​test_realtime_target.py Tests mixed-case schemes and absence of spurious warnings.
pyrit/​prompt_target/​openai/​openai_realtime_target.py Adds scheme-normalization helpers and updates endpoint checks and client creation.

Review effort: Balanced

@romanlutz Roman Lutz (romanlutz) self-assigned this Dec 3, 2026

This branch has not been deployed

No deployments
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.

BUG: RealtimeTarget does not convert an uppercase HTTPS:// endpoint to wss://

3 participants