Repository navigation
fix(llm): pick the rustls crypto provider for WebSockets explicitly - #321
Merged
Merged
Conversation
reqwest enables rustls' aws-lc-rs provider and GPUI's reqwest fork enables ring. With both compiled in, rustls cannot choose a process-wide default, and tokio-tungstenite, which builds its TLS config from that default, panicked on every wss:// connect. Voice mode never started. The realtime and Responses WebSocket connections now go through utils::connect_websocket, which builds the rustls config with aws-lc-rs (the provider reqwest uses for HTTPS) and the same roots as before. Fixes #319
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.
Fixes #319
Problem
Voice mode panicked while opening its WebSocket:
reqwest enables rustls'
aws-lc-rsprovider and GPUI's reqwest fork enablesring. With both compiled in, rustls cannot pick a process-wide default, and tokio-tungstenite builds its TLS config from that default. So everywss://connect panicked. The Responses API WebSocket used the same API and had the same problem.Fix
llm::utils::connect_websocket: forwss://URLs it builds the rustlsClientConfigwithaws-lc-rs(the provider reqwest uses for HTTPS). It loads the same roots tokio-tungstenite loaded before: native ones withtls-native-roots, the embedded Mozilla ones withtls-webpki-roots.wss://simply isn't available there, as before.Tests
secure_connect_does_not_depend_on_a_default_crypto_provider. It compiles both providers in (ringas a dev-dependency) and connectswss://to a local socket that drops the connection. It panicked with the message from the issue before the fix and returns an error now.cargo fmt, workspaceclippy -D warnings,cargo deny checkand workspace tests pass. clippy and the new test also pass with the other llm TLS feature combinations.wss://endpoint completed the handshake with the new config.