Skip to content

feat(model-providers): add DELETE endpoint to permanently remove a provider - #501

Open
kristopolous wants to merge 1 commit into
truefoundry:mainfrom
kristopolous:feat/model-provider-delete-endpoint
Open

feat(model-providers): add DELETE endpoint to permanently remove a provider#501
kristopolous wants to merge 1 commit into
truefoundry:mainfrom
kristopolous:feat/model-provider-delete-endpoint

Conversation

@kristopolous

@kristopolous kristopolous commented Aug 29, 2026

Copy link
Copy Markdown

Summary

Fixes #500.

In Settings → Models, each configured provider (openai, anthropic, custom, …) has a "Remove" button, gated on modelCatalog.deleteModelProvider. That method is never implemented in the adapter — no backend DELETE route exists for model providers at all — so the button silently never renders. Same shape as the MCP connector (#494/#495) and skill (#498/#499) gaps.

This PR adds DELETE /api/v1/settings/model-providers/{name}.

  • IModelProviderStore.deleteProvider implemented for both Postgres and SQLite.
  • Route + handler mirror the existing deleteAgentRoute/deleteMcpServerRoute/deleteSkillRoute pattern exactly: idempotent, 200 with {} on success.

Scope: backend only (same reason as #495/#499)

packages/trueforge-sdk is Fern-generated in CI and can't receive that regen commit on a fork PR. So this is the backend endpoint only, tested. Frontend wiring (modelProviderCatalog.ts's deleteModelProvider) is a fast-follow once this merges and the SDK regenerates on main.

Test plan

  • New tests in modelProviderStoreContractSuite.ts (runs against both backends): delete removes the row; idempotent for an unknown provider, other tenants untouched.
  • New tests in tests/unit/apis/modelProviders.test.ts: DELETE /model-providers/{name} removes the provider (and confirms it drops out of the list); idempotent for an unknown provider.
  • pnpm test:store:sqlite — 133 passed (was 131), 1 skipped; confirmed the two new deleteProvider cases ran via --verbose.
  • pnpm test (trueforge unit suite) — 294/294 pass, including the two new modelProviders.test.ts cases.
  • pnpm run typecheck — clean.
  • pnpm eslint on changed files — clean.
  • Added a changeset (@truefoundry/trueforge minor — new endpoint).
  • Postgres store contract suite — same as feat(mcp-servers): add DELETE endpoint to permanently remove a connector #495/feat(skills): add DELETE endpoint to permanently remove a skill #499, couldn't verify locally (sandbox blocks raw TCP to a local Postgres container), but CI runs it against this exact test file with a real postgres:17-alpine service.

🤖 Generated with Claude Code

https://claude.ai/code/session_01MxyEPwQ73B27NTr83U69Ba


Note

Medium Risk
Introduces a destructive admin settings operation that permanently removes provider configuration (including stored API keys) and drops models from the tenant catalog; behavior is tenant-scoped and matches other idempotent delete routes.

Overview
Adds DELETE /api/v1/settings/model-providers/{name} so admins can permanently remove a configured model provider (unblocks Settings → Models “Remove” once the SDK regenerates).

The handler follows the existing settings delete pattern: tenant-scoped row delete, 200 with {}, and idempotent when the name is already gone. Storage goes through new IModelProviderStore.deleteProvider, implemented in both Postgres and SQLite with a straight model_provider delete by (tenant_id, name).

OpenAPI/Fern metadata and DeleteModelProviderResponseSchema are added alongside contract and API tests for successful delete, list emptying, and idempotent unknown names.

Reviewed by Cursor Bugbot for commit 2faf9a8. Bugbot is set up for automated code reviews on this repo. Configure here.

…ovider

Settings > Models has a "Remove" button for each configured provider,
gated on modelCatalog.deleteModelProvider — but that's never
implemented (no backend route), so the button silently never renders.
Same gap as the MCP connector (truefoundry#494/truefoundry#495) and skill (truefoundry#498/truefoundry#499) work.

Add IModelProviderStore.deleteProvider for both Postgres and SQLite,
the DELETE route, and its handler. Same pattern: idempotent, 200 with
{} on success.

Backend only, same reason as truefoundry#495/truefoundry#499: packages/trueforge-sdk is
Fern-generated in CI and fork PRs cannot receive that regen commit.
Frontend wiring (modelProviderCatalog.ts's deleteModelProvider) is a
fast-follow once this merges and the SDK regenerates on main.

Fixes truefoundry#500

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MxyEPwQ73B27NTr83U69Ba
@changeset-bot

changeset-bot Bot commented Aug 29, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 2faf9a8

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@truefoundry/trueforge Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

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.

No way to disconnect/remove a configured model provider

1 participant