Skip to content

saveSettings writes unregistered champ.provider keys — 'Unable to write to User Settings' error #123

Description

@hellodk

After the YAML-only config migration (#118) removed the legacy champ.*
VS Code settings from package.json, two webview flows still write them:

  • webview-ui/static/main.js:166 (classic 'Save & Reload' settings panel)
  • webview-ui/static/main.js:2739 (Add-Model dialogue)

Both post a saveSettings message; the host handler in
src/ui/chat-view-provider.ts:489 calls
vscode.workspace.getConfiguration("champ").update("provider",…) and
champ.<provider>.model. Because champ.provider / champ.<provider>.model
/ champ.<provider>.baseUrl are no longer registered configuration keys,
VS Code throws Unable to write to User Settings because champ.provider is not a registered configuration.

Repro: type anything in the chat box → the settings overlay fires a save →
error surfaces.

Acceptance criteria:

  • The saveSettings handler persists provider/model/baseUrl to
    .champ/config.yaml (via upsertProviderInYaml, setActive: true) instead
    of VS Code global settings, then triggers champ.reloadProvider.
  • No champ.* VS Code setting write remains in the saveSettings path for
    provider, model, or baseUrl.
  • Failing test first: a test asserting the save writes the YAML block and
    never calls configuration.update for provider/<provider>.model.
  • Existing full suite stays green (no regressions live behind the chat box).

Tests required:

  • unit test: persistProviderToYaml upserts provider+model+baseUrl into
    config.yaml and marks it active
  • unit test: saveSettings path invokes reload (no config.update writes)
  • full unit suite green

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions