fix(agent): gate spoken narration on the rollout feature flag#3503
Closed
jonmcwest wants to merge 1 commit into
Closed
fix(agent): gate spoken narration on the rollout feature flag#3503jonmcwest wants to merge 1 commit into
jonmcwest wants to merge 1 commit into
Conversation
Generated-By: PostHog Code Task-Id: 98ad1c64-54d6-4da0-81fe-97d3e4ce394f
Contributor
|
Reviews (1): Last reviewed commit: "fix(agent): gate spoken narration on the..." | Re-trigger Greptile |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Follow-up to #3500, stacked on its branch (do not merge before it).
#3500 makes narration strictly opt-in and gates the desktop on the user setting + ElevenLabs key — but the
posthog-code-spoken-narrationrollout flag still isn't checked anywhere outside the settings UI. #3500's comments describe the gate as "feature flag + setting + key"; the flag part wasn't actually wired. Anyone who toggled the setting on while the flag was enabled (and has a key) keeps narration forever after the flag is turned off, with no UI left to disable it, and desktop playback ignores the flag entirely.Per the ask in #team-max-ai: the speak tool should run only when the flag is enabled, the setting is on, and an ElevenLabs key is configured.
Changes
resolveLocalSpokenNarrationinpackages/core/src/sessions/spokenNarration.ts: narration threads into session start/reconnect only whenspokenNarrationFlagEnabled && spokenNotifications && elevenLabsKeyConfigured. Pure and unit-tested; bothsessionServicecall sites now share it.SessionServiceDeps.settingsgainsspokenNarrationFlagEnabled— the host evaluates the flag (core has no feature-flag client) and supplies the fact. The renderer resolves it fromFEATURE_FLAGSinsessionServiceHost.ts, failing closed when flags are unavailable or not yet loaded.SPEECH_SETTINGS_PROVIDER,SPEECH_NOTIFY_SETTINGS) now requires the flag alongside the setting, so a stale persisted setting can't keep spoken notifications alive with the flag off.After this, #3500's "flag + setting + key" comments are accurate.
How did you test this?
spokenNarration.test.ts(6 cases: all-on, each gate missing, all unset).@posthog/core(2403),@posthog/ui(1668),@posthog/agent(1394),@posthog/workspace-server(746) — all pass.pnpm typecheckon core, ui, and apps/code; biome lint clean on touched files.Automatic notifications
Created with PostHog Code