Skip to content

feat(ai): connect AI providers once and choose one per job - #3106

Merged
Quick104 merged 13 commits into
mainfrom
feat/ai-provider-registry
Oct 27, 2026
Merged

Quick104 merged 13 commits into
mainfrom
feat/ai-provider-registry

Conversation

@Quick104

@Quick104 Quick104 commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Related issue: #3082
Validation tasks: changes #1165 C1 (passed 2026-10-11 on c32feb1). The case's AI Services steps now connect a provider and choose it for the text model and speech-to-text, instead of entering a base URL and key per model; the criterion (both models configured, connection tests pass, the feature switches work) is unchanged.

Each AI feature keeps its own copy of the provider it calls. Text translation reads ai.base_url and ai.api_key, speech-to-text reads ai.asr_base_url and ai.asr_api_key (falling back to the text endpoint and key when empty), and Recommendations keeps a third base URL and token. An admin enters the same OpenAI key on several pages, and a rotated key that misses one copy shows up later as failed jobs. Adding a provider means adding presets to each page.

This PR adds one provider list to AI Services and makes text and speech-to-text choose a provider from it. The stacked follow-up moves recommendation embeddings onto the same list.

Approach

  • Providers. A provider is a type (OpenAI, Google Gemini, OpenRouter, Groq, Ollama, self-hosted Whisper, or any OpenAI-compatible endpoint), a base URL, an optional key, and what it serves: chat, embeddings, speech. Known types fix their capabilities; a custom endpoint's are ticked by the admin. Add provider opens a two-step dialog (type, then details), and each provider row edits in place.
  • Jobs. Text and speech-to-text each pick a provider and a model. The model field suggests the models the provider lists and still accepts any name. The ChatGPT plan stays a text-only choice through ai.auth_mode; choosing it keeps the API-key provider selected for when the admin switches back.
  • Storage and API. The list is one encrypted, machine-managed setting, ai.providers, edited only through new acting-admin operations under /api/v2/admin/ai/providers (list, create, update, delete, check, list models). The bindings ai.text_provider_id and ai.speech_provider_id are ordinary settings validated against the list. Each node reloads after a provider write.
  • Upgrade. On first start the server converts ai.base_url/ai.api_key (and the older subtitle_ai.* rows) and ai.asr_base_url/ai.asr_api_key into providers, so each job keeps the endpoint and key it used. The old rows stay in place, unread, so an older build still runs against the same database; writes to them are rejected.
  • Speech-to-text no longer falls back to the text endpoint.

Web admin and server only. Apple, Android, and jellycompat clients do not read these settings. docs/admin-settings-api.md and docs/architecture/ai-provider-authentication.md describe the contract.

Validation

  • Go: make lint-changed clean; tests pass for config, ai, api/handlers, apiv2, subtitles, contractledger, and contractspec.
  • Contract: verify-apiv2-openapi, verify-apiv2-web-types, and verify-apiv2-fixtures are current; media route manifest and ledger updated.
  • Web: typecheck and lint clean; make test-web passed.
  • Tests cover the conversion (each legacy setup keeps its endpoint and key, validates, and converts once), the in-use and key-address rules, and that a settings-check draft cannot send a stored key elsewhere.
  • Deployed to a shared dev server with the follow-up PR. The conversion ran at startup and produced the expected providers, including a ChatGPT-plan server with OpenRouter speech.

Evidence

Evidence: https://evidence.siloserver.org/r/silo-server/pr-3106/

Surface and build: web admin, AI Services, at this branch and the stacked follow-up.

Risks

  • Credentials. A stored key is sent only to the scheme, host, and port it was saved with. A check of a draft at another address uses only a key typed with it, moving a provider to another host requires its key again, and model listing does not follow redirects. A provider a job uses cannot be deleted, and a capability a job relies on cannot be removed.
  • Upgrade. The conversion runs once under the settings lock on each API node; a failure is logged and leaves the jobs unconfigured rather than stopping the server. A speech setup that relied on the text-endpoint fallback is converted to an explicit provider choice.
  • Rollback. An older build ignores the new rows and keeps working from the old ones, but its admin settings API does not know ai.providers and would return it, keys included, to administrators.
  • Settings contract. The retired ai.* endpoint keys leave the admin settings surface before /api/v2 locks.

Checklist

  • I read and can explain the complete diff.
  • This pull request addresses one concern.
  • Each test this pull request adds meets "Decide what to test" in CONTRIBUTING.md.
  • The Evidence section shows every change a user can see, or says there is none.

AI Disclosure

  • Harness: Claude Code, run inside T3 Code
  • Tool(s): Claude Code, GitHub CLI, Playwright MCP
  • Model(s): claude-opus-5-5
  • Involvement: Fully AI-generated, human verified
  • Adversarial review: none run

🤖 Generated with Claude Code

Note

Replace AI endpoint/key settings with a provider registry selected per job

  • Introduces a stored AI provider registry (ai.providers) holding endpoint, key, name, and capabilities per provider, plus text and speech provider-ID bindings that resolve the endpoints and keys used at runtime.
  • Adds admin API v2 routes for provider list, create, update, delete, draft check, and model listing, with a React hooks layer and an AI settings UI where users pick providers and models from suggestions instead of typing URLs and keys.
  • Transcription no longer falls back to the chat endpoint or key; llm.Config.ASRConfigured requires ASRBaseURL and ASRModel, and connection checks select stored providers by binding ID only.
  • Legacy ai.base_url and ai.api_key settings are retired. On startup, convertLegacyAIProviders in main.go converts stored legacy endpoints and keys into registry entries atomically and warns on refused values.
  • Behavioral Change: writes to the retired legacy AI URL/key settings now return 400 via NormalizeAdminSetting in admin_settings.go; a registry parse failure makes LoadFromDB fail; endpointURL only treats full path segments like v1, v1beta as versioned; provider updates reject type changes and require an explicit key choice before moving a keyed provider to a different endpoint authority.

Macroscope summarized 25eba20.

AI Services now keeps a provider registry (ai.providers, encrypted). Text
and speech-to-text each select a provider by id and keep their own model
settings; the ChatGPT plan stays a text-only choice through ai.auth_mode.
New acting-administrator operations list, create, edit, delete, check, and
list models for providers. Stored keys go only to the address saved with
them, and a provider a job uses cannot be removed.

On first start the server moves ai.base_url/api_key (and the subtitle_ai
predecessors) and ai.asr_base_url/asr_api_key into providers, binding each
job to the endpoint and key it used. The old rows stay in place unread.
Transcription no longer falls back to the text endpoint.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@silo-triage silo-triage Bot added the size/XXXL 3000+ added + deleted lines (all files); change volume, not priority. label Oct 26, 2026
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-27T00:20:14.094079Z 25eba20 New commits
🔒 Security Review ✅ Completed 2026-10-27T00:21:42.466516Z 25eba20 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@silo-kody

silo-kody Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Silo Kody — review complete

Review finished. Check the inline comments for findings and verify each suggestion against the code and tests.

Reviewing changes in Silo
  • Include the related issue, expected behavior, and validation steps in the PR description.
  • For API changes, describe the effect on Apple and Android clients and Jellyfin compatibility.
  • For plugin changes, identify the affected SDK contract, plugin, and catalog entry.
  • Follow this repository's AGENTS.md and CONTRIBUTING.md.
  • Request another review with @kody start-review in a PR comment.
  • React with 👍 or 👎 to give feedback on individual suggestions.
Review settings
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ❌

@coderabbitai

coderabbitai Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Warning

Review limit reached

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

  • Ask an admin to enable usage-based reviews

Open in CodeRabbit

Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing.

Next included review available in 39 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 4 included reviews currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 6e790325-0999-481d-a1b8-c68c7445e2ab
Commits

Reviewing files that changed from the base of the PR and between 99175b7 and 25eba20.

Files selected for processing: 2
  • internal/config/ai_providers.go
  • internal/config/ai_providers_test.go
Walkthrough

This change adds an encrypted AI provider registry, migrates eligible legacy endpoint settings, and resolves separate providers for text and speech-to-text. It adds provider administration APIs and UI for management, checks, and model listing, and updates AI settings to select providers and models.

Changes: AI provider management and runtime

Layer / File(s) Summary
Provider registry and legacy conversion
internal/config/ai_providers.go, internal/config/admin_settings.go, internal/config/config.go, internal/config/db_loader.go, internal/catalog/encrypted_settings_repo.go, cmd/silo/main.go, internal/config/*_test.go, docs/admin-settings-api.md, docs/architecture/ai-provider-authentication.md
Adds provider types, capabilities, validation, bindings, and versioned conversion from legacy settings. Settings loading resolves selected text and speech providers. Primary-node startup applies planned conversion writes.
Provider resolution for AI jobs
internal/ai/..., internal/subtitles/ai/..., internal/api/router.go, internal/api/handlers/admin_settings_checks.go, internal/api/handlers/admin_settings_checks_test.go
Text configuration resolves through the selected text provider. Transcription uses the selected speech provider and no longer falls back to the chat endpoint. Model listing and subtitle readiness use provider-specific settings.
Administrative provider operations
internal/api/handlers/admin_ai_providers.go, internal/apiv2/admin_ai_providers.go, internal/apiv2/router.go, internal/apiv2/document.go, contracts/api/v2/openapi.json, web/src/api/v2/schema.ts, web/src/api/v2/operations.ts, internal/api/testdata/media_routes.txt
Adds provider list, create, update, delete, check, and model-list operations. Mutations validate provider records and bindings. API contracts also describe ChatGPT operations and access-group operations.
Provider management and AI settings UI
web/src/hooks/queries/admin/aiProviders.ts, web/src/lib/aiProviders.ts, web/src/lib/adminSettingsSearch.ts, web/src/pages/admin-settings/AIProviders.tsx, web/src/pages/admin-settings/AISettings.tsx, web/src/pages/admin-settings/*test.tsx
Adds provider setup and management, connection checks, model suggestions, and provider selectors for text and speech. Readiness checks use provider capabilities and selected models.

Priority: Normal

Estimated code review effort: 4 (Complex) | ~60 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant Admin
  participant ProviderSettingsUI
  participant ProviderAPI
  participant AdminHandler
  participant ModelProvider
  Admin->>ProviderSettingsUI: Enter provider details and request a check
  ProviderSettingsUI->>ProviderAPI: Submit provider check
  ProviderAPI->>AdminHandler: Call CheckAIProvider
  AdminHandler->>ModelProvider: Request models using endpoint and key
  ModelProvider-->>AdminHandler: Return model listing result
  AdminHandler-->>ProviderAPI: Return check result
  ProviderAPI-->>ProviderSettingsUI: Display check result
Loading

Possibly related issues

  • Silo-Server/silo-server#3082 — This change adds shared provider registry capabilities but does not update Recommendations to use them.
  • Silo-Server/siloserver.org#159 — This change selects speech providers independently and removes transcription fallback to the text endpoint, overlapping with the documented transcription-only setup behavior.

Possibly related PRs

Suggested labels: api-v2, stacked, needs-review, impact: usability, evidence-required

Suggested reviewers: rhainland, coffeeknyte

Merge Risk: Low · previous review 99175

A conversion failure can leave previously configured AI jobs unavailable until restart or reconnection, while a misleading warning can slow recovery. These bounded risks warrant attention before merging.

Security architecture risk: Moderate · up to 99175

Administrative access controls, encrypted storage, and transactional validation limit normal-operation risk. However, keeping the old connection settings without synchronizing later changes can restore retired destinations or stale credentials during rollback and ignore changes on re-upgrade.

Retained concerns

  • Medium · security · inferred: Rollback and re-upgrade can restore stale credential and destination ownership. Provider edits and deletions update the registry but leave legacy connection rows unchanged. An older build reads those retained rows, potentially resuming a destination the administrator retired after upgrading. Conversely, connection changes made while downgraded are ignored on re-upgrade because registry version 1 suppresses reconversion. The rows remain encrypted and are not used during ordinary head execution; the risk is conditional on downgrade or mixed-version operation, not an established unauthenticated attack path.
Security review details

Security Blast Radius

  • inferred — A shared provider edit affects every bound text or speech job across nodes using the same settings database. The consequential exposure is the content and credential sent to that provider; the inspected management routes require an acting administrator.

Security Findings and Attack Paths

  • inferred — The retained concern is a conditional control-drift path: migrate, retire or change a provider, then downgrade against the same database. The older build resumes retained legacy routing. Re-upgrading does not reconcile changes made during the downgrade. This is not evidence of exploitation or of an ordinary non-admin bypass.

Trust Boundaries and Controls

  • observed — Draft checks reuse a stored key only for the same scheme, normalized host, and effective port. Provider updates require an explicitly supplied key when that authority changes. Same-authority path changes are intentionally trusted, consistent with the existing authority policy; model listing rejects redirects.

Resilience and Maintainability Implications

  • observed — Registry and binding validation occurs before commit under the shared settings lock. Encryption failure aborts the write set, and failed validation does not publish a provider mutation. These controls contain partial-update and concurrent-mutation failures within the current configuration format.

Hardening Proposals

  • proposed — Define an explicit cross-version ownership policy: either prevent old builds from serving AI jobs after registry changes, or provide a controlled reconciliation procedure before downgrade and re-upgrade. Validate the policy with destination retirement, key rotation, and edits made while downgraded.
Pre-merge checks: Passed 4 · Inconclusive 1

Failed Failed checks: 1 inconclusive

Check name Status Explanation Resolution
Docstring Coverage Inconclusive Docstring coverage is 43.85% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 130 functions across 41 files. (4 skipped… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly and concisely summarizes the main change: shared AI providers can be connected once and selected per job.
Description check Passed The description directly explains the provider registry, per-job selection, API and UI changes, legacy-setting conversion, validation, testing, risks, and rollback behavior.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 43.85% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 130 functions across 41 files. (4 skipped: 3 unsupported, 1 too large.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@macroscopeapp

macroscopeapp Bot commented Oct 26, 2026

Copy link
Copy Markdown

The Evidence section contains a placeholder, not captures or a published evidence link. The new AI Services interface needs:

  • web/src/pages/admin-settings/AIProviders.tsx: before-and-after desktop and mobile captures of provider management, plus a short recording of the multi-step add flow.
  • web/src/pages/admin-settings/AISettings.tsx: before-and-after desktop and mobile captures of text/speech provider selection and model settings.
  • web/src/lib/adminSettingsSearch.ts: a capture showing the updated AI Services search/navigation copy, included with the matching settings-screen captures.

Automated check: Macroscope check run agent (gpt-6-luna). Evidence was not reviewed for correctness.

Posted via Macroscope — Visible change evidence

@silo-triage silo-triage Bot added enhancement New feature or request go Pull requests that update go code javascript Pull requests that update javascript code priority: P2 Limited scope, workaround exists, or polish labels Oct 26, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0a3b7a5625

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +876 to +878
case legacyAITextURLSetting, legacyAITextKeySetting, legacyAISpeechURLSetting, legacyAISpeechKeySetting,
legacySubtitleURLSetting, legacySubtitleKeySetting:
return "", fmt.Errorf("%s was replaced by AI providers; connect the provider in AI Services", key)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Preserve AI configuration writes through the frozen v1 bridge

Existing v1 clients that configure an endpoint or rotate its key now receive a validation error for previously supported settings. The /api/v1/admin/settings and /api/v1/admin/settings/{key} routes still use the shared handlers and this normalizer (internal/api/router.go:4402–4403), while provider creation is exposed only under v2. Preserve the legacy write behavior through a compatibility adapter rather than rejecting these keys on both API versions; AGENTS.md explicitly requires the v1 bridge contract to remain unchanged.

AGENTS.md reference: AGENTS.md:L249-L250

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Recorded as a deliberate pre-lock change in 4217eca (docs/architecture/v1-scope.md, pre-lock removals table), the same way the Trakt retirement recorded its v1 change. The routes keep their shape and every other key. These six keys stop being read once the server converts them into providers on first start, so accepting a v1 write would store a value that changes nothing, and an admin would believe a key had been rotated. No first-party native client writes them, and the web admin uses v2. #3107 extends the entry with the retired embedding keys.

Comment thread internal/config/ai_providers.go Resolved
A server that saved a speech key without a speech URL sent audio to the
text endpoint with that key. The conversion now gives that endpoint and
key a provider of its own instead of binding speech to the text key.

Record the rejected v1 writes of the retired AI endpoint settings in the
pre-lock removals table.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

@coderabbitai coderabbitai Bot left a comment

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.

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to GitHub limitations.

⚠️ Outside diff range comments (1)

Minor · Update the transcription error hint to match the provider model. · transcribe.go:275-277

internal/ai/llm/transcribe.go:275-277
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Update the transcription error hint to match the provider model.

decorateTranscribeError still tells the administrator to "set a Whisper-compatible Transcription base URL (and model) under Admin Settings → AI Services". This change removes that setting, and the server now rejects writes to ai.asr_base_url. An administrator who follows the hint cannot complete it. Tell the administrator to choose a speech-to-text provider that supports transcription.

Proposed fix
-	return fmt.Errorf("%w — the configured endpoint likely does not support audio transcription; "+
-		"set a Whisper-compatible Transcription base URL (and model) under Admin Settings → AI Services "+
-		"(e.g. a self-hosted faster-whisper/speaches server, api.groq.com/openai with whisper-large-v3-turbo, or api.openai.com with whisper-1)", err)
+	return fmt.Errorf("%w — the selected provider likely does not support audio transcription; "+
+		"choose a speech-to-text provider (and model) under Admin Settings → AI Services "+
+		"(e.g. a self-hosted Whisper server, Groq with whisper-large-v3-turbo, or OpenAI with whisper-1)", err)

Review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: c3a4ae60-c784-49e0-bc55-da14a80c7a52
Commits

Reviewing files that changed from the base of the PR and between 48b895f and 0a3b7a5.

Files selected for processing: 48
  • cmd/silo/main.go
  • contracts/api/v2/openapi.json
  • docs/admin-settings-api.md
  • docs/architecture/ai-provider-authentication.md
  • internal/ai/chatgpt/eligibility_test.go
  • internal/ai/chatgpt/selection.go
  • internal/ai/chatgpt/selection_test.go
  • internal/ai/chatgpt/usage_test.go
  • internal/ai/llm/client.go
  • internal/ai/llm/client_test.go
  • internal/ai/llm/models.go
  • internal/ai/llm/openrouter_test.go
  • internal/ai/llm/responses_test.go
  • internal/ai/llm/transcribe.go
  • internal/ai/llm/usage_callbacks_test.go
  • internal/api/handlers/admin.go
  • internal/api/handlers/admin_ai_providers.go
  • internal/api/handlers/admin_ai_providers_test.go
  • internal/api/handlers/admin_settings_check_service_test.go
  • internal/api/handlers/admin_settings_checks.go
  • internal/api/handlers/admin_settings_checks_test.go
  • internal/api/handlers/admin_settings_credential_binding_test.go
  • internal/api/router.go
  • internal/api/testdata/media_routes.txt
  • internal/apiv2/admin_ai_providers.go
  • internal/apiv2/document.go
  • internal/apiv2/router.go
  • internal/catalog/encrypted_settings_repo.go
  • internal/config/admin_settings.go
  • internal/config/admin_settings_test.go
  • internal/config/ai_providers.go
  • internal/config/ai_providers_test.go
  • internal/config/config.go
  • internal/config/db_loader.go
  • internal/contractledger/ledger_test.go
  • internal/subtitles/ai/config.go
  • internal/subtitles/ai/connection_test.go
  • internal/subtitles/ai/reuse_test.go
  • internal/subtitles/ai/service_test.go
  • web/src/api/v2/operations.ts
  • web/src/api/v2/schema.ts
  • web/src/hooks/queries/admin/aiProviders.ts
  • web/src/lib/adminSettingsSearch.ts
  • web/src/lib/aiProviders.ts
  • web/src/pages/admin-settings/AIProviders.test.tsx
  • web/src/pages/admin-settings/AIProviders.tsx
  • web/src/pages/admin-settings/AISettings.test.tsx
  • web/src/pages/admin-settings/AISettings.tsx
Files with no reviewable changes: 2
  • internal/api/handlers/admin_settings_credential_binding_test.go
  • internal/config/admin_settings_test.go

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 2 remain after this review.

Comment thread internal/config/ai_providers.go Resolved

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4217eca204

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread internal/config/ai_providers.go Resolved
Comment thread internal/config/ai_providers.go Resolved
…saves

Conversion now runs each adopted provider through the same validation as an
admin write, clamping names derived from long hosts, so an address the AI
clients never accepted (a query string, credentials in the URL) leaves the
job unconfigured instead of storing an entry that blocks every later
provider edit. AI Services refetches the provider list after a save, so
"used by" follows the job choices at once, and the transcription error
hint names the speech-to-text provider instead of the retired base URL.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@Quick104

Copy link
Copy Markdown
Contributor Author

The outside-diff finding on internal/ai/llm/transcribe.go is fixed in 89c964f: the transcription error hint now asks for a Whisper-compatible speech-to-text provider and model in AI Services instead of the retired base URL setting.

@silo-kody

silo-kody Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Silo Kody — review complete

Review finished. Check the inline comments for findings and verify each suggestion against the code and tests.

Reviewing changes in Silo
  • Include the related issue, expected behavior, and validation steps in the PR description.
  • For API changes, describe the effect on Apple and Android clients and Jellyfin compatibility.
  • For plugin changes, identify the affected SDK contract, plugin, and catalog entry.
  • Follow this repository's AGENTS.md and CONTRIBUTING.md.
  • Request another review with @kody start-review in a PR comment.
  • React with 👍 or 👎 to give feedback on individual suggestions.
Review settings
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ❌

Speech resolved its endpoint and key independently of text, so a server
that stored only ai.asr_api_key transcribed against the default OpenAI
endpoint with it, even when a ChatGPT plan served text. The conversion now
resolves that fallback on its own instead of requiring a text provider.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 89c964f869

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread internal/config/ai_providers.go Outdated
Comment on lines +491 to +503
provider, err := NormalizeAIProvider(AIProvider{
ID: NewAIProviderID(providerType),
Type: providerType,
Name: uniqueAIProviderName(r, name),
BaseURL: providerBaseURL,
APIKey: apiKey,
Capabilities: capabilities,
})
if err != nil {
// An entry that fails validation would block every later provider
// edit. An address it rejects (a query string, credentials in the URL)
// never worked with the AI clients, so the job stays unconfigured.
return ""

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

kody code-review Bug high

Backward compatibility regression in internal/config/ai_providers.go: NormalizeAIProvider rejects legacy endpoints using URL-based Basic authentication and silently omits them from conversion, although the existing client passes URL userinfo to net/http and leaves Authorization unset when no API key is configured. Preserve working custom connections such as https://user:[email protected]/v1 with an empty API key instead of leaving the job unconfigured and marking conversion complete.

Prompt for LLM

File internal/config/ai_providers.go:

Line 491 to 503:

Backward compatibility regression in internal/config/ai_providers.go: NormalizeAIProvider rejects legacy endpoints using URL-based Basic authentication and silently omits them from conversion, although the existing client passes URL userinfo to net/http and leaves Authorization unset when no API key is configured. Preserve working custom connections such as https://user:[email protected]/v1 with an empty API key instead of leaving the job unconfigured and marking conversion complete.

Talk to Kody by mentioning @kody

Was this suggestion helpful? React with 👍 or 👎 to help Kody learn from this interaction.

​

​

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Deliberate. A provider's base URL is returned by the provider list operation and shown on its row, so credentials embedded in it would reach every administrator and the UI in plain text; NormalizeAIProvider refuses them for that reason, on create and on conversion alike. Such a setup converts to no provider for that job, and the admin re-adds it with the key in the API key field. Basic auth through URL userinfo was not a documented configuration. Leaving this open for a maintainer to overrule.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Understood. Rejecting URL userinfo is intentional credential protection, so the fix should not be to allow credentials in a base URL exposed by the provider API and UI.

One caveat: moving a password into the API key field does not preserve HTTP Basic authentication; those are different authentication mechanisms. An affected administrator would need to reconfigure the proxy to accept API-key authentication or use another supported setup.

I would narrow the original suggestion to an upgrade compatibility concern, rather than a validation bug: a previously working, undocumented configuration is skipped, and conversion is marked complete. If that tradeoff is accepted, explicitly documenting the unsupported configuration and providing a credential-safe migration warning would make the behavior clearer. Leaving the decision to a maintainer is reasonable.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Agreed, and a correction to my earlier reply: moving the password into the API key field does not keep HTTP Basic working. 370fdd6 keeps the refusal but makes it visible. The conversion reports the legacy setting it could not convert, startup logs a warning naming the setting (never the URL), and docs/admin-settings-api.md states that HTTP Basic through the URL is unsupported and such a proxy needs to accept the provider's key. Leaving the thread open for the maintainer decision.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Thanks for the correction. Based on your description, 370fdd627 addresses the silent-conversion concern without exposing URL credentials: the warning identifies only the legacy setting, and the documentation explains that HTTP Basic is unsupported and API-key authentication is not an equivalent replacement.

The remaining compatibility break is intentional and now visible. I agree with leaving the thread open for the maintainer to decide whether that migration tradeoff is acceptable.

@silo-kody

silo-kody Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Silo Kody — review complete

Review finished. Check the inline comments for findings and verify each suggestion against the code and tests.

Reviewing changes in Silo
  • Include the related issue, expected behavior, and validation steps in the PR description.
  • For API changes, describe the effect on Apple and Android clients and Jellyfin compatibility.
  • For plugin changes, identify the affected SDK contract, plugin, and catalog entry.
  • Follow this repository's AGENTS.md and CONTRIBUTING.md.
  • Request another review with @kody start-review in a PR comment.
  • React with 👍 or 👎 to give feedback on individual suggestions.
Review settings
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ❌

A job could switch providers but not release one, so an unused provider
stayed in use and could not be removed. Each provider select now offers
None, which saves an empty binding.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Comment thread internal/config/ai_providers.go Resolved
@silo-kody

silo-kody Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Silo Kody — review complete

Review finished. Check the inline comments for findings and verify each suggestion against the code and tests.

Reviewing changes in Silo
  • Include the related issue, expected behavior, and validation steps in the PR description.
  • For API changes, describe the effect on Apple and Android clients and Jellyfin compatibility.
  • For plugin changes, identify the affected SDK contract, plugin, and catalog entry.
  • Follow this repository's AGENTS.md and CONTRIBUTING.md.
  • Request another review with @kody start-review in a PR comment.
  • React with 👍 or 👎 to give feedback on individual suggestions.
Review settings
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ❌
⚠️ 2 Kody Rule(s) were not evaluated

These rules declare that they need repository context beyond this diff, and the review could not retrieve it, so they were not judged on this pull request:

  • Preserve optional store capabilities through production wrappers
  • Detach mandatory cleanup from request cancellation and bound its lifetime

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 35ad67362a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Choosing None for the text model now saves while subtitle and description
translation are off; with either on, Save asks to turn them off first. The
conversion trims a trailing slash from the stored text URL before deciding
whether that endpoint also served speech, so https://api.openai.com/ keeps
its speech binding.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

@coderabbitai coderabbitai Bot left a comment

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.

Actionable comments posted: 1


Review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 6737e15a-1140-4d20-91c1-8ed0500d0f4e
Commits

Reviewing files that changed from the base of the PR and between 0a3b7a5 and 35ad673.

Files selected for processing: 8
  • docs/architecture/v1-scope.md
  • internal/ai/llm/client_test.go
  • internal/ai/llm/transcribe.go
  • internal/config/ai_providers.go
  • internal/config/ai_providers_test.go
  • web/src/hooks/queries/admin/aiProviders.ts
  • web/src/pages/admin-settings/AISettings.test.tsx
  • web/src/pages/admin-settings/AISettings.tsx
Files skipped from review as they are similar to previous changes: 2
  • internal/ai/llm/client_test.go
  • internal/ai/llm/transcribe.go

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.

The embedding job joins in the stacked follow-up; declaring it with the new
operations avoids a later response-enum addition, which the contract check
treats as breaking.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@silo-kody

silo-kody Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Silo Kody — review complete

Review finished. Check the inline comments for findings and verify each suggestion against the code and tests.

Reviewing changes in Silo
  • Include the related issue, expected behavior, and validation steps in the PR description.
  • For API changes, describe the effect on Apple and Android clients and Jellyfin compatibility.
  • For plugin changes, identify the affected SDK contract, plugin, and catalog entry.
  • Follow this repository's AGENTS.md and CONTRIBUTING.md.
  • Request another review with @kody start-review in a PR comment.
  • React with 👍 or 👎 to give feedback on individual suggestions.
Review settings
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ❌
⚠️ 2 Kody Rule(s) were not evaluated

These rules declare that they need repository context beyond this diff, and the review could not retrieve it, so they were not judged on this pull request:

  • Preserve optional store capabilities through production wrappers
  • Detach mandatory cleanup from request cancellation and bound its lifetime

Clients added /v1 to a base URL unless it contained the substring /v1, so a
host such as v1-embed.internal or a path such as /proxy/v1-router lost its
version. llm.HasAPIVersion now checks path segments (v1, v2, v1beta), and
the chat client and the provider conversion share it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7f44d58da1

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread internal/config/admin_settings.go Resolved
@silo-kody

silo-kody Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Silo Kody — review complete

Review finished. Check the inline comments for findings and verify each suggestion against the code and tests.

Reviewing changes in Silo
  • Include the related issue, expected behavior, and validation steps in the PR description.
  • For API changes, describe the effect on Apple and Android clients and Jellyfin compatibility.
  • For plugin changes, identify the affected SDK contract, plugin, and catalog entry.
  • Follow this repository's AGENTS.md and CONTRIBUTING.md.
  • Request another review with @kody start-review in a PR comment.
  • React with 👍 or 👎 to give feedback on individual suggestions.
Review settings
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ❌

PUT /admin/settings/{key} stored any provider id for a job, so a missing
or unsuitable provider silently disabled the job and blocked later provider
edits. It now runs the same registry check as the batch write.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@silo-kody

silo-kody Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Silo Kody — review complete

Review finished. Check the inline comments for findings and verify each suggestion against the code and tests.

Reviewing changes in Silo
  • Include the related issue, expected behavior, and validation steps in the PR description.
  • For API changes, describe the effect on Apple and Android clients and Jellyfin compatibility.
  • For plugin changes, identify the affected SDK contract, plugin, and catalog entry.
  • Follow this repository's AGENTS.md and CONTRIBUTING.md.
  • Request another review with @kody start-review in a PR comment.
  • React with 👍 or 👎 to give feedback on individual suggestions.
Review settings
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ❌

A legacy AI endpoint whose URL carries credentials or a query is refused by
the registry, so its job stays unconfigured. The conversion now reports the
setting, startup logs a warning naming it (never the URL), and the admin
settings doc says HTTP Basic authentication through the URL is unsupported.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@silo-kody

silo-kody Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Silo Kody — review complete

Review finished. Check the inline comments for findings and verify each suggestion against the code and tests.

Reviewing changes in Silo
  • Include the related issue, expected behavior, and validation steps in the PR description.
  • For API changes, describe the effect on Apple and Android clients and Jellyfin compatibility.
  • For plugin changes, identify the affected SDK contract, plugin, and catalog entry.
  • Follow this repository's AGENTS.md and CONTRIBUTING.md.
  • Request another review with @kody start-review in a PR comment.
  • React with 👍 or 👎 to give feedback on individual suggestions.
Review settings
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ❌

OpenRouter serves embedding models such as google/gemini-embedding-001 at
/api/v1/embeddings, so the type now declares embeddings alongside chat and
speech. A known type's capabilities are applied when the registry is read,
so OpenRouter providers saved earlier can be chosen for embeddings too.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@silo-kody

silo-kody Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Silo Kody — review complete

Review finished. Check the inline comments for findings and verify each suggestion against the code and tests.

Reviewing changes in Silo
  • Include the related issue, expected behavior, and validation steps in the PR description.
  • For API changes, describe the effect on Apple and Android clients and Jellyfin compatibility.
  • For plugin changes, identify the affected SDK contract, plugin, and catalog entry.
  • Follow this repository's AGENTS.md and CONTRIBUTING.md.
  • Request another review with @kody start-review in a PR comment.
  • React with 👍 or 👎 to give feedback on individual suggestions.
Review settings
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ❌

@coderabbitai coderabbitai Bot added api-v2 API v2 / Huma migration program (epic #135); long-running, stacked by phase evidence-required Needs before-and-after evidence before the Evidence check passes impact: usability Core flow broken or severely blocked needs-review Needs maintainer review to resolve uncertain classification, scope, or changed evidence. stacked Base is another open PR; merge in stack order named in the body labels Oct 26, 2026

@coderabbitai coderabbitai Bot left a comment

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.

Actionable comments posted: 2


Review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: c3634e0b-ed56-44e6-9412-41dc775c817b
Commits

Reviewing files that changed from the base of the PR and between 35ad673 and 99175b7.

Files selected for processing: 14
  • cmd/silo/main.go
  • contracts/api/v2/breaking-approvals.json
  • contracts/api/v2/openapi.json
  • docs/admin-settings-api.md
  • internal/ai/llm/client.go
  • internal/ai/llm/client_test.go
  • internal/api/handlers/admin.go
  • internal/api/handlers/admin_settings_checks_test.go
  • internal/apiv2/admin_ai_providers.go
  • internal/config/ai_providers.go
  • internal/config/ai_providers_test.go
  • web/src/api/v2/schema.ts
  • web/src/pages/admin-settings/AISettings.test.tsx
  • web/src/pages/admin-settings/AISettings.tsx

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 2 remain after this review.

Comment thread cmd/silo/main.go Resolved
Comment thread internal/config/ai_providers.go Resolved
When only subtitle_ai.base_url held a URL the registry refuses, the startup
warning named ai.base_url, which was empty.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@silo-kody

silo-kody Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

Silo Kody — review complete

Review finished. Check the inline comments for findings and verify each suggestion against the code and tests.

Reviewing changes in Silo
  • Include the related issue, expected behavior, and validation steps in the PR description.
  • For API changes, describe the effect on Apple and Android clients and Jellyfin compatibility.
  • For plugin changes, identify the affected SDK contract, plugin, and catalog entry.
  • Follow this repository's AGENTS.md and CONTRIBUTING.md.
  • Request another review with @kody start-review in a PR comment.
  • React with 👍 or 👎 to give feedback on individual suggestions.
Review settings
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ❌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api-v2 API v2 / Huma migration program (epic #135); long-running, stacked by phase enhancement New feature or request evidence-required Needs before-and-after evidence before the Evidence check passes go Pull requests that update go code impact: usability Core flow broken or severely blocked javascript Pull requests that update javascript code needs-review Needs maintainer review to resolve uncertain classification, scope, or changed evidence. priority: P2 Limited scope, workaround exists, or polish size/XXXL 3000+ added + deleted lines (all files); change volume, not priority. stacked Base is another open PR; merge in stack order named in the body

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant