Skip to content

fix(xiaomi): treat blank env API key as unconfigured in speech provider - #108558

Merged
steipete merged 2 commits into
openclaw:mainfrom
lsr911:fix-xiaomi-blank-api-key
Jul 16, 2026
Merged

steipete merged 2 commits into
openclaw:mainfrom
lsr911:fix-xiaomi-blank-api-key

Conversation

@lsr911

@lsr911 lsr911 commented Jul 16, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

A whitespace-only XIAOMI_API_KEY made the Xiaomi MiMo speech provider report configured, then allowed an unusable credential into request construction.

This is the same blank-credential class fixed for sibling speech providers.

Why This Change Was Made

  • Use the shared resolveSpeechProviderApiKey contract for trimming and blank rejection.
  • Keep one Xiaomi runtime resolver for configured-key-over-environment precedence.
  • Make readiness and synthesis consume the same resolved configuration.
  • Reject blank credentials before the guarded fetch or api-key header arguments are built.

User Impact

  • Before: whitespace-only credentials looked configured and failed later as a TTS request.
  • After: blank credentials fail locally as missing; padded valid credentials are trimmed before the request header is built.

Evidence

Focused production-module tests:

$ node scripts/run-vitest.mjs extensions/xiaomi/speech-provider.test.ts
Test Files  1 passed (1)
Tests  22 passed (22)

Redacted production-module negative probe:

configured=false
error=Xiaomi API key missing
fetchCalls=0

Hosted changed-file gate passed formatting, SDK baseline, plugin boundaries, dependency guards, extension and extension-test types, lint, storage guards, and import cycles:

Risk / Compatibility

Low. Existing configured-key precedence remains unchanged. Only surrounding whitespace and blank values are normalized. No config, persistence, or dependency surface changes.

Changelog

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

@openclaw-barnacle openclaw-barnacle Bot added extensions: xiaomi 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

Codex review: needs real behavior proof before merge. Reviewed July 15, 2026, 10:14 PM ET / July 16, 2026, 02:14 UTC.

Summary
The PR trims the XIAOMI_API_KEY environment fallback for Xiaomi speech-provider readiness and synthesis, with regression tests for blank values.

PR surface: Source +3, Tests +32. Total +35 across 2 files.

Reproducibility: yes. from source inspection: before the patch, a whitespace-only environment string is truthy during readiness checking and can become the synthesis credential; the added tests exercise both paths.

Review metrics: none identified.

Merge readiness
Overall: 🦪 silver shellfish
Proof: 🦪 silver shellfish
Patch quality: 🐚 platinum hermit
Result: blocked until real behavior proof from a real setup is added.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • [P1] Add redacted terminal or live output showing the whitespace-only key fails locally before network I/O; remove API keys, private endpoints, IP addresses, phone numbers, and other private details.

Proof guidance:

  • [P1] Needs real behavior proof before merge: The PR supplies focused unit-test claims but no after-fix real setup evidence; add redacted terminal or live output showing local rejection before a Xiaomi request, then update the PR body to trigger review or ask a maintainer for @clawsweeper re-review.

Risk before merge

  • [P1] No redacted runtime transcript or live Xiaomi setup evidence currently proves that a whitespace-only key is rejected locally before network I/O.

Maintainer options:

  1. Decide the mitigation before merge
    Keep Xiaomi credential resolution provider-owned and consistently normalized across readiness and synthesis, then land it with focused regression coverage and observable local-rejection proof.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Next step before merge

  • [P1] Hold merge for contributor-supplied after-fix real behavior proof; there is no concrete code defect for automated repair.

Security
Cleared: The patch narrows existing credential handling without exposing secrets or changing dependencies, workflows, permissions, package resolution, or code-execution sources.

Review details

Best possible solution:

Keep Xiaomi credential resolution provider-owned and consistently normalized across readiness and synthesis, then land it with focused regression coverage and observable local-rejection proof.

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

Yes from source inspection: before the patch, a whitespace-only environment string is truthy during readiness checking and can become the synthesis credential; the added tests exercise both paths.

Is this the best way to solve the issue?

Yes. Normalizing the environment fallback at the provider boundary is the narrowest maintainable fix, preserves explicit-config precedence, and matches the merged sibling-provider pattern.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 08ecf63bb608.

Label changes

Label changes:

  • add P2: This fixes a real but narrowly scoped Xiaomi speech-provider credential-validation failure with limited blast radius.
  • add rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🐚 platinum hermit.
  • add status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The PR supplies focused unit-test claims but no after-fix real setup evidence; add redacted terminal or live output showing local rejection before a Xiaomi request, then update the PR body to trigger review or ask a maintainer for @clawsweeper re-review.

Label justifications:

  • P2: This fixes a real but narrowly scoped Xiaomi speech-provider credential-validation failure with limited blast radius.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🐚 platinum hermit.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The PR supplies focused unit-test claims but no after-fix real setup evidence; add redacted terminal or live output showing local rejection before a Xiaomi request, then update the PR body to trigger review or ask a maintainer for @clawsweeper re-review.
Evidence reviewed

PR surface:

Source +3, Tests +32. Total +35 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 5 2 +3
Tests 1 32 0 +32
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 37 2 +35

What I checked:

Likely related people:

  • zoujiejun: The Xiaomi MiMo TTS provider was introduced through merged pull request 55614 and credited to @zoujiejun in the corresponding release history. (role: introduced affected behavior; confidence: high; commits: 684dbe6366e6; files: extensions/xiaomi/speech-provider.ts, extensions/xiaomi/speech-provider.test.ts)
  • William Woodruff: Recent release history credits William Woodruff with Xiaomi MiMo voice-design speech-provider work, making them relevant to the current provider behavior. citeturn17search3. (role: recent area contributor; confidence: medium; files: extensions/xiaomi/speech-provider.ts, extensions/xiaomi/speech-provider.test.ts)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

How this review workflow works
  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@steipete steipete self-assigned this Jul 16, 2026
@steipete
steipete force-pushed the fix-xiaomi-blank-api-key branch from 77f2efc to 0f164e7 Compare July 16, 2026 11:50
@openclaw-barnacle openclaw-barnacle Bot added size: S and removed size: XS triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. labels Jul 16, 2026
lsr911 and others added 2 commits July 16, 2026 12:55
A whitespace-only XIAOMI_API_KEY made the Xiaomi MiMo speech provider
report configured, then sent an unusable bearer credential from synthesis.

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

This matches the blank-credential guard applied in the OpenAI speech
provider (PR openclaw#108212).
@steipete
steipete force-pushed the fix-xiaomi-blank-api-key branch from 0f164e7 to 55dcbcd Compare July 16, 2026 11:55
@steipete

Copy link
Copy Markdown
Contributor

Maintainer proof complete for Xiaomi blank speech keys.

@steipete
steipete merged commit df7fcef into openclaw:main Jul 16, 2026
83 checks passed
@steipete

Copy link
Copy Markdown
Contributor

Merged via squash.

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
…er (openclaw#108558)

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

A whitespace-only XIAOMI_API_KEY made the Xiaomi MiMo speech provider
report configured, then sent an unusable bearer credential from synthesis.

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

This matches the blank-credential guard applied in the OpenAI speech
provider (PR openclaw#108212).

* refactor(xiaomi): centralize speech key resolution

---------

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]>
zooqueen pushed a commit to zooqueen/openclaw that referenced this pull request Sep 11, 2026
…er (openclaw#108558)

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

A whitespace-only XIAOMI_API_KEY made the Xiaomi MiMo speech provider
report configured, then sent an unusable bearer credential from synthesis.

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

This matches the blank-credential guard applied in the OpenAI speech
provider (PR openclaw#108212).

* refactor(xiaomi): centralize speech key resolution

---------

Co-authored-by: Peter Steinberger <[email protected]>
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

extensions: xiaomi P2 Normal backlog priority with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. size: S status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants