Skip to content

fix(models): allow deleting synced/fetched models (e.g. llamacpp) via DELETE /api/provider-models - #3204

Merged
diegosouzapw merged 12 commits into
cheaper-inference:release/v3.8.11from
wilsonicdev:fix/llamacpp-model-delete
Jun 5, 2026
Merged

diegosouzapw merged 12 commits into
cheaper-inference:release/v3.8.11from
wilsonicdev:fix/llamacpp-model-delete

Conversation

@wilsonicdev

Copy link
Copy Markdown
Contributor

Fixes #3199.

Problem

Models fetched from providers like llamacpp are stored in the
'syncedAvailableModels' namespace (key = providerId:connectionId).
The DELETE /api/provider-models handler only called removeCustomModel(),
which operates on the 'customModels' namespace. Since fetched models are
never in customModels, removeCustomModel() returned false and the model
remained visible after deletion.

Fix

  1. Added removeSyncedAvailableModel() in src/lib/db/models.ts that scans
    all connection-scoped synced model lists for a provider, removes the
    target model, and deletes the key if the list becomes empty.
  2. Exported it through src/lib/localDb.ts.
  3. Updated DELETE handler in src/app/api/provider-models/route.ts to
    call both removeCustomModel() and removeSyncedAvailableModel(),
    returning true if either succeeds.

Tests

Added tests/unit/llamacpp-model-delete.test.ts with 3 assertions:

  • removeSyncedAvailableModel deletes a model from multiple connections
  • removeSyncedAvailableModel deletes the key when a connection becomes empty
  • removeSyncedAvailableModel returns false when model does not exist

All 3 pass.

diegosouzapw and others added 10 commits June 4, 2026 06:36
Bump 3.8.9 → 3.8.10 across package.json, lockfile, electron, open-sse, and
docs/reference/openapi.yaml; add the [3.8.10] CHANGELOG section (root + 41 i18n
mirrors) as the integration target for the cycle. Entries land here as work
merges into release/v3.8.10; finalized by the release flow.
Assign unique aliases to HuggingChat, Kimi Web, and Qwen Web so they no longer shadow primary providers or trigger startup warnings.

Add a unit test to enforce provider alias uniqueness and prevent future collisions. Also expand local ignore and VS Code exclude rules for agent, build, and worktree artifacts.
Normalize image_url parts across all Responses input paths. Integrated into release/v3.8.10.
Preserve API key expiration local time + clear button. Integrated into release/v3.8.10.
Strip previous_response_id for stateless Responses upstreams (auto/strip/preserve). Integrated into release/v3.8.10.
…(#3138)

Map caps.thinking to ModelV2.capabilities.interleaved for opencode-plugin. Integrated into release/v3.8.10.
Use synced models as authoritative local catalog for all providers (+regression test). Integrated into release/v3.8.10.
…I key→dashscope (#3149)

Bifurcate Qoder validation by token type (PAT→Cosy, regular→dashscope) +regression test. Integrated into release/v3.8.10.
Dynamic antigravity MITM model resolution in the executor (+bug fix +regression test; DB import dropped from client-reachable config). Integrated into release/v3.8.10.
Podman deployment options + larger upload body-size limits (+CONTAINER_HOST docs). Integrated into release/v3.8.10.
@wilsonicdev
wilsonicdev requested a review from diegosouzapw as a code owner June 5, 2026 04:52
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

Comment thread src/lib/db/models.ts Resolved
Comment thread src/lib/db/models.ts Resolved
Comment thread src/lib/db/models.ts Resolved
@kilo-code-bot

kilo-code-bot Bot commented Jun 5, 2026 •

Copy link
Copy Markdown

Code Review Summary

Status: 3 Issues Found | Recommendation: Address before merge

Overview

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

CRITICAL

File Line Issue
src/lib/db/models.ts 748 Missing transaction for multi-write operation

WARNING

File Line Issue
src/lib/db/models.ts 752 Unhandled JSON.parse error

SUGGESTION

File Line Issue
src/lib/db/models.ts 767 Backup should be inside transaction
Files Reviewed (3 files)
  • src/lib/db/models.ts - 3 issues
  • src/app/api/provider-models/route.ts - No issues
  • tests/unit/llamacpp-model-delete.test.ts - No issues (good test coverage)

Reviewed by step-3.7-flash-20260528 · 870,002 tokens

… DELETE /api/provider-models

Fixes #3199.

## Problem
Models fetched from providers like llamacpp are stored in the
'syncedAvailableModels' namespace (key = providerId:connectionId).
The DELETE /api/provider-models handler only called removeCustomModel(),
which operates on the 'customModels' namespace. Since fetched models are
never in customModels, removeCustomModel() returned false and the model
remained visible after deletion.

## Fix
1. Added removeSyncedAvailableModel() in src/lib/db/models.ts that scans
   all connection-scoped synced model lists for a provider, removes the
   target model, and deletes the key if the list becomes empty.
2. Exported it through src/lib/localDb.ts.
3. Updated DELETE handler in src/app/api/provider-models/route.ts to
   call both removeCustomModel() and removeSyncedAvailableModel(),
   returning true if either succeeds.

## Tests
Added tests/unit/llamacpp-model-delete.test.ts with 3 assertions:
- removeSyncedAvailableModel deletes a model from multiple connections
- removeSyncedAvailableModel deletes the key when a connection becomes empty
- removeSyncedAvailableModel returns false when model does not exist

All 3 pass.
@wilsonicdev
wilsonicdev force-pushed the fix/llamacpp-model-delete branch from ab8b014 to 1f6e1e3 Compare June 5, 2026 05:20
@diegosouzapw
diegosouzapw changed the base branch from release/v3.8.10 to release/v3.8.11 June 5, 2026 05:41
# Conflicts:
#	docs/reference/openapi.yaml
#	open-sse/executors/antigravity.ts
#	package-lock.json
#	package.json
@diegosouzapw
diegosouzapw merged commit 7b4bda1 into cheaper-inference:release/v3.8.11 Jun 5, 2026
1 check passed
@diegosouzapw

Copy link
Copy Markdown
Collaborator

Merged into release/v3.8.11 — thanks @wilsonicdev! 🙏

Good catch on #3199: fetched/synced models live in the syncedAvailableModels namespace, but DELETE /api/provider-models only called removeCustomModel() (which operates on customModels), so deleting a llamacpp model silently no-op'd. Adding removeSyncedAvailableModel() and wiring it into the delete handler fixes it. localDb.ts stays a pure re-export (the logic lives in db/models.ts) — nicely within conventions.

Verified before merge: 4/4 llamacpp-model-delete tests green, lint clean, Semgrep passed. (Rebased onto the release branch; the only conflicts were unrelated fork-drift in package.json/antigravity.ts/openapi.yaml, resolved to the release versions — your fix is untouched.) Ships in the next release.

diegosouzapw added a commit that referenced this pull request Jun 5, 2026
…etch (#3199) (#3212)

Follow-up to #3204: deleting a synced (fetched) model removed it from the
synced set, but the DELETE route didn't mark it hidden and the re-import path
didn't skip hidden ids, so the next auto-fetch re-added it. Now the route
marks the id hidden on delete and replaceSyncedAvailableModelsForConnection
filters hidden ids, so the deletion sticks.

Co-authored-by: tjengbudi <tjengbudi@users.noreply.github.com>
diegosouzapw added a commit that referenced this pull request Jun 5, 2026
…s + add contributor hall

Consolidate the split [Unreleased]/[3.8.11] sections into one, add entries for
every merged contributor PR that was missing credit (#3170/#3171/#3172 @pizzav-xyz,
#3185/#3195 @zhiru, #3188 @xz-dev, #3189/#3203/#3204/#3241 @wilsonicdev, #3191 @bypanghu,
#3206 @juandisay, #3217 @oyi77, #3226 @miracuves, #3187/#3200 maintainer), drop stale
v3.8.8 leftovers (#2958/#2959 already shipped) and 3 empty v3.8.10 stub headers.
@diegosouzapw diegosouzapw mentioned this pull request Jun 5, 2026
HouMinXi pushed a commit to HouMinXi/OmniRoute that referenced this pull request Aug 2, 2026
… DELETE /api/provider-models (cheaper-inference#3204)

Integrated into release/v3.8.11
HouMinXi pushed a commit to HouMinXi/OmniRoute that referenced this pull request Aug 2, 2026
…etch (cheaper-inference#3199) (cheaper-inference#3212)

Follow-up to cheaper-inference#3204: deleting a synced (fetched) model removed it from the
synced set, but the DELETE route didn't mark it hidden and the re-import path
didn't skip hidden ids, so the next auto-fetch re-added it. Now the route
marks the id hidden on delete and replaceSyncedAvailableModelsForConnection
filters hidden ids, so the deletion sticks.

Co-authored-by: tjengbudi <tjengbudi@users.noreply.github.com>
Poid-ZA pushed a commit to Poid-ZA/OmniRoute that referenced this pull request Aug 5, 2026
… DELETE /api/provider-models (cheaper-inference#3204)

Integrated into release/v3.8.11
Poid-ZA pushed a commit to Poid-ZA/OmniRoute that referenced this pull request Aug 5, 2026
…etch (cheaper-inference#3199) (cheaper-inference#3212)

Follow-up to cheaper-inference#3204: deleting a synced (fetched) model removed it from the
synced set, but the DELETE route didn't mark it hidden and the re-import path
didn't skip hidden ids, so the next auto-fetch re-added it. Now the route
marks the id hidden on delete and replaceSyncedAvailableModelsForConnection
filters hidden ids, so the deletion sticks.

Co-authored-by: tjengbudi <tjengbudi@users.noreply.github.com>
muhamadgalihsaputra pushed a commit to niyatna/NiyatnaRoute that referenced this pull request Sep 27, 2026
… DELETE /api/provider-models (cheaper-inference#3204)

Integrated into release/v3.8.11
muhamadgalihsaputra pushed a commit to niyatna/NiyatnaRoute that referenced this pull request Sep 27, 2026
…etch (cheaper-inference#3199) (cheaper-inference#3212)

Follow-up to cheaper-inference#3204: deleting a synced (fetched) model removed it from the
synced set, but the DELETE route didn't mark it hidden and the re-import path
didn't skip hidden ids, so the next auto-fetch re-added it. Now the route
marks the id hidden on delete and replaceSyncedAvailableModelsForConnection
filters hidden ids, so the deletion sticks.

Co-authored-by: tjengbudi <tjengbudi@users.noreply.github.com>
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.

7 participants