Skip to content

fix(agent): Gate spoken narration on the user setting#3461

Merged
charlesvien merged 5 commits into
mainfrom
fix/spoken-narration-gating
Jul 15, 2026
Merged

fix(agent): Gate spoken narration on the user setting#3461
charlesvien merged 5 commits into
mainfrom
fix/spoken-narration-gating

Conversation

@charlesvien

@charlesvien charlesvien commented Jul 15, 2026

Copy link
Copy Markdown
Member

Problem

#3060 shipped the speak narration tool always-on at the agent side. Every session, local or cloud, gets the "never end a turn silently, every turn MUST call speak" prompt block and the tool itself, regardless of the spoken-notifications setting (default off) or the rollout flag, which only hides the settings UI.

Nothing auto-allows the tool either, so in local attended sessions every speak call throws an MCP permission prompt. The result for anyone on today's master: a permission dialog on nearly every turn, an extra tool call per turn, and the narration text discarded at playback because the setting is off.

Changes

  • Plumb the spoken-notifications setting into session start: settings store into sessionService, through agent.start/agent.reconnect into the session _meta as spokenNarration.
  • Gate both the speak tool registration and the Spoken Narration prompt block on it. Local sessions with narration off (the default) get neither. Cloud sessions keep emitting unconditionally since the sandbox can't know which clients are listening; playback stays consumer-gated there, and cloud runs use bypassPermissions so they never prompted.
  • Auto-allow mcp__posthog-code-tools__speak in canUseTool. It's a fire-and-forget no-op on the agent side and never worth a permission prompt.

Known limitation: toggling narration on mid-session takes effect on the next session, since a running agent process can't be re-prompted or grow a new tool.

How did you test this?

  • New and updated unit tests: speak gate on/off/unset, local-tools server registration for the Claude and Codex adapters, canUseTool auto-allow, appended-instructions gating.
  • Full @posthog/agent suite (1298 tests), core sessions suite and workspace-server agent suite all pass.
  • pnpm typecheck and Biome across the three touched packages.

Automatic notifications

  • Publish to changelog?
  • Alert Sales and Marketing teams?

@trunk-io

trunk-io Bot commented Jul 15, 2026

Copy link
Copy Markdown

Merging to main in this repository is managed by Trunk.

  • To merge this pull request, check the box to the left or comment /trunk merge below.

After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here

@github-actions

github-actions Bot commented Jul 15, 2026

Copy link
Copy Markdown

React Doctor found no issues in the changed files. 🎉

Reviewed by React Doctor for commit ccc7586.

@charlesvien charlesvien marked this pull request as ready for review July 15, 2026 05:29
@greptile-apps

greptile-apps Bot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Reviews (1): Last reviewed commit: "gate spoken narration on the user settin..." | Re-trigger Greptile

@charlesvien charlesvien added the Stamphog This will request an autostamp by stamphog on small changes label Jul 15, 2026

@stamphog stamphog Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gates denied this PR due to a deny-list match on "auth" (appearing in context lines around auth.apiHost/auth.projectId) and T2-never classification. The changes themselves look coherent — threading a spokenNarration boolean through the session stack to gate the speak tool — but with zero reviews and a gate denial, a human sign-off is required before this can proceed.

@stamphog stamphog Bot removed the Stamphog This will request an autostamp by stamphog on small changes label Jul 15, 2026
@charlesvien charlesvien requested review from a team and jonmcwest July 15, 2026 05:37
@charlesvien charlesvien enabled auto-merge (squash) July 15, 2026 05:40
@charlesvien charlesvien merged commit 5e35d6e into main Jul 15, 2026
27 checks passed
@charlesvien charlesvien deleted the fix/spoken-narration-gating branch July 15, 2026 08:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants