[codex] fix rustls websocket provider panic#316
Merged
Conversation
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.
Closes #315
Summary
Issue #315 reports that Feishu WebSocket mode on Windows x86_64 starts normally, finishes authentication, and then panics as soon as the long connection tries to perform its TLS handshake. In practice that means the bot never finishes bringing up the Feishu WebSocket connection after the v0.1.31 upgrade.
Root Cause
The regression comes from the recent rustls upgrade in
de2a4c8.After that change, the WebSocket TLS path used by
tokio-tungsteniteresolves torustls 0.23, which now requires the process to have a concreteCryptoProviderinstalled before code reaches the default config builder path. In our dependency graph the provider was not unambiguously selected at runtime, so the released binary could panic with:Could not automatically determine the process-level CryptoProvider from Rustls crate features.Feishu was the user-visible failure in the issue report, but the same runtime trap also existed anywhere else we open secure WebSocket connections through the same stack, notably Slack Socket Mode and
microclaw gateway callagainst awss://endpoint.Fix
This PR makes the provider selection explicit instead of relying on rustls feature auto-detection.
It adds a direct
rustlsdependency with thering+stdfeatures enabled, introduces a smalltls::ensure_rustls_crypto_provider()helper, and calls that helper before WebSocket connections in Feishu, Slack, and the gateway client path. The helper is idempotent and treats an already-installed provider as success, so it is safe to reuse from multiple entry points without changing existing runtime behavior beyond preventing the panic.Validation
I verified the dependency feature resolution now includes the
ringprovider, added a unit test that exercises repeated provider initialization, and ran the full Rust test suite successfully withcargo test.