Skip to content

fix: claw setup writes model at wrong JSON level#2814

Closed
TheArchitectit wants to merge 3 commits into
ultraworkers:mainfrom
TheArchitectit:fix/setup-writer-model-location
Closed

fix: claw setup writes model at wrong JSON level#2814
TheArchitectit wants to merge 3 commits into
ultraworkers:mainfrom
TheArchitectit:fix/setup-writer-model-location

Conversation

@TheArchitectit
Copy link
Copy Markdown

Summary

  • Fix claw setup wizard writing model inside the provider object instead of at the top level of settings.json
  • parse_optional_model reads from the top level, so the model setting was silently ignored after running claw setup
  • Also remove the top-level model key when clearing provider settings

Before

{
  "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 build
  • Run claw setup, select a provider and model, verify model appears at top level in ~/.claw/settings.json
  • Run claw /status and verify the model is reflected
  • Run clear_user_provider_settings path and verify both provider and top-level model are removed

💘 Generated with Crush

TheArchitectit and others added 3 commits April 27, 2026 10:31
…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.
@TheArchitectit
Copy link
Copy Markdown
Author

Fix added to #2810 instead

@TheArchitectit TheArchitectit deleted the fix/setup-writer-model-location branch April 27, 2026 15:36
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.

1 participant