Skip to content

bug(voice): agents tell Workspace clients the surface is text-only — portal TTS is never advertised, and the channel/portal voice gates disagree #2157

Closed

Description

@webmixgamer

Summary

The Workspace (Client Portal) speaks agent replies aloud, but it does so client-side: after a reply arrives, the portal UI calls POST /api/enterprise/client-portal/agents/{agent}/tts, gets an MP3 and plays it in the browser, gated on a speaker toggle in the conversation header. The agent is not involved, produces no audio artifact, and is never told this surface exists.

The only voice capability an agent knows about is the send_voice_reply MCP tool, which delivers an audio artifact into a messaging channel and is hard-restricted to Telegram/Slack/WhatsApp. So when a portal client asks for a spoken reply, the agent tries that tool, gets not_a_channel_turn, and — reasoning correctly from what it was told — over-generalizes from its own limitation to a false claim about the surface: that the portal is text-only, and that the client must go to another channel to be spoken to. Neither is true.

What is actually true, and what is false

This distinction is the whole issue, and getting it wrong in either direction produces a new bug. Observed live on v0.8.5, with the platform ElevenLabs key and the agent's tts_voice_id both set. Agent reply, verbatim excerpt:

I gave it a try, but voice replies aren't available on this channel. Voice notes only work over messaging channels like Telegram, Slack, or WhatsApp — and right now you're talking to me through the Client Portal (web), which is text-only. The system confirmed it: delivered: false, reason: not_a_channel_turn

So I can't send you an audio reply here […] If you want a spoken reply, reach me on Slack, Telegram, or WhatsApp (if this agent is connected there) and I can voice it back.

Claim Verdict
"I can't send you an audio reply here" TRUE. There is no path by which an agent delivers an audio artifact into the portal. send_voice_reply is channel-only by design, and nothing else exists.
"voice notes only work over messaging channels" TRUE for voice notes — an audio artifact in the transcript.
"the Client Portal (web) … is text-only" FALSE. The surface ships both TTS and STT. With the speaker toggle on, this same reply was read aloud a few seconds after it appeared.
"If you want a spoken reply, reach me on Slack, Telegram, or WhatsApp" FALSE remedy. The client can hear the reply on the surface they are already using, by toggling the speaker icon.
delivered: false, reason: not_a_channel_turn Internal reason string relayed verbatim to an external client.

Observed behaviour with the toggle on: the agent replies in text, and a few seconds later that same text begins playing as speech. The narration is ephemeral browser playback of the assistant's text — not a file, not a message, and not something the agent triggers or can observe.

So the fix is not to tell the agent it can send voice in the portal — it cannot. The fix is to tell it that this surface narrates its text when the client turns narration on, so it stops describing the surface as text-only and stops routing clients to other channels for something available where they are.

Root cause

Four facts, each individually correct, that combine into a wrong answer. Line numbers as of dev @ d2f8e685.

1. The tool is gated to channel turns — src/backend/routers/agents.py:1267-1270:

# Only user-facing channel turns have a deliverable voice destination.
channel = execution.source_channel or execution.triggered_by
if channel not in ("telegram", "slack", "whatsapp"):
    return {"delivered": False, "channel": channel, "reason": "not_a_channel_turn"}

A portal turn runs triggered_by="public", so it can never satisfy this — correctly, since there is no audio destination.

2. The reason string reaches the agent verbatim — src/mcp-server/src/tools/voice.ts:111 returns reason: result.reason straight through, so not_a_channel_turn lands in the agent's context and it reasons from it. The name describes a transport fact and invites the inference "this surface has no voice at all."

3. Nothing advertises the portal's narration. build_voice_capability_prompt() (src/backend/services/platform_prompt_service.py:818) has exactly one caller — src/backend/adapters/message_router.py:691, the channel path. The portal path never calls it. _build_portal_system_prompt() (src/backend/client_portal/service.py:799) composes only the MEM-001 memory block and the #1205 public-channel prompt; voice is mentioned nowhere.

4. Narration is client-side and off by default — src/frontend/src/components/portal/PortalConversation.vue:

const ttsEnabled = computed(() => !!props.agent.voice_available)
const voiceMode = ref(false)  // off on every load
// :435 — after the text reply is pushed:
if (voiceMode.value && ttsEnabled.value && data.response) speak(data.response)

Secondary defect: the two voice paths gate differently, in both directions

Gate Channel (services/voice_reply_service.py:71-79) Portal (client_portal/service.py:305,487-491)
Platform TTS key checked checked
Agent-level tts_voice_replies_enabled checked ignored
Per-channel flag checked n/a
Voice id agent's own or platform default agent's own only

Two consequences:

  • This makes the primary bug worse than it first appears. An agent relying on the platform default voice (tts_voice_id NULL) speaks fine on Telegram but its portal speaker toggle never renders at all — voice_available requires the agent's own id. So the agents most likely to produce the misleading answer are exactly the ones where the client has no toggle to reach for.
  • Inverse leak: an agent whose operator explicitly disabled voice replies is still narrated in the portal, because the portal checks neither the agent-level enable nor any per-surface flag. Operator intent is silently ignored.

Impact

  • Clients are told a working, paid feature does not exist — by the agent itself, which is the most credible source in that UI. The agent's self-report is accurate, which is what makes the surrounding claim so convincing.
  • The suggested workaround pushes an external client off the deliberately client-facing surface and onto operator channels, for something already available where they are.
  • Discoverability is already weak: the toggle is off on every load, and invisible entirely for agents on the platform default voice. The agent's denial actively reinforces the wrong conclusion.
  • Internal reason strings leak to external clients.

Acceptance Criteria

  • A portal/workspace turn injects a capability fragment telling the agent that this surface narrates its replies aloud when the client enables it, and that narration is client-controlled rather than agent-triggered
  • The fragment must not imply the agent can send an audio artifact in the portal — it cannot, and claiming otherwise would replace one wrong answer with another
  • Asked for a spoken reply in the portal, an agent no longer describes the surface as text-only and no longer redirects the client to another channel; it points at the speaker toggle instead
  • The fragment is set by the platform from the turn's surface, never asserted by the caller
  • Covered by a test asserting the portal prompt carries the fragment and a channel turn is unchanged
  • send_voice_reply returns a portal-specific, actionable reason (e.g. portal_client_narrated) rather than not_a_channel_turn when the turn originates in the portal, so an agent reasoning from the tool result alone still answers correctly
  • Agents explain the outcome to clients rather than echoing the machine reason string
  • Decide and implement consistent gating across the two paths: whether portal narration honours tts_voice_replies_enabled, and whether voice_available should fall back to the platform default voice as the channel path does — with the chosen behaviour covered by tests in both directions
  • Channel turns keep their current behaviour, verified by test
  • Optional UX: the client's voice-mode choice persists per client/agent instead of defaulting to off on every page load

Technical Notes

  • The fix rides the existing platform prompt composition (services/platform_prompt_service.py), which is already runtime-aware — the portal counterpart to build_voice_capability_prompt(), but describing a client-controlled surface affordance rather than an agent-invocable tool. That difference is worth carrying in the helper's name.
  • Shares its mechanism with trinity-enterprise#363 ("tell an agent when a room is user-facing"), which injects a different surface-awareness signal into the same prompt seam. These should almost certainly land together or reuse one helper rather than growing two parallel injection paths.
  • trinity-enterprise#285 ("live voice conversation for external clients") is not a duplicate — it covers live back-and-forth Gemini Live conversation. It does corroborate the premise, recording that turn-based portal /tts and /stt already ship.
  • The channel gate has been touched by exactly one commit since it was written (8e03dacb, voice replies v2), and no open PR in either tracker touches this path — so there is no in-flight or landed fix to rebase onto.
  • Reproduces on any instance with the Workspace/portal surface, a platform ElevenLabs key, and an agent with a per-agent tts_voice_id. The core defect is static logic and is verifiable by reading the call graph — no ElevenLabs key is needed to confirm it.

Activity

  1. added
    priority-p2
    type-bug
    theme-channels
    status-ready
    on Aug 13, 2026
  2. webmixgamer commented on Aug 13, 2026

    @webmixgamer
    ContributorAuthor

    Refined the description shortly after filing, following a closer look at the live observation. The correction matters for anyone implementing this:

    The agent's "I can't send you an audio reply here" is literally true — no path delivers an audio artifact into the portal, and none should be added. What the portal does is narrate the agent's text client-side: the reply arrives as text, and a few seconds later the browser plays an MP3 synthesized from it via POST .../tts. Ephemeral playback, not a file, not in the transcript, not agent-triggered.

    So the defect is narrower and more precise than "the agent denied a capability it has": the agent correctly reported its own limitation and then over-generalized to two false claims about the surface — that it is text-only, and that a spoken reply requires another channel.

    Body updated with a claim-by-claim true/false breakdown and a new acceptance criterion guarding the over-correction: the injected fragment must not imply the agent can send audio in the portal. Both would be wrong answers; only the second one is currently shipping.

  3. added
    status-in-progress
    and removed
    status-ready
    on Aug 14, 2026
  4. self-assigned this
    on Aug 14, 2026
  5. dolho commented on Aug 14, 2026

    @dolho
    Contributor

    /claim — picking this up. Branch: fix/2157-portal-narration-awareness.

  6. github-actions commented on Aug 14, 2026

    @github-actions

    @dolho This issue is already assigned to dolho. Use /unclaim first if you want to take over.

  7. dolho commented on Aug 14, 2026

    @dolho
    Contributor

    PR: #2176 (targets dev).

    Gating decision (the AC that was left open): the portal now uses the channel gate minus the per-channel flags — platform key AND agent-level tts_voice_replies_enabled AND own voice else the platform default. Behaviour changes in both directions, verified live: an agent on the platform default voice gains a speaker control it never had, and an agent whose operator disabled voice stops being narrated. Worth a release note.

    Verified against a real instance: same execution row returns not_a_channel_turn on dev and portal_client_narrated + guidance on the branch; a real Workspace turn now answers "look for the speaker control in this conversation interface" instead of "this surface is text-only, reach me on Slack".

  8. added
    status-in-dev
    and removed
    status-in-progress
    on Aug 14, 2026
  9. 3 remaining items

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

priority-p2theme-channelstype-bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions