test(app): keep hearing a speaker across DAVE group changes, and record the Rust decision
- Live test: the speaker leaves and rejoins three times; each time its sentence is heard exactly under the new SSRC (songbird issue #310 reports receive stalls after group changes; not reproduced). - decisions.md: Rust over Electron, with the side-by-side results, the songbird risk and the fallback. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -170,13 +170,15 @@ registered until it is removed (M5 setup).
|
||||
voice channel with the real worker on the GPU. It refuses to run if a person is in the channel or
|
||||
either bot is already in a voice channel, and cleans up even when a step fails. It checks command
|
||||
registration, transcription of recorded sentences played into the channel, speech the other bot
|
||||
hears and the STT reads back, stop, chat events, history, sending without pings, and leaving.
|
||||
hears and the STT reads back, stop, chat events, history, sending without pings, the speaker
|
||||
leaving and coming back three times (each a DAVE group change), and leaving.
|
||||
Measured on this server's RTX 5050 (2026-11-11): five sentences all heard (character error rate 0%
|
||||
for three, 5% and 12.5% for two), 0.71-0.90 s from the end of speech to the final, Jarvis's speech
|
||||
read back at 3.4%, sound gone 0.08 s after stop.
|
||||
read back at 3.4-6.9%, sound gone 0.03-0.08 s after stop, and the sentence heard exactly after each
|
||||
of three rejoins.
|
||||
|
||||
## Known risks
|
||||
|
||||
- songbird issue #310 (open): receive can stall after a DAVE (MLS) group change on some joins. The live
|
||||
test covers one change (the second bot joining); channels where many people come and go need a
|
||||
longer check before M4.
|
||||
test covers four changes (the second bot joining, then leaving and rejoining three times) without a
|
||||
stall; a channel where many people come and go over hours still needs a longer check before M4.
|
||||
|
||||
@@ -331,7 +331,38 @@ async fn discord_voice_core_on_real_discord() {
|
||||
tokio::time::sleep(Duration::from_millis(500)).await;
|
||||
assert!(!events.lock().unwrap().iter().any(|e| matches!(e, CoreEvent::Chat(c) if c.content == reply)));
|
||||
|
||||
// 6. Leaving.
|
||||
// 6. Group changes: every join and leave changes the DAVE (MLS) group, and songbird has an open
|
||||
// report of receive stalling after one (issue #310). The speaker leaves and comes back three
|
||||
// times and must still be heard each time, under its new SSRC.
|
||||
let wav = std::fs::read(samples.join("ko_03.wav")).unwrap();
|
||||
let reference = refs["samples"][2]["text"].as_str().unwrap().to_owned();
|
||||
let mut rejoins = vec![];
|
||||
for round in 0..3 {
|
||||
speaker_songbird.remove(GuildId::new(guild)).await.unwrap();
|
||||
tokio::time::sleep(Duration::from_secs(2)).await;
|
||||
let call = speaker_songbird.join(GuildId::new(guild), ChannelId::new(voice)).await.expect("speaker rejoins");
|
||||
tokio::time::sleep(Duration::from_secs(1)).await;
|
||||
let before = events.lock().unwrap().len();
|
||||
let (etx, mut erx) = mpsc::unbounded_channel();
|
||||
let track = call.lock().await.play_only_input(Input::from(wav.clone()));
|
||||
track.add_event(Event::Track(TrackEvent::End), Ended(etx)).unwrap();
|
||||
tokio::time::timeout(Duration::from_secs(20), erx.recv()).await.expect("track end");
|
||||
let got = |evs: &[CoreEvent]| evs.iter().filter_map(|e| match e {
|
||||
CoreEvent::Final(f) if f.heard.speaker_id == speaker_id && !f.text.is_empty() => Some(f.text.clone()),
|
||||
_ => None,
|
||||
}).collect::<Vec<_>>();
|
||||
let deadline = Instant::now() + Duration::from_secs(10);
|
||||
while got(&events.lock().unwrap()[before..]).is_empty() && Instant::now() < deadline {
|
||||
tokio::time::sleep(Duration::from_millis(50)).await;
|
||||
}
|
||||
tokio::time::sleep(Duration::from_millis(800)).await;
|
||||
let hyp = got(&events.lock().unwrap()[before..]).join(" ");
|
||||
rejoins.push(json!({"round": round, "hyp": hyp, "cer": cer(&reference, &hyp)}));
|
||||
}
|
||||
report.insert("rejoins".into(), Value::from(rejoins.clone()));
|
||||
assert!(rejoins.iter().all(|r| r["cer"].as_f64().unwrap() < 0.15), "not heard after a rejoin: {rejoins:?}");
|
||||
|
||||
// 7. Leaving.
|
||||
assert!(core.leave("command").await);
|
||||
until("Jarvis to leave", 10_000, || {
|
||||
s_cache.guild(GuildId::new(guild)).and_then(|g| g.voice_states.get(&UserId::new(jarvis)).and_then(|v| v.channel_id)).is_none()
|
||||
|
||||
Reference in New Issue
Block a user