Skip to content

fix: avoid stale lastProvider after config wizard completion#477

Open
electricwolfemarshmallowhypertext wants to merge 1 commit intoNano-Collective:mainfrom
electricwolfemarshmallowhypertext:fix-460-provider-init
Open

fix: avoid stale lastProvider after config wizard completion#477
electricwolfemarshmallowhypertext wants to merge 1 commit intoNano-Collective:mainfrom
electricwolfemarshmallowhypertext:fix-460-provider-init

Conversation

@electricwolfemarshmallowhypertext
Copy link
Copy Markdown

Description

Fixes post-config-wizard initialization failure caused by passing a stale preferences.lastProvider into createLLMClient.

After saving a new config, the previous provider may no longer exist in agents.config.json, resulting in a ConfigurationError.

This change removes the explicit stale provider and allows createLLMClient() to resolve against the freshly loaded config.

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update

Testing

Automated Tests

  • New features include passing tests in .spec.ts/tsx files
  • All existing tests pass (pnpm test:all completes successfully)
  • Tests cover both success and error scenarios

Manual Testing

  • Tested with Ollama
  • Tested with OpenRouter
  • Tested with OpenAI-compatible API
  • Tested MCP integration (if applicable)

Checklist

  • Code follows project style guidelines
  • Self-review completed
  • Documentation updated (if needed)
  • No breaking changes (or clearly documented)
  • Appropriate logging added using structured logging (see [CONTRIBUTING.md](../CONTRIBUTING.md#logging))

Fixes #460.

This prevents post-config-wizard initialization from passing a stale preferences.lastProvider into createLLMClient.

After the wizard saves a new config, the previous lastProvider may no longer exist in agents.config.json, causing:

ConfigurationError: Provider 'GitHub Models' not found in agents.config.json

Calling createLLMClient() without the stale explicit provider lets the client resolve against the freshly loaded config and initialize correctly.

Confirmed locally:

  • GitHub Copilot config saved successfully
  • post-wizard initialization no longer throws the stale provider mismatch
  • next prompt is Copilot auth, which is expected

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.

[Bug] Failed to initialize with new configuration: ConfigurationError

1 participant