Skip to content

fix: persist chat settings to config.yaml, not unregistered VS Code keys - #124

Merged
hellodk merged 2 commits into
masterfrom
fix/save-settings-yaml
Aug 30, 2026
Merged

fix: persist chat settings to config.yaml, not unregistered VS Code keys#124
hellodk merged 2 commits into
masterfrom
fix/save-settings-yaml

Conversation

@hellodk

@hellodk hellodk commented Aug 28, 2026

Copy link
Copy Markdown
Owner

Problem

The in-webview settings overlay and Add-Model dialogue posted a saveSettings
message whose host handler wrote champ.provider and champ.<provider>.model/
baseUrl to VS Code global settings. Those keys were removed from package.json
in the YAML-only migration (#118), so any interaction surfaced:

Unable to write to User Settings because champ.provider is not a registered configuration.

Fix

saveSettings now writes the provider/model/baseUrl block into
.champ/config.yaml (workspace, or ~/.champ fallback) via
upsertProviderInYaml with setActive, then reloads. It no longer touches VS
Code settings for provider/model/baseUrl.

Tests

  • 2 new unit tests in test/unit/ui/chat-view-provider.test.ts
  • Full suite: 1745 passed, 5 skipped
  • check-types clean, lint 0 errors (3 pre-existing warnings)

Closes #123

The in-webview settings overlay and Add-Model dialogue posted a
saveSettings message whose host handler wrote champ.provider and
champ.<provider>.model/baseUrl to VS Code global settings. Those keys
were removed from package.json in the YAML-only migration (#118), so any
interaction surfaced "Unable to write to User Settings because
champ.provider is not a registered configuration."

saveSettings now writes the provider/model/baseUrl block into
.champ/config.yaml (workspace or ~/.champ fallback) via upsertProviderInYaml
with setActive, then reloads — never touching VS Code settings.

Closes #123
The in-webview "Add Model" discovery fetch sent no Authorization header,
so a key-required endpoint (MLX/OpenAI-compatible, vLLM) returned 401 and
the UI showed "Connected · 0 models found" even though chat worked.

The discovery probe now resolves the provider's apiKey (YAML config, then
SecretStorage) via a new ChatViewProvider.setApiKeyResolver and sends it as
Authorization: Bearer on /v1/models — mirroring the extension's probe fix.

Refs #123
@hellodk

hellodk commented Aug 30, 2026

Copy link
Copy Markdown
Owner Author

Added a second fix to this branch: the model-discovery probe now sends the provider's apiKey as Authorization: Bearer (commit 8f8a2ef), so key-required endpoints like the MLX server show their models instead of '0 models found'. Tests: 1747 passed / 5 skipped.

@hellodk
hellodk merged commit f84e6cb into master Aug 30, 2026
4 of 6 checks passed
hellodk added a commit that referenced this pull request Aug 30, 2026
- single source of config (~/.champ/config.yaml only) — #126
- standard codicons in the mode picker — #125
- provider discovery auth + config persistence fixes — #123/#124
@hellodk
hellodk deleted the fix/save-settings-yaml branch August 31, 2026 01:28
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.

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

1 participant