fix(cartesia): redact API keys from websocket handshake errors - #2248
fix(cartesia): redact API keys from websocket handshake errors#2248rosetta-livekit-bot[bot] wants to merge 2 commits into
Conversation
🦋 Changeset detectedLatest commit: d6d1999 The changes in this PR will be included in the next version bump. This PR includes changesets to release 39 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Port verification: livekit/agents#6740 + #6759 → this PRCompared this PR's diff against both merged Python sources ( Verdict: Correct and careful redaction port. No confirmed correctness regressions in the error-wrapping/redaction logic itself. One real, if minor, parity gap: the ported Full analysisWhat #6759 actually changed (important context)
I verified this is not a missed behavioral port:
|
Summary
@livekit/agents-plugin-cartesia.Test plan
pnpm test agents(1587 passed, 5 skipped)pnpm test plugins/cartesia(9 passed, 2 skipped)pnpm --filter @livekit/agents buildpnpm --filter @livekit/agents lint(passes with pre-existing warnings)pnpm --filter @livekit/agents-plugin-cartesia buildpnpm --filter @livekit/agents-plugin-cartesia lintSource diff coverage
livekit-agents/livekit/agents/utils/connection_pool.py->agents/src/connection_pool.ts. agents-js already swallows prewarm rejection with.catch(() => {})and logs no exception content, so only the concise credential-safety comment from the follow-up source change was needed.livekit-plugins/livekit-plugins-cartesia/livekit/plugins/cartesia/_recognize_streams/auto_finalize_recognize_stream.py->plugins/cartesia/src/stt.ts. The sole agents-js Cartesia STT stream now maps HTTP handshake rejection toAPIStatusError, applies its configured handshake timeout, replaces transport error content with a safe error type, and includes the follow-up's concise credential-safety comments.livekit-plugins/livekit-plugins-cartesia/livekit/plugins/cartesia/_recognize_streams/legacy_recognize_stream.py. agents-js has no legacy Cartesia STT stream or legacy endpoint counterpart.livekit-plugins/livekit-plugins-cartesia/livekit/plugins/cartesia/tts.py->plugins/cartesia/src/tts.ts. Handshake status, timeout, and transport failures are converted to sanitized framework errors with the follow-up's concise credential-safety comments; agents-js already rethrowsAPIErrorbefore generic receive-error handling.tests/test_connection_pool.py->agents/src/connection_pool.test.ts. Node unhandled-rejection assertions replace Python task repr andcaplogassertions for both header and URL credential failures.tests/test_plugin_cartesia_tts.py->plugins/cartesia/src/tts.test.ts. Public stream tests use a local rejected WebSocket upgrade and a credential-bearing invalid URL to verify status mapping, sanitized error text, and absence of a JS error cause.Sources: livekit/agents#6740 and comment updates from livekit/agents#6759