Skip to content

fix(deepgram): treat blank env API key as unconfigured in realtime transcription - #108565

Closed
lsr911 wants to merge 1 commit into
openclaw:mainfrom
lsr911:fix-deepgram-blank-api-key
Closed

lsr911 wants to merge 1 commit into
openclaw:mainfrom
lsr911:fix-deepgram-blank-api-key

Conversation

@lsr911

@lsr911 lsr911 commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

What Problem This Solves

A whitespace-only DEEPGRAM_API_KEY made the Deepgram realtime transcription provider report configured, then sent an unusable bearer credential from createSession.

This is the same class of blank-credential defect that was fixed for the OpenAI speech provider in #108212 and the Xiaomi MiMo provider in #108558.

Why This Change Was Made

  • Reuse the already-imported normalizeOptionalString (semantically trimToUndefined) to normalize process.env.DEEPGRAM_API_KEY in isConfigured and createSession
  • No new imports required — normalizeOptionalString was already in scope
  • Reject blank credentials locally before opening a WebSocket connection

User Impact

  • Before: whitespace-only credentials looked configured and failed later during realtime transcription
  • After: blank credentials fail locally as missing; valid padded credentials work with the normalized value

Verification

  • Focused suite: extensions/deepgram/realtime-transcription-provider.test.ts
    • New isConfigured test suite: unset → false, set → true, whitespace → false, config apiKey → true
    • New createSession test: whitespace env key → throws "Deepgram API key missing"
    • All existing tests remain passing

Risk / Compatibility

Low. Existing explicit-config precedence remains unchanged. Only surrounding whitespace and blank env values are normalized. No config, SDK, or persistence surface changes.

Changelog

Release-note context only; no contributor-owned root changelog edit.

…anscription

A whitespace-only DEEPGRAM_API_KEY made the Deepgram realtime transcription
provider report configured, then sent an unusable bearer credential.

- Wrap process.env.DEEPGRAM_API_KEY with normalizeOptionalString in
  isConfigured so blank env values are treated as not configured
- Wrap process.env.DEEPGRAM_API_KEY with normalizeOptionalString in
  createSession so blank values are rejected locally before connecting
- Add isConfigured test suite covering: unset, set, whitespace-only
  env, and provider-config apiKey paths
- Add createSession test for whitespace-only env key rejection

This matches the blank-credential guard applied in the OpenAI speech
provider (PR openclaw#108212) and Xiaomi MiMo provider (PR openclaw#108558).
@openclaw-barnacle openclaw-barnacle Bot added size: XS triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. labels Jul 16, 2026
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal backlog priority with limited blast radius. labels Jul 16, 2026
@clawsweeper

clawsweeper Bot commented Jul 16, 2026 •

Copy link
Copy Markdown
Contributor

Thanks for the contribution. This PR still needs the requested real-behavior proof, and the branch has been idle since that ask.

Close as stalled/unproven: the source confirms a real narrow Deepgram credential bug, but this external PR has had no head activity for 21 days after a dated proof request and still lacks after-fix real behavior evidence.

So I’m closing this for now to keep the review queue honest. Please reopen or open a fresh PR with real-behavior proof (a live run, logs, or a reproducible validation transcript) and it will be reviewed again.

Review details

Best possible solution:

If reopened, explicitly clear the environment in the unset test and add a redacted exact-head production-provider or loopback-WebSocket trace proving blank rejection before any connection, plus a padded-valid-key case.

Do we have a high-confidence way to reproduce the issue?

Yes—source provides a high-confidence path: whitespace is truthy at the current readiness gate and reaches the session credential path, although this review did not execute the external contributor branch.

Is this the best way to solve the issue?

Yes—the two owner-local substitutions reuse the existing normalizer and match sibling realtime providers, but the branch needs reliable regression setup and real after-fix proof before merge.

Security review:

Security review cleared: The two-file diff adds no dependency, workflow, secret-handling, or supply-chain surface; it only normalizes an existing credential before use.

AGENTS.md: found and applied where relevant.

What I checked:

Likely related people:

  • steipete: Authored the original streaming STT feature and the recent current-file carrier that preserved this provider path. (role: feature owner and recent area contributor; confidence: high; commits: 51ed22e6081d, 6e4d387feda9; files: extensions/deepgram/realtime-transcription-provider.ts)
  • dwc1997: Authored the recent Deepgram realtime base-URL/WebSocket work in the affected provider. (role: recent Deepgram realtime contributor; confidence: medium; commits: f07ea1086993; files: extensions/deepgram/realtime-transcription-provider.ts)

Codex review notes: model internal, reasoning high; reviewed against 8c64ca24b17f.

steipete pushed a commit to lsr911/openclaw that referenced this pull request Jul 16, 2026
A whitespace-only INWORLD_API_KEY made the Inworld speech provider
report configured, then sent an unusable bearer credential from
synthesis, telephony synthesis, and voice listing.

- Wrap process.env.INWORLD_API_KEY with trimToUndefined in isConfigured
  so blank values are treated as not configured
- Wrap process.env.INWORLD_API_KEY with trimToUndefined in synthesize,
  synthesizeTelephony, and listVoices so blank values are rejected
  locally before any network request
- Add test coverage for whitespace-only env key in isConfigured and
  synthesize paths

This matches the blank-credential guard pattern applied in the OpenAI
(openclaw#108212), Xiaomi (openclaw#108558), and Deepgram (openclaw#108565) providers.

Co-Authored-By: Claude <[email protected]>
steipete added a commit that referenced this pull request Jul 16, 2026
…der (#108783)

* fix(inworld): treat blank env API key as unconfigured in speech provider

A whitespace-only INWORLD_API_KEY made the Inworld speech provider
report configured, then sent an unusable bearer credential from
synthesis, telephony synthesis, and voice listing.

- Wrap process.env.INWORLD_API_KEY with trimToUndefined in isConfigured
  so blank values are treated as not configured
- Wrap process.env.INWORLD_API_KEY with trimToUndefined in synthesize,
  synthesizeTelephony, and listVoices so blank values are rejected
  locally before any network request
- Add test coverage for whitespace-only env key in isConfigured and
  synthesize paths

This matches the blank-credential guard pattern applied in the OpenAI
(#108212), Xiaomi (#108558), and Deepgram (#108565) providers.

Co-Authored-By: Claude <[email protected]>

* fix(inworld): centralize speech API key resolution

---------

Co-authored-by: Claude <[email protected]>
Co-authored-by: Peter Steinberger <[email protected]>
steipete pushed a commit to lsr911/openclaw that referenced this pull request Jul 16, 2026
The isGradiumProviderConfigured helper already uses trimToUndefined on
GRADIUM_API_KEY, but synthesize and synthesizeTelephony still used the
bare env var. This made whitespace-only credentials pass the
missing-key guard and send unusable bearer tokens.

- Wrap process.env.GRADIUM_API_KEY with trimToUndefined in synthesize
- Wrap process.env.GRADIUM_API_KEY with trimToUndefined in
  synthesizeTelephony
- Add test for whitespace-only env key rejection in synthesize

This completes the blank-credential guard for the Gradium provider,
matching the pattern from OpenAI (openclaw#108212), Xiaomi (openclaw#108558),
Deepgram (openclaw#108565), and Inworld (openclaw#108783).

Co-Authored-By: Claude <[email protected]>
steipete added a commit that referenced this pull request Jul 16, 2026
…ths (#108800)

* fix(gradium): treat blank env API key as unconfigured in synthesis paths

The isGradiumProviderConfigured helper already uses trimToUndefined on
GRADIUM_API_KEY, but synthesize and synthesizeTelephony still used the
bare env var. This made whitespace-only credentials pass the
missing-key guard and send unusable bearer tokens.

- Wrap process.env.GRADIUM_API_KEY with trimToUndefined in synthesize
- Wrap process.env.GRADIUM_API_KEY with trimToUndefined in
  synthesizeTelephony
- Add test for whitespace-only env key rejection in synthesize

This completes the blank-credential guard for the Gradium provider,
matching the pattern from OpenAI (#108212), Xiaomi (#108558),
Deepgram (#108565), and Inworld (#108783).

Co-Authored-By: Claude <[email protected]>

* fix(gradium): centralize speech API key resolution

---------

Co-authored-by: Claude <[email protected]>
Co-authored-by: Peter Steinberger <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 17, 2026
…der (openclaw#108783)

* fix(inworld): treat blank env API key as unconfigured in speech provider

A whitespace-only INWORLD_API_KEY made the Inworld speech provider
report configured, then sent an unusable bearer credential from
synthesis, telephony synthesis, and voice listing.

- Wrap process.env.INWORLD_API_KEY with trimToUndefined in isConfigured
  so blank values are treated as not configured
- Wrap process.env.INWORLD_API_KEY with trimToUndefined in synthesize,
  synthesizeTelephony, and listVoices so blank values are rejected
  locally before any network request
- Add test coverage for whitespace-only env key in isConfigured and
  synthesize paths

This matches the blank-credential guard pattern applied in the OpenAI
(openclaw#108212), Xiaomi (openclaw#108558), and Deepgram (openclaw#108565) providers.

Co-Authored-By: Claude <[email protected]>

* fix(inworld): centralize speech API key resolution

---------

Co-authored-by: Claude <[email protected]>
Co-authored-by: Peter Steinberger <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 17, 2026
…ths (openclaw#108800)

* fix(gradium): treat blank env API key as unconfigured in synthesis paths

The isGradiumProviderConfigured helper already uses trimToUndefined on
GRADIUM_API_KEY, but synthesize and synthesizeTelephony still used the
bare env var. This made whitespace-only credentials pass the
missing-key guard and send unusable bearer tokens.

- Wrap process.env.GRADIUM_API_KEY with trimToUndefined in synthesize
- Wrap process.env.GRADIUM_API_KEY with trimToUndefined in
  synthesizeTelephony
- Add test for whitespace-only env key rejection in synthesize

This completes the blank-credential guard for the Gradium provider,
matching the pattern from OpenAI (openclaw#108212), Xiaomi (openclaw#108558),
Deepgram (openclaw#108565), and Inworld (openclaw#108783).

Co-Authored-By: Claude <[email protected]>

* fix(gradium): centralize speech API key resolution

---------

Co-authored-by: Claude <[email protected]>
Co-authored-by: Peter Steinberger <[email protected]>
@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. merge-risk: 🚨 auth-provider 🚨 May break OAuth, tokens, provider routing, model choice, or credentials. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Aug 6, 2026
@clawsweeper

clawsweeper Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper applied the proposed close for this PR.

@clawsweeper clawsweeper Bot closed this Aug 6, 2026
zooqueen pushed a commit to zooqueen/openclaw that referenced this pull request Sep 11, 2026
…der (openclaw#108783)

* fix(inworld): treat blank env API key as unconfigured in speech provider

A whitespace-only INWORLD_API_KEY made the Inworld speech provider
report configured, then sent an unusable bearer credential from
synthesis, telephony synthesis, and voice listing.

- Wrap process.env.INWORLD_API_KEY with trimToUndefined in isConfigured
  so blank values are treated as not configured
- Wrap process.env.INWORLD_API_KEY with trimToUndefined in synthesize,
  synthesizeTelephony, and listVoices so blank values are rejected
  locally before any network request
- Add test coverage for whitespace-only env key in isConfigured and
  synthesize paths

This matches the blank-credential guard pattern applied in the OpenAI
(openclaw#108212), Xiaomi (openclaw#108558), and Deepgram (openclaw#108565) providers.

Co-Authored-By: Claude <[email protected]>

* fix(inworld): centralize speech API key resolution

---------

Co-authored-by: Claude <[email protected]>
Co-authored-by: Peter Steinberger <[email protected]>
zooqueen pushed a commit to zooqueen/openclaw that referenced this pull request Sep 11, 2026
…ths (openclaw#108800)

* fix(gradium): treat blank env API key as unconfigured in synthesis paths

The isGradiumProviderConfigured helper already uses trimToUndefined on
GRADIUM_API_KEY, but synthesize and synthesizeTelephony still used the
bare env var. This made whitespace-only credentials pass the
missing-key guard and send unusable bearer tokens.

- Wrap process.env.GRADIUM_API_KEY with trimToUndefined in synthesize
- Wrap process.env.GRADIUM_API_KEY with trimToUndefined in
  synthesizeTelephony
- Add test for whitespace-only env key rejection in synthesize

This completes the blank-credential guard for the Gradium provider,
matching the pattern from OpenAI (openclaw#108212), Xiaomi (openclaw#108558),
Deepgram (openclaw#108565), and Inworld (openclaw#108783).

Co-Authored-By: Claude <[email protected]>

* fix(gradium): centralize speech API key resolution

---------

Co-authored-by: Claude <[email protected]>
Co-authored-by: Peter Steinberger <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-risk: 🚨 auth-provider 🚨 May break OAuth, tokens, provider routing, model choice, or credentials. P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. size: XS status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant