fix(web): use session flavor label in voice context formatters#1
Draft
heavygee wants to merge 1 commit into
Draft
fix(web): use session flavor label in voice context formatters#1heavygee wants to merge 1 commit into
heavygee wants to merge 1 commit into
Conversation
e68ef31 to
8179263
Compare
Replaces hardcoded 'Claude Code' strings in voice context injections with the active session's flavor label (Cursor, Codex, Gemini, etc.) via getFlavorLabel() from @hapi/protocol. Falls back to 'coding agent' for unknown or missing flavors. Threads an agentLabel param through formatMessage, formatPermissionRequest, formatReadyEvent, formatNewMessages, formatHistory, and formatSessionFull. voiceHooks resolves the label once per call via session.metadata.flavor. Fixes tiann#680 via [HAPI](https://hapi.run) Co-Authored-By: HAPI <noreply@hapi.run>
8179263 to
9402685
Compare
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.
Summary
Replaces hardcoded
Claude Codestrings in voice context injections with the active session's flavor label (Cursor, Codex, Gemini, OpenCode, etc.) sourced fromgetFlavorLabel()in@hapi/protocol. Falls back tocoding agentfor unknown or missing flavors.web/src/realtime/hooks/contextFormatters.ts— threadsagentLabel(optional, default'coding agent') throughformatPlainText,formatPermissionRequest,formatMessage(text blocks + tool-call lines),formatNewMessages,formatHistory,formatSessionFull,formatReadyEvent.web/src/realtime/hooks/voiceHooks.ts— addsgetAgentLabel(session)helper usinggetFlavorLabel()from@hapi/protocol; passes label into all formatter calls.Why shared/src/voice.ts is not touched
The system prompt in
voice.tscontains example text that references "Claude" (e.g. the permission request example:"Claude wants to run a bash command"). We considered updating this but deliberately chose not to.The argument for changing it: be as accurate as possible even in the ConvAI prompt.
The argument against, which won: once this PR (and tiann#682) are merged, every context update ConvAI receives will carry the correct agent label — "Cursor is requesting permission to use Bash", not "Claude Code is requesting...". At that point ConvAI's spoken responses will naturally reflect the right terminology, because LLMs follow the context they receive rather than parroting example text from a system prompt verbatim. The
voice.tswording only remains a real-world problem if these formatter fixes are not in place — which is an argument for merging this PR, not for also editing the system prompt. Touching system prompt wording without that being strictly necessary felt like stepping into editorial territory that belongs to the maintainers.Happy to follow up separately on
voice.tsif desired once these changes land.Test plan
bun test web/src/realtime/hooks/contextFormatters.test.ts(8 tests — all assert label appears, none hardcodeClaude Code)Issues
Fixes tiann#680