Skip to content

fix(ui): handle SecretInput union in config form analyzer#31866

Merged
steipete merged 2 commits intoopenclaw:mainfrom
ningding97:fix/31490-config-form-secret
Mar 2, 2026
Merged

fix(ui): handle SecretInput union in config form analyzer#31866
steipete merged 2 commits intoopenclaw:mainfrom
ningding97:fix/31490-config-form-secret

Conversation

@ningding97
Copy link

Summary

Fix Config Form view marking models.providers as unsupported due to SecretInputSchema union.

Root Cause

SecretInputSchema creates a oneOf union (string | secret-ref object) that the form analyzer cannot handle, causing it to mark the entire providers section as unsupported.

Fix

  • Add isSecretRefUnion() detection for secret-ref object variants
  • Normalize secret-input unions to plain string type for form display
  • Users can still enter API keys as strings; secret-ref resolution happens at runtime

Closes #31490

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Mar 2, 2026

Greptile Summary

This PR fixes the config form analyzer incorrectly marking models.providers as unsupported due to the SecretInputSchema union type (string | secret-ref object).

Key Changes:

  • Added isSecretRefVariant() to detect secret-ref object schemas with source/provider/id properties
  • Added isSecretRefUnion() to identify unions containing only secret-ref variants
  • Added normalizeSecretInputUnion() to normalize secret-input unions to plain string types for form display
  • Integrated normalization into normalizeUnion() before literal handling
  • Added comprehensive test case validating the fix with models.providers.*.apiKey

Impact:
Users can now edit API keys and other secret fields in the config form UI. The form displays them as string inputs while preserving the underlying union type structure for runtime secret-ref resolution.

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • The fix is well-implemented with clear logic, follows existing code patterns, and includes thorough test coverage. The changes are minimal and targeted to the specific issue. The logic correctly identifies and normalizes the SecretInput union structure without affecting other union types.
  • No files require special attention

Last reviewed commit: ab38274

ningding97 and others added 2 commits March 2, 2026 18:34
The config form marks models.providers as unsupported because
SecretInputSchema creates a oneOf union that the form analyzer
cannot handle. Add detection for secret-ref union variants and
normalize them to plain string inputs for form display.

Closes openclaw#31490
@steipete steipete force-pushed the fix/31490-config-form-secret branch from ab38274 to 49f8232 Compare March 2, 2026 18:35
@steipete steipete merged commit 534168a into openclaw:main Mar 2, 2026
9 checks passed
@steipete
Copy link
Contributor

steipete commented Mar 2, 2026

Landed via temp rebase onto main.

  • Gate: pnpm --dir ui test src/ui/config-form.browser.test.ts -t "supports SecretInput unions in additionalProperties maps"
  • Land commit: 49f8232
  • Merge commit: 534168a

Thanks @ningding97!

execute008 pushed a commit to execute008/openclaw that referenced this pull request Mar 2, 2026
dawi369 pushed a commit to dawi369/davis that referenced this pull request Mar 3, 2026
OWALabuy pushed a commit to kcinzgg/openclaw that referenced this pull request Mar 4, 2026
zooqueen pushed a commit to hanzoai/bot that referenced this pull request Mar 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Config Form view marks models.providers as unsupported due to SecretInputSchema union

2 participants