Repository navigation
Conversation
Submitting the first-run key prompt empty saved OPENAI_KEY=undefined to ~/.micro-agent, so every later run sent "undefined" as the API key and failed with a 401 without ever asking for the key again. Validate the key in the first-run prompt and in the config UI (which crashed on an empty submit because the value is undefined), and trim it before saving. Fixes BuilderIO#78
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Pressing Enter at the "What is your OpenAI key?" first-run prompt without typing anything saved
OPENAI_KEY=undefinedto~/.micro-agent. After that every run sent the literal string "undefined" as the key and failed with a 401, and since a key was now "set" the prompt never came back. This adds validation to that prompt so an empty or whitespace key isn't accepted, and trims the key before saving. It also fixes the key validator inmicro-agent config, which threw on an empty submit because the value isundefinedthere.Fixes #78
Tests
interactive-mode.test.ts: the validator rejects empty input, the key is saved trimmed, and you aren't prompted when a key already exists.npm run lintandnpm testpass (55 passed).