Skip to content

Conversation

@joelbdavies
Copy link

Summary

Fix an issue preventing voice IDs without integers from being recognized, plus two minor flag validation fixes.

Bug Fixes

1. Voice ID detection without digits

Problem: Voice IDs containing only letters were not recognized as IDs because the detection logic required at least one digit. This caused such IDs to be treated as voice names, triggering an unnecessary API call and falling back to the first available voice instead of using the specified ID.

Solution: Changed detection logic to identify voice IDs by:

  • Length >= 15 characters (typical voice ID length)
  • No spaces (voice names typically contain spaces)

This correctly identifies voice IDs regardless of their character composition.

2. Flag default value inconsistency

Problem: The --voice flag used a variable reference (opts.voiceID) as its default value instead of an empty string literal. This could cause issues with cobra's flag parsing when both --voice-id and --voice flags point to the same variable.

Solution: Changed to use "" for consistency with the --voice-id flag.

3. Speed vs rate validation order

Problem: --speed validation happened before --rate processing, causing false validation errors when both flags were provided. For example, --speed 0.3 --rate 200 would fail validation even though --rate 200 (which maps to speed 1.14) is valid and would override the invalid --speed value.

Solution: Process and validate --rate first if provided, and only validate --speed if --rate was not provided. This matches the intended behavior where --rate overrides --speed.

joelbdavies and others added 3 commits January 18, 2026 21:08
Voice IDs were not being recognized as IDs when they contained only
letters because the detection logic required at least one digit. This
caused such IDs to be treated as voice names, triggering an unnecessary
API call and falling back to the first available voice.

Changed the detection logic to check for:
- Length >= 15 characters (typical voice ID length)
- No spaces (voice names typically contain spaces)

This correctly identifies voice IDs regardless of their character composition.

Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
The --voice flag was using a variable reference (opts.voiceID) as its
default value instead of an empty string literal. This could cause
issues with cobra's flag parsing when both --voice-id and --voice
flags point to the same variable.

Changed to use "" for consistency with the --voice-id flag.

Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
Previously, --speed validation happened before --rate processing, which
caused false validation errors when both flags were provided. For example,
`--speed 0.3 --rate 200` would fail even though --rate 200 (speed 1.14)
is valid and would override the invalid --speed value.

Changed to:
- Process and validate --rate first if provided
- Only validate --speed if --rate was not provided

This matches the intended behavior where --rate overrides --speed.

Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 152505be79

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +453 to 455
// If input looks like an ID (alphanumeric >= 15 chars without spaces), use directly.
if len(voiceInput) >= 15 && !strings.ContainsRune(voiceInput, ' ') {
return voiceInput, nil

Choose a reason for hiding this comment

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

P2 Badge Avoid treating long single-word names as IDs

The new heuristic treats any input with length ≥15 and no spaces as a voice ID, skipping the name lookup entirely. This regresses cases where a valid voice name is a single long token (e.g., a custom name like “LongSingleWordName”), which previously would be resolved via ListVoices but now is sent directly as an ID and will fail or pick the wrong voice. Consider tightening the ID check to a specific ID pattern (e.g., UUID/known charset) or keeping name lookup for non-matching IDs.

Useful? React with 👍 / 👎.

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.

1 participant