Summary
Once ~/.openwiki/.env holds a full set of credentials, there is no way to reconfigure them from the CLI. openwiki --init — which the README describes as "configure your model and API key, then generate documentation" — skips setup entirely and immediately fires an agent request against the existing key. A user whose key is dead (expired trial, exhausted quota, wrong tier) gets an error on boot and no path to switch keys.
Steps to reproduce
- Have a complete
~/.openwiki/.env (provider + API key + model + LANGSMITH_API_KEY), where the OpenAI key has no remaining quota.
- Run
openwiki --init.
Observed
The agent runs on mount and returns immediately:
* Error 429 You exceeded your current quota, please check your plan and billing details.
Credential diagnostics confirm every value is present and loaded, so setup is considered "done":
OPENWIKI_PROVIDER source=process.env over ~/.openwiki/.env preview="openai"
OPENAI_API_KEY source=process.env over ~/.openwiki/.env length=164
OPENWIKI_MODEL_ID source=process.env over ~/.openwiki/.env preview="gpt-5.4-mini"
LANGSMITH_API_KEY source=process.env over ~/.openwiki/.env length=0
There is no way to reach the key prompt again:
--init maps to command: "init" with shouldStart: true, so the App effect calls runOpenWikiAgent on mount (commands.ts, cli.tsx).
- The only pre-run interceptor is
shouldRunInteractiveCredentialSetup, gated on needsCredentialSetup(). That returns true only when provider / key / model / LangSmith are missing (credentials.ts). With a full .env, getInitialStep returns null and InitSetup completes without prompting.
- Interactive chat has no key command. Slash commands are
provider / model / init / update / clear / help / exit; /provider only writes the provider + default model and prints "ensure KEY is set" — nothing lets you enter an API key.
Net: InitSetup is only ever reachable as a side effect of missing credentials, and --init conflates "configure" with "generate docs."
Secondary: env-precedence footgun
loadOpenWikiEnv only sets process.env[key] when it is undefined, so an exported shell var wins over ~/.openwiki/.env (diagnostics: source=process.env over ~/.openwiki/.env). Editing the .env — or a future reconfigure flow — takes effect in the current process (setup patches process.env), but a fresh shell that still exports the old key silently reverts. Setup should warn when the key it saves is shadowed by an exported var.
Proposed fix
- Add a dedicated, side-effect-free config entry point (
openwiki --config) that renders InitSetup unconditionally and never starts an agent run.
- Give
InitSetup a reconfigure mode that walks every step even when values already exist, pre-selecting current values, so credentials are updated rather than skipped — and never nulls out settings the user leaves untouched.
- (Follow-ups) a
/key slash command for the in-session case; a hint on 429/insufficient_quota errors pointing at --config; the env-shadow warning above.
Summary
Once
~/.openwiki/.envholds a full set of credentials, there is no way to reconfigure them from the CLI.openwiki --init— which the README describes as "configure your model and API key, then generate documentation" — skips setup entirely and immediately fires an agent request against the existing key. A user whose key is dead (expired trial, exhausted quota, wrong tier) gets an error on boot and no path to switch keys.Steps to reproduce
~/.openwiki/.env(provider + API key + model +LANGSMITH_API_KEY), where the OpenAI key has no remaining quota.openwiki --init.Observed
The agent runs on mount and returns immediately:
Credential diagnostics confirm every value is present and loaded, so setup is considered "done":
There is no way to reach the key prompt again:
--initmaps tocommand: "init"withshouldStart: true, so the App effect callsrunOpenWikiAgenton mount (commands.ts,cli.tsx).shouldRunInteractiveCredentialSetup, gated onneedsCredentialSetup(). That returnstrueonly when provider / key / model / LangSmith are missing (credentials.ts). With a full.env,getInitialStepreturnsnullandInitSetupcompletes without prompting.provider / model / init / update / clear / help / exit;/provideronly writes the provider + default model and prints "ensure KEY is set" — nothing lets you enter an API key.Net:
InitSetupis only ever reachable as a side effect of missing credentials, and--initconflates "configure" with "generate docs."Secondary: env-precedence footgun
loadOpenWikiEnvonly setsprocess.env[key]when it isundefined, so an exported shell var wins over~/.openwiki/.env(diagnostics:source=process.env over ~/.openwiki/.env). Editing the.env— or a future reconfigure flow — takes effect in the current process (setup patchesprocess.env), but a fresh shell that still exports the old key silently reverts. Setup should warn when the key it saves is shadowed by an exported var.Proposed fix
openwiki --config) that rendersInitSetupunconditionally and never starts an agent run.InitSetupa reconfigure mode that walks every step even when values already exist, pre-selecting current values, so credentials are updated rather than skipped — and never nulls out settings the user leaves untouched./keyslash command for the in-session case; a hint on 429/insufficient_quotaerrors pointing at--config; the env-shadow warning above.