Sonarly Claude Code 498770b7b4 fix: refresh AI model registry when config variables are updated via admin panel
https://sonarly.com/issue/22695?type=bug

Setting AI provider API keys through the admin panel's config variables UI stores the value in the database but does not rebuild the AI model registry, leaving all AI features broken until the server restarts.

Fix: Added `this.aiModelRegistryService.refreshRegistry()` calls to the three generic config variable mutations in `admin-panel.resolver.ts`:
- `createDatabaseConfigVariable` — called when a user sets a new config variable (e.g., `MISTRAL_API_KEY`) via the admin panel
- `updateDatabaseConfigVariable` — called when updating an existing config variable
- `deleteDatabaseConfigVariable` — called when removing a config variable

These mutations are the code path that the admin panel UI routes users through when setting AI provider API keys for catalog providers (like Mistral, OpenAI, Anthropic). The AI provider detail page shows the `apiKeyConfigVariable` as a link to the config variable settings page, where users enter their API key.

Previously, only the AI-specific mutations (`addAiProvider`, `removeAiProvider`, `addModelToProvider`, `removeModelFromProvider`) called `refreshRegistry()`. The generic config variable mutations did not, which meant the AI model registry remained stale after API keys were saved — it was still using the initial state from server startup where the key was undefined.

The fix follows the exact same pattern already used 4 times in the same file. The `refreshRegistry()` call is synchronous and rebuilds in-memory maps, making it safe and cheap to call on every config variable change (which are rare admin-only operations).
2026-04-08 02:43:43 +00:00
2025-08-07 17:02:12 +02:00
2026-04-07 11:44:23 +00:00

Twenty logo

The #1 Open-Source CRM

🌐 Website · 📚 Documentation · Roadmap · Discord · Figma


Cover


Installation

See: 🚀 Self-hosting 🖥️ Local Setup

Why Twenty

We built Twenty for three reasons:

CRMs are too expensive, and users are trapped. Companies use locked-in customer data to hike prices. It shouldn't be that way.

A fresh start is required to build a better experience. We can learn from past mistakes and craft a cohesive experience inspired by new UX patterns from tools like Notion, Airtable or Linear.

We believe in open-source and community. Hundreds of developers are already building Twenty together. Once we have plugin capabilities, a whole ecosystem will grow around it.


What You Can Do With Twenty

Please feel free to flag any specific needs you have by creating an issue.

Below are a few features we have implemented to date:

Personalize layouts with filters, sort, group by, kanban and table views

Companies Kanban Views

Customize your objects and fields

Setting Custom Objects

Create and manage permissions with custom roles

Permissions

Automate workflow with triggers and actions

Workflows

Emails, calendar events, files, and more

Other Features


Stack

Thanks

Chromatic Greptile Sentry Crowdin E2B

Thanks to these amazing services that we use and recommend for UI testing (Chromatic), code review (Greptile), catching bugs (Sentry) and translating (Crowdin).

Join the Community

Languages
TypeScript 78%
MDX 18.5%
JavaScript 3.1%
Python 0.2%