slice-4 (dev-a): MediaThread + session_map rewire (Task 6 + 7) #12

Merged
alee merged 3 commits from slice-4-dev-a-reflex into main 2026-07-04 04:37:32 +00:00

3 Commits

Author SHA1 Message Date
f5fd4d4d71 feat(binary): rewire session_map + routes + main to MediaThread command channel (slice-4 §4.3)
All checks were successful
CI / fmt (pull_request) Successful in 1m33s
CI / clippy (pull_request) Successful in 2m29s
CI / test (1.85) (pull_request) Successful in 4m16s
CI / test (stable) (pull_request) Successful in 6m5s
CI / deny (pull_request) Successful in 2m18s
AppState now holds cmd_tx: Sender<MediaCmd> instead of DashMap<...>.

create_session/accept_offer/close route via the command channel

(cold-path only). main.rs spawns the MediaThread + shuts it down on

graceful exit.

Also update api_integration.rs to wire a real MediaThread (AppState::new

now takes the sender), and remove the function-call hangup dispatch test

from realtime_integration.rs: that path relied on the removed

drive_all_sessions poll-task architecture.

Signed-off-by: Aaron D. Lee <himself@adlee.work>
2026-07-03 23:51:23 -04:00
c645eb2ca3 feat(binary): MediaThread — dedicated std::thread for the 20ms loop (slice-4 §4)
ARCHITECTURE.md mandate ("never the shared tokio pool") finally landed.
One std::thread owns all RtcSessions exclusively; axum routes via command
channel (Register/AcceptOffer/Delete/Shutdown). The Reflex<TapAudioPipe>
wrapper is wired here on Connected via RtcSession::set_pipe. loop_driver +
rtc_session untouched (seam holds).

Signed-off-by: Aaron D. Lee <himself@adlee.work>
2026-07-03 22:27:35 -04:00
86d55c3e67 test(slice-4): primary-path barge-in e2e — local VAD kills playout without brain
This integration test proves wedge #1: loud synthetic caller audio
(samples = 1000, well above VAD_RMS_THRESHOLD = 500.0) sent through
LocalVadReflex<Reflex<TapAudioPipe>> trips the local VAD and kills
playout within one tick, without any brain advisory.

Cites README:98-100 and ARCHITECTURE.md:79-81 ("local reflexes that
don't need the brain"); see slice-4 spec §3.4, §6.1, and §7
done-criteria #8.

Signed-off-by: Aaron D. Lee <himself@adlee.work>
2026-07-03 21:45:46 -04:00