feat(ai): add 'Who can use AI' audience setting, default Everyone (LC-702) #668
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/LC-702-ai-audience-toggle"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
Adds a second admin setting, Who can use AI (
settings.llm_audience), next to the existing enable toggle in Admin > Settings > AI features.Why
LC-679 shipped the AI flag as a staged-rollout control: once an admin turned AI on, the whole surface (writing assistant, catch-up, /ask, translate, suggested replies, semantic search, transcript summaries) stayed scoped to staff. A regular member saw no AI affordances and got a 403 on a direct request. LC-702 asks why regular users still cannot use AI once the flag is on. The default is now Everyone, so flipping the flag opens the surface to all members; Staff only stays available for pre-rollout piloting.
How
llm_audienceinai_gate(absent or any non-"staff"value reads as"everyone", so a fresh deployment is open by default the moment the flag flips on).ai_gate::allowed_in_room=audience_is_everyone || privileged_in_room. Every render path (room, DM, thread panel, room header, slash menu, transcript page) and every route guard (require_llm_in_room,require_embeddings_in_room,can_use_embeddings_in_room) now asksallowed_in_roominstead ofprivileged_in_room. Thellm_enabledflag stays the separate kill switch.post_llm_flagpersists both the toggle and the audience in one save), with copy updated to describe the audience instead of the old staff-only wording. Authored.lc-radioCSS inmain.css. English + Spanish locale parity.Security
Opening the audience does not expose non-members. Every AI route already runs an independent room-access check (
is_room_accessible/require_access) before the gate, and/askis reachable only via a slash command posted into a room the user already has access to. The audience widens access only within a room the user already belongs to.Testing
routes_ai_gateintegration tests updated: flag off -> 403 even for admin; flag on + default "everyone" -> plain member allowed (200); flag on + "staff" -> member 403 while admin passes; absent flag defaults off.just test(195 binaries, 1636 tests), clippy standalone + saas,cargo fmt --check, i18n en/es parity.Closes LC-702.
🤖 Generated with Claude Code
https://claude.ai/code/session_016ufqbuN7mjyt4ms5NEygMy