Skip to content

fix(gradium): treat blank env API key as unconfigured in synthesis paths - #108800

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

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

Conversation

@lsr911

@lsr911 lsr911 commented Jul 16, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

A whitespace-only GRADIUM_API_KEY could be treated differently by readiness, normal synthesis, and telephony synthesis. The synthesis paths could pass unusable credentials toward the Gradium API.

Why This Change Was Made

  • Add one Gradium API-key resolver backed by the shared speech-provider key helper
  • Use it for readiness, normal synthesis, and telephony synthesis
  • Normalize config and environment candidates consistently
  • Reject blank credentials before building or dispatching a request

User Impact

  • Before: whitespace-only credentials could pass a synthesis key guard and fail later as a request
  • After: all Gradium entrypoints treat blank credentials as missing

Evidence

Risk / Compatibility

Low. Only surrounding whitespace and blank credential values are normalized. Valid config credentials still take precedence over the environment.

@openclaw-barnacle openclaw-barnacle Bot added extensions: gradium 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: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. 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 16, 2026, 5:08 AM ET / 09:08 UTC.

Summary
The PR normalizes GRADIUM_API_KEY before Gradium file and telephony synthesis and adds a regression test for whitespace-only environment credentials.

PR surface: Source 0, Tests +22. Total +22 across 2 files.

Reproducibility: yes. from source: set GRADIUM_API_KEY to whitespace and call either synthesis entry point; the current bare environment lookup treats that value as present. The supplied review did not execute a real Gradium setup, so this is source-reproducible rather than independently reproduced.

Review metrics: none identified.

Merge readiness
Overall: 🧂 unranked krab
Proof: 🧂 unranked krab
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 a whitespace-only Gradium key fails locally before any network request.

Proof guidance:

  • [P1] Needs real behavior proof before merge: Only unit-test evidence is supplied; add redacted terminal, logs, or live output proving local rejection before HTTP dispatch, then update the PR body to trigger review or ask a maintainer for @clawsweeper re-review.

Risk before merge

  • [P1] No after-fix real setup evidence shows that a whitespace-only key is rejected before Gradium network dispatch.
  • [P1] The new blank-key assertion directly exercises file synthesis; the telephony edit is structurally identical but lacks its own blank-key regression assertion.

Maintainer options:

  1. Decide the mitigation before merge
    Keep the shared trimToUndefined normalization in both synthesis paths, retain focused regression coverage, and add redacted terminal or live output proving that whitespace-only credentials fail locally before any HTTP request.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Next step before merge

  • [P1] No automated repair job is appropriate because the remaining merge blocker is contributor-supplied real behavior proof rather than a concrete patch defect.

Security
Cleared: The patch narrows credential handling by rejecting blank bearer values locally and introduces no dependency, workflow, permission, or secret-exposure change.

Review details

Best possible solution:

Keep the shared trimToUndefined normalization in both synthesis paths, retain focused regression coverage, and add redacted terminal or live output proving that whitespace-only credentials fail locally before any HTTP request.

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

Yes, from source: set GRADIUM_API_KEY to whitespace and call either synthesis entry point; the current bare environment lookup treats that value as present. The supplied review did not execute a real Gradium setup, so this is source-reproducible rather than independently reproduced.

Is this the best way to solve the issue?

Yes. Normalizing the credential at both request-time resolution points is the narrowest maintainable fix and matches the existing isConfigured contract without adding configuration or fallback behavior.

AGENTS.md: found and applied where relevant.

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

Label changes

Label changes:

  • add P2: This is a narrow Gradium TTS correctness improvement with limited blast radius and no evidence of a broader outage or urgent regression.
  • add rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab 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: Only unit-test evidence is supplied; add redacted terminal, logs, or live output proving local rejection before HTTP dispatch, then update the PR body to trigger review or ask a maintainer for @clawsweeper re-review.

Label justifications:

  • P2: This is a narrow Gradium TTS correctness improvement with limited blast radius and no evidence of a broader outage or urgent regression.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab 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: Only unit-test evidence is supplied; add redacted terminal, logs, or live output proving local rejection before HTTP dispatch, then update the PR body to trigger review or ask a maintainer for @clawsweeper re-review.
Evidence reviewed

PR surface:

Source 0, Tests +22. Total +22 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 2 2 0
Tests 1 22 0 +22
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 24 2 +22

What I checked:

Likely related people:

  • moguangyu5-design: Authored the immediately preceding merged Gradium configuration-safety change in the same provider and test files. (role: recent same-file contributor; confidence: high; commits: cf8cfa83222a; files: extensions/gradium/speech-provider.ts, extensions/gradium/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
lsr911 and others added 2 commits July 16, 2026 14:20
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
steipete force-pushed the fix-gradium-blank-api-key branch from 17c3bd4 to cc493b8 Compare July 16, 2026 13:22
@openclaw-barnacle openclaw-barnacle Bot removed the triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. label Jul 16, 2026
@steipete

Copy link
Copy Markdown
Contributor

Maintainer proof complete on head cc493b8108aecb70af1d14f974f50e6b614e9211.

@steipete
steipete merged commit d2e9fa2 into openclaw:main Jul 16, 2026
90 of 93 checks passed
@steipete

Copy link
Copy Markdown
Contributor

Merged via squash.

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
…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: gradium 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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants