fix(e2ee): revert to PR #904 branch, add MAT-144 diagnostics
PR #921 requires custom WebRTC build not yet available. Added diagnostic logging: encryption_type per track, frame_cryptors count, and DEC_FAILED re-keying cooldown (5s) to reduce log spam. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
19
voice.py
19
voice.py
@@ -671,14 +671,12 @@ class VoiceSession:
|
||||
|
||||
@self.lk_room.on("track_subscribed")
|
||||
def on_ts(t, pub, p):
|
||||
logger.info("Track sub: %s %s kind=%s muted=%s", p.identity, pub.sid, t.kind, pub.muted)
|
||||
# NOTE: Do NOT create rtc.AudioStream here — it competes with AgentSession's
|
||||
# internal audio pipeline for event loop time, causing intermittent VAD failures
|
||||
# (user_state stuck on "away"). See MAT-40. Use e2ee_state_changed for flow confirmation.
|
||||
# MAT-144: Pre-derive HKDF in Python, pass derived key with KDF_RAW.
|
||||
# This ensures exact HKDF match with Element Call JS for both audio AND video.
|
||||
# MAT-144: Log encryption_type to diagnose frame cryptor creation
|
||||
enc_type = getattr(pub, 'encryption_type', 'N/A')
|
||||
logger.info("Track sub: %s %s kind=%s muted=%s enc_type=%s source=%s",
|
||||
p.identity, pub.sid, t.kind, pub.muted, enc_type,
|
||||
getattr(pub, 'source', 'N/A'))
|
||||
# Store video track for on-demand vision (look_at_screen tool)
|
||||
# Screen share = source "screen_share" or "screenshare"; camera = "camera" or default
|
||||
if int(t.kind) == 2: # video track (LiveKit: 1=audio, 2=video)
|
||||
track_source = getattr(pub, 'source', None) or "unknown"
|
||||
self._video_track = t
|
||||
@@ -690,6 +688,13 @@ class VoiceSession:
|
||||
track_type, caller_id, len(self._caller_all_keys))
|
||||
try:
|
||||
kp_local = self.lk_room.e2ee_manager.key_provider
|
||||
# MAT-144: Log frame cryptors count for diagnostics
|
||||
try:
|
||||
fc_map = self.lk_room.e2ee_manager.frame_cryptors()
|
||||
logger.info("E2EE_DIAG: frame_cryptors count=%d keys=%s",
|
||||
len(fc_map), list(fc_map.keys()) if fc_map else [])
|
||||
except Exception:
|
||||
logger.info("E2EE_DIAG: frame_cryptors() not available")
|
||||
if self._caller_all_keys:
|
||||
for idx, base_k in sorted(self._caller_all_keys.items()):
|
||||
_derive_and_set_key(kp_local, caller_id, base_k, idx)
|
||||
|
||||
Reference in New Issue
Block a user