Status API: report who is speaking (#732) #733

Closed
charles wants to merge 0 commits from fix-732-status-api-speaking into textchat
Owner

Closes #732

Cause

crates/fluxer-core/src/selectors/voice_status.rs hard-coded let speaking = false; (deferred in Voice 11, #115 item 2, before the live room was in the store). The status server and the runtime were fine: the runtime already publishes voice_status after every applied event and the server pushes only when the JSON changes, so speaking only had to come out of the selector.

Fix

  • speaking per connection from Voice::connection_speaking, the same source as the sidebar ring: LiveKit active speakers or the audio level, this client's processed microphone for its own connection, false while the connection shows as muted (self mute, server mute, suppress), OR-ed across a user's devices.
  • Push behaviour matches the original (StatusApi.ts + DesktopVoiceStatusBridge.ts): no throttle or coalescing, a push on every structural change (JSON dedupe), and slow readers are dropped (ours: 64 queued messages / 15 s write timeout; the original: 1 MiB of buffered writes).
  • avatarUrl (#115 item 3): the member's avatar for the guild when set (getGuildMemberDisplayAvatarURL), null when unset for the guild (AVATAR_UNSET), otherwise the user's avatar. Users with a default avatar still get null: the original gives its web build's content-hashed asset URL, which this client has no equivalent for.
  • docs/acceptance/voice.md updated.

Verification

  • New core tests (crates/fluxer-core/tests/voice_status.rs): status_payload_reports_the_active_speaker, status_payload_muted_speaker_is_not_speaking, status_payload_ors_speaking_across_devices, status_payload_reports_the_local_user_speaking, status_payload_avatar_is_the_guild_member_avatar. All 5 failed before the fix.
  • Status API: speaking_change_is_pushed_at_once_and_shown_on_get (20 toggles, each pushed to a WebSocket client and seen on GET; slowest push about 0.1 ms).
  • apps/fluxer/tests/voice_acceptance.rs: the tripwire assertion is flipped. A WebSocket client now has to see ada start and stop speaking, and the local user speaking, within 250 ms of the window snapshot showing it. Measured: about 0.1 ms (89 to 113 µs over 3 runs). It failed with speaking = false restored.
  • FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci: all steps passed. LiveKit interop was skipped because FLUXER_LIVEKIT_TESTS was not set.

🤖 Generated with Claude Code

Closes #732 ## Cause `crates/fluxer-core/src/selectors/voice_status.rs` hard-coded `let speaking = false;` (deferred in Voice 11, #115 item 2, before the live room was in the store). The status server and the runtime were fine: the runtime already publishes `voice_status` after every applied event and the server pushes only when the JSON changes, so speaking only had to come out of the selector. ## Fix - `speaking` per connection from `Voice::connection_speaking`, the same source as the sidebar ring: LiveKit active speakers or the audio level, this client's processed microphone for its own connection, false while the connection shows as muted (self mute, server mute, suppress), OR-ed across a user's devices. - Push behaviour matches the original (`StatusApi.ts` + `DesktopVoiceStatusBridge.ts`): no throttle or coalescing, a push on every structural change (JSON dedupe), and slow readers are dropped (ours: 64 queued messages / 15 s write timeout; the original: 1 MiB of buffered writes). - `avatarUrl` (#115 item 3): the member's avatar for the guild when set (`getGuildMemberDisplayAvatarURL`), null when unset for the guild (`AVATAR_UNSET`), otherwise the user's avatar. Users with a default avatar still get `null`: the original gives its web build's content-hashed asset URL, which this client has no equivalent for. - `docs/acceptance/voice.md` updated. ## Verification - New core tests (`crates/fluxer-core/tests/voice_status.rs`): `status_payload_reports_the_active_speaker`, `status_payload_muted_speaker_is_not_speaking`, `status_payload_ors_speaking_across_devices`, `status_payload_reports_the_local_user_speaking`, `status_payload_avatar_is_the_guild_member_avatar`. All 5 failed before the fix. - Status API: `speaking_change_is_pushed_at_once_and_shown_on_get` (20 toggles, each pushed to a WebSocket client and seen on GET; slowest push about 0.1 ms). - `apps/fluxer/tests/voice_acceptance.rs`: the tripwire assertion is flipped. A WebSocket client now has to see ada start and stop speaking, and the local user speaking, within 250 ms of the window snapshot showing it. Measured: about 0.1 ms (89 to 113 µs over 3 runs). It failed with `speaking = false` restored. - `FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci`: all steps passed. LiveKit interop was skipped because `FLUXER_LIVEKIT_TESTS` was not set. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
The local status API (127.0.0.1:21863) told companion apps `speaking: false`
for everyone: `selectors::voice_status` hard-coded it, a leftover from Voice 11
(#115 item 2) from before the live room was in the store.

`speaking` now comes from `Voice::connection_speaking` for each connection,
the same source as the sidebar ring: LiveKit's active speakers or the level
of the connection's audio, this client's processed microphone for its own
connection, never while the connection shows as muted, OR-ed across a
user's devices. As in the original, no throttle: the runtime publishes after
every applied event and the server pushes only when the JSON changed.

`avatarUrl` is now the member's avatar for the guild when they set one
(`getGuildMemberDisplayAvatarURL`), null when unset for the guild. Users
with a default avatar still get null: the original's URL is an asset of its
web build.

Tests: selector tests (speaker, muted speaker, two devices, local user,
member avatar), a status-API push/GET test, and the voice acceptance test
now asserts the speaker appears and disappears on the WebSocket within
250 ms of the window showing it (measured about 0.1 ms).

Refs #732

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Author
Owner

Merged into textchat by hand (the merge API returns 405); the commits are in the branch.

Merged into `textchat` by hand (the merge API returns 405); the commits are in the branch.
charles closed this pull request 2026-11-16 02:20:55 +00:00

Pull request closed

Sign in to join this conversation.
No description provided.