Skip to content

fix: reject "cancel" from being saved as OpenAI API key#87

Open
dotsetgreg wants to merge 1 commit intoBuilderIO:mainfrom
dotsetgreg:fix/reject-cancel-as-api-key
Open

fix: reject "cancel" from being saved as OpenAI API key#87
dotsetgreg wants to merge 1 commit intoBuilderIO:mainfrom
dotsetgreg:fix/reject-cancel-as-api-key

Conversation

@dotsetgreg
Copy link

Summary

  • Adds normalizeOpenAiKey() and hasOpenAiKey() helpers to validate and trim API keys
  • Rejects empty, whitespace-only, and "cancel" values in both the interactive mode prompt and the config UI
  • Improves UX with clear validation messages and hint to use Ctrl+C to cancel
  • Adds unit and integration tests for the new validation logic

Fixes #78

Test plan

  • Unit tests for normalizeOpenAiKey and hasOpenAiKey
  • Unit test for getOpenAi rejecting "cancel" as key
  • Integration test verifying the key prompt reappears when config contains "cancel"
  • All existing tests continue to pass

🤖 Generated with Claude Code

When a user presses Enter or cancels the API key prompt, the string
"cancel" was saved as the OPENAI_KEY, causing a 401 error on the next
run. This adds validation to reject empty and "cancel" inputs, normalizes
keys by trimming whitespace, and applies the same validation to both
the interactive mode prompt and the config UI.

Fixes BuilderIO#78

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.

When I enter with out adding an api key.

1 participant