Repository navigation
Conversation
… config
oai login, list and logout used to load the configuration with the
server's full checks, so a fresh "openai": {} failed with
"openai.api_key is required" before oai login could write the auth
setting it exists to write. ts login had the same problem with unrelated
settings such as database_url. config.Load now only reads the
configuration; rocketclaw run validates it in full, ts login checks only
web.tsnet, and the oai commands check only that the provider exists.
With --aws-secrets-manager-arn, oai login now writes only
"auth": "chatgpt" into the local config file, adding the provider's
entry and creating the file (mode 0600) when needed, so a provider kept
only in the secret can switch to ChatGPT. If the secret itself sets that
provider's auth to something else, the command stops before the sign-in
starts; if the secret already says chatgpt, it only saves the token. The
restart hint now follows the merged auth, and the help texts and README
list the flag.
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.
Summary
rocketclaw oai loginexists to switch a provider to ChatGPT sign-in, but it refused to run until the whole server configuration was valid. A fresh"openai": {}failed withopenai.api_key is required when openai.auth is api_key, which is the very setting the command writes. When the provider lived only in the AWS secret, or there was no local config file, the command failed after you had already finished signing in in the browser.rocketclaw ts loginwas also blocked by settings it does not use, such asdatabase_url.What changes
oai login,oai list, andoai logoutnow check only that the provider exists.ts loginchecks only theweb.tsnetsettings. Missing server settings such asdatabase_urlno longer block them.rocketclaw runstill checks the whole configuration as before.auth. With"openai": {}, or with noopenaientry at all,oai loginsigns in and writes"auth": "chatgpt". A named provider needs only an entry such as"providers": {"work": {}}.--aws-secrets-manager-arn,oai loginwrites only"auth": "chatgpt"for the provider into the local config file. It adds the provider's entry if needed and creates the file with mode 0600 when there is none. The secret is not changed.authto anything other thanchatgpt, the secret would win. In that caseoai loginstops before the sign-in starts and says to change the setting in the secret. If the secret already sayschatgpt, the command saves only the credentials and does not touch the file.unknown provider.oai listnow show the provider's effective sign-in mode after the file and the secret are merged.provider "…" is no longer configured, so the command does not bring it back.oaiandtshelp texts and the README now list--aws-secrets-manager-arnand describe the first-time setup and the AWS behaviour.Verification
cmd/rocketclaw/oai_test.go:TestRunOAILoginSetsUpChatGPTcovers four cases: a fresh"openai": {}; a secret-onlyopenaiwith no local file; a secret-only named provider with no local file; and a secret-only named provider missing from an existing file, whose other keys are kept. Each case checks the file contents, mode 0600, the saved credentials, and the restart hint. The fresh-config case fails on the old code with a configuration error.TestRunOAILoginRejectsBeforeOAuthcovers an unknown provider, with and without a secret, and a secret that setsapi_keyfor the default or a named provider. It checks that no sign-in request was made, that the file is unchanged, and that no credentials were saved.TestRunOAILoginLeavesConfigAloneWhenSecretUsesChatGPTchecks that no file is created and the credentials are saved.TestRunOAIListIgnoresServerOnlySettingschecks thatoai listworks withoutdatabase_urlorweb.tsnet.TestTailnetLoginnow runsts loginwith a config that holds onlyweb.tsnet.TestRunTSchecks thatts loginstill rejects a badweb.tsnet.hostname.saveOAILogintests and the config tests that relied onconfig.Loadrunning the server checks.make -C internal/rocketclaw lintandmake -C internal/rocketclaw testpass (coverage: 92.1%, above the required 91.8%).