fix: claw setup writes model at wrong JSON level#2814
Closed
TheArchitectit wants to merge 3 commits into
Closed
Conversation
…rl+P Adds an interactive setup wizard that lets users configure their provider, API key, base URL, and model without setting environment variables. Configuration is persisted to ~/.claw/settings.json (with 0600 permissions). New features: - `claw setup` CLI subcommand runs the wizard from the terminal - `/setup` slash command runs the wizard inside the REPL (hot-swaps model) - Ctrl+P hotkey in the REPL triggers /setup for in-session provider swap - Stored provider config used as fallback when env vars are absent - Three-tier auth resolution: env var > .env file > stored config - RuntimeProviderConfig struct and validation in settings schema Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Ctrl+P now inserts a sentinel char (\x01) that the highlighter renders as a cyan "[Provider Swap]" prompt. User presses Enter to confirm and launch the setup wizard. Returns ReadOutcome::ProviderSwap so the REPL loop can hot-swap the model and reprint the connection line. Also fixes clippy warnings: merged duplicate match arms in provider_config_value, doc_markdown on ProviderKind, map_unwrap_or idioms in setup_wizard.rs, and pre-existing clippy issues in main.rs and commands/lib.rs. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…ider The setup wizard wrote `model` inside the `provider` object, but `parse_optional_model` reads it from the top level. This caused the model setting to be silently ignored after `claw setup`. Also clean up the top-level `model` key when clearing provider settings.
Author
|
Fix added to #2810 instead |
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
claw setupwizard writingmodelinside theproviderobject instead of at the top level ofsettings.jsonparse_optional_modelreads from the top level, so the model setting was silently ignored after runningclaw setupmodelkey when clearing provider settingsBefore
{ "provider": { "kind": "openai", "apiKey": "...", "baseUrl": "...", "model": "glm-5.1-fast" ← ignored by parser } }After
{ "model": "glm-5.1-fast", ← read correctly by parser "provider": { "kind": "openai", "apiKey": "...", "baseUrl": "..." } }Test plan
cargo build --release— clean buildclaw setup, select a provider and model, verifymodelappears at top level in~/.claw/settings.jsonclaw /statusand verify the model is reflectedclear_user_provider_settingspath and verify bothproviderand top-levelmodelare removed💘 Generated with Crush