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:
javis-bot
2026-11-11 12:03:41 +09:00
parent f25c26cf53
commit 5efa760986
3 changed files with 39 additions and 6 deletions

View File

@@ -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.

View File

@@ -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()

View File

@@ -9,7 +9,7 @@
| 백그라운드 수집 대상 | 기본은 비워 둠. 요청이 있을 때 추가 |
| Go Live 송출(셀프봇) | 뺌. 대신 봇용 크롬창 화면공유 선택 표시 설정 ([pc-features.md](pc-features.md#봇용-크롬창과-디스코드-화면공유)) |
| 저장소 처리 | v1 마지막 상태(`bb60c4d`)를 원격 저장소 `legacy` 브랜치로 보존하고 같은 저장소에서 v2 시작. v1 README는 [docs/v1/README.md](../v1/README.md)로 옮김 |
| 관리 앱 언어 | Rust. 화면(M5)은 Tauri 2로 Windows 기본 WebView2에 그림. 처음 정한 Electron + TypeScript보다 빠르고 가벼운 진짜 앱으로 만들기 위해 바꿈(사용자 결정, 2026-11-11). M2 음성 코어는 Rust로 다시 씀 ([architecture.md](architecture.md#기술-선택과-이유)) |
| 관리 앱 언어 | Rust. 화면(M5)은 Tauri 2로 Windows 기본 WebView2에 그림(2026-11-11, 사용자가 맡긴 판단). 같은 M2 음성 코어를 Electron과 Rust로 둘 다 만들어 실제 디스코드에서 비교함: 받아 적기·말하기·정지 결과는 같았고, Rust는 실행 파일 하나에 메모리 약 16MB(Electron은 프로세스 5개, 크로미움 GPU 프로세스 포함)라 게임과 함께 돌리는 이 앱에 맞음. 게임 감지, 화면 캡처, 입력, 프로세스 우선순위(M7)도 Windows API를 바로 부를 수 있음. 약점은 Rust 디스코드 음성 라이브러리(songbird)가 덜 검증된 점: DAVE 수신 해독 버그는 앱이 직접 해독해 피했고, 그룹이 바뀐 뒤 받기가 멈춘다는 보고(#310)는 들어왔다 나가기 3번 시험에서 재현되지 않음. 몇 시간짜리 시험에서 멈추면 그 부분만 discord.js 보조 프로세스로 돌리는 것을 예비안으로 둠 ([architecture.md](architecture.md#기술-선택과-이유)) |
| 호출 방식 기본값 | 호출어로 부를 때만 응답 |
| 지정한 사람 설정 | "지정한 사람만 응답"과 "지정한 사람은 호출어 없이 대답"을 각각 켜기/끄기. 기본은 둘 다 꺼짐 ([conversation.md](conversation.md#호출어와-호출-방식)) |
| 동시 대화 응답 정책 기본값 | 처음 대화만 |