Skip to content

Model/provider allow list to deny list#799

Merged
chrarnoldus merged 22 commits intomainfrom
christiaan/deny-list
Mar 6, 2026
Merged

Model/provider allow list to deny list#799
chrarnoldus merged 22 commits intomainfrom
christiaan/deny-list

Conversation

@chrarnoldus
Copy link
Copy Markdown
Contributor

@chrarnoldus chrarnoldus commented Mar 4, 2026

Data is already migrated in prod
Did some testing

Comment thread src/lib/slack-bot/model-allow-list.ts Outdated
Comment thread src/lib/slack-bot/model-allow-list.ts Outdated
Comment thread src/lib/llm-proxy-helpers.ts
Comment thread src/app/api/organizations/[id]/defaults/route.ts Outdated
@kilo-code-bot
Copy link
Copy Markdown
Contributor

kilo-code-bot Bot commented Mar 4, 2026

Code Review Summary

Status: 1 Issue Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 1
SUGGESTION 0
Issue Details (click to expand)

WARNING

File Line Issue
src/routers/organizations/organization-settings-router.ts 225 Provider-only deny-list updates can leave a blocked default_model persisted

Fix these issues in Kilo Cloud

Other Observations (not in diff)

N/A

Files Reviewed (32 files)
  • packages/db/src/schema-types.ts - 0 issues
  • src/app/api/organizations/[id]/defaults/route.test.ts - 0 issues
  • src/app/api/organizations/[id]/defaults/route.ts - 0 issues
  • src/components/models/CondensedProviderAndModelsList.tsx - 0 issues
  • src/components/organizations/OrganizationProvidersAndModelsConfigurationCard.test.ts - 0 issues
  • src/components/organizations/OrganizationProvidersAndModelsConfigurationCard.tsx - 0 issues
  • src/components/organizations/providers-and-models/DefaultModelDialog.tsx - 0 issues
  • src/components/organizations/providers-and-models/OrganizationProvidersAndModelsPage.tsx - 0 issues
  • src/components/organizations/providers-and-models/ProviderDetailsDialog.tsx - 0 issues
  • src/components/organizations/providers-and-models/allowLists.domain.test.ts - 0 issues
  • src/components/organizations/providers-and-models/allowLists.domain.ts - 0 issues
  • src/components/organizations/providers-and-models/useOrganizationConfiguration.ts - 0 issues
  • src/components/organizations/providers-and-models/useProvidersAndModelsAllowListsState.test.ts - 0 issues
  • src/components/organizations/providers-and-models/useProvidersAndModelsAllowListsState.ts - 0 issues
  • src/lib/integrations/discord-service.ts - 0 issues
  • src/lib/integrations/slack-service.ts - 0 issues
  • src/lib/llm-proxy-helpers.test.ts - 0 issues
  • src/lib/llm-proxy-helpers.ts - 0 issues
  • src/lib/model-allow.client.test.ts - 0 issues
  • src/lib/model-allow.client.ts - 0 issues
  • src/lib/model-allow.server.test.ts - 0 issues
  • src/lib/model-allow.server.ts - 0 issues
  • src/lib/model-allow.shared.ts - 0 issues
  • src/lib/models.ts - 0 issues
  • src/lib/organizations/organization-usage.test.ts - 0 issues
  • src/lib/providers/index.ts - 0 issues
  • src/lib/providers/openrouter/types.ts - 0 issues
  • src/lib/providers/vercel/index.ts - 0 issues
  • src/lib/slack-bot/model-allow-list.ts - 0 issues
  • src/routers/organizations/organization-settings-router.test.ts - 0 issues
  • src/routers/organizations/organization-settings-router.ts - 1 issue
  • src/scripts/orgs/fill-deny-lists.ts - 0 issues

Comment thread src/lib/model-allow.server.ts Outdated
Comment thread src/components/organizations/OrganizationProvidersAndModelsConfigurationCard.tsx Outdated
Comment thread src/lib/llm-proxy-helpers.ts Outdated
Comment thread src/routers/organizations/organization-settings-router.ts Outdated
Comment thread src/routers/organizations/organization-settings-router.ts
Comment thread src/components/organizations/OrganizationProvidersAndModelsConfigurationCard.tsx Outdated
Comment thread src/routers/organizations/organization-settings-router.ts Outdated
Comment thread src/app/api/organizations/[id]/defaults/route.ts Outdated
Comment thread src/lib/providers/vercel/index.ts
@chrarnoldus chrarnoldus changed the title [draft] model/provider allow list to deny list Model/provider allow list to deny list Mar 6, 2026
@chrarnoldus chrarnoldus requested a review from iscekic March 6, 2026 15:01
// Check if default_model needs to be cleared
if (
model_allow_list !== undefined &&
settingsUpdate.model_deny_list !== undefined &&
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WARNING: Provider-only deny-list updates can leave a blocked default model persisted

This guard only revalidates default_model when model_deny_list is defined and non-empty. If an org has no model deny list and the update only adds provider_deny_list entries that disable every provider for the current default, the stale default_model survives the mutation even though createAllowPredicateFromDenyList() would now reject it. That leaves the saved settings inconsistent until a later read path happens to fall back.

@chrarnoldus chrarnoldus merged commit 0c4e090 into main Mar 6, 2026
13 checks passed
@chrarnoldus chrarnoldus deleted the christiaan/deny-list branch March 6, 2026 16:24
chrarnoldus added a commit that referenced this pull request Mar 9, 2026
…930)

## Summary

- Fixes a bug where updating only `provider_deny_list` could leave a
now-blocked `default_model` persisted in org settings.
- Previously, the revalidation guard only fired when `model_deny_list`
was included in the update and non-empty, so a provider-only deny-list
update that blocked every provider for the current default model would
silently leave the stale value in the DB.
- The fix checks both deny lists: the guard now triggers when either
`model_deny_list` or `provider_deny_list` is part of the update, and
uses the effective (post-update) values of both lists to evaluate
whether `default_model` is still allowed.

Addresses:
#799 (comment)

## Verification

- Reviewed the diff and logic manually; the
`effectiveModelDenyList`/`effectiveProviderDenyList` fallback to `[]`
ensures `createAllowPredicateFromDenyList` receives the correct
post-update state regardless of which list was updated.
- Could not run automated tests (node_modules unavailable in this
environment).

## Visual Changes

N/A

## Reviewer Notes

The inner `if (effectiveModelDenyList.length > 0 ||
effectiveProviderDenyList.length > 0)` guard preserves the original
behaviour of skipping the async predicate check when both lists are
empty (i.e. deny lists are being fully cleared — in that case all models
become allowed, so no need to clear `default_model`).
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.

2 participants