feat(dashboard): disable adding providers when OTARI_SECRET_KEY is unset#391
Conversation
|
Warning Review limit reached
Next review available in: 54 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (22)
WalkthroughThe settings API now reports whether ChangesSecret key configuration gating
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
✨ Simplify code
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
web/src/api/types.ts (1)
528-531: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick winModel the legacy omission in the TypeScript contract.
ProvidersPagetreats a missingsecret_key_configuredas configured for older gateways, but this interface says the field is always present. Make it optional so the type matches the supported wire contract.As per coding guidelines, use
undefinedrather thannullfor absent values in own TypeScript types.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@web/src/api/types.ts` around lines 528 - 531, Update the TypeScript contract containing secret_key_configured to mark this field optional, allowing it to be omitted for legacy gateways while retaining boolean support when present; do not model absence with null.Source: Coding guidelines
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@web/src/pages/ProvidersPage.test.tsx`:
- Around line 333-350: Update the disabled-state assertions in the tests around
the stored-provider and first-run scenarios to await the settings-driven state
with waitFor. Keep the existing content checks, but wrap each
getByRole(...).toBeDisabled() assertion so it runs after /v1/settings resolves
and avoids the initial enabled state.
In `@web/src/pages/ProvidersPage.tsx`:
- Around line 719-722: Update the ProvidersPage settings gate around
secretKeyConfigured to fail closed when the settings request errors, while
preserving the initial loading and legacy-missing-field behavior. Pass the
resolved configuration flag into AddProviderForm and disable both of its “Add
provider” buttons whenever the flag is false, including when the form was opened
before settings resolved. Add a regression test covering that
form-open-before-settings-resolves scenario.
---
Nitpick comments:
In `@web/src/api/types.ts`:
- Around line 528-531: Update the TypeScript contract containing
secret_key_configured to mark this field optional, allowing it to be omitted for
legacy gateways while retaining boolean support when present; do not model
absence with null.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: fd34359d-44dd-431d-af61-65c3c3218028
⛔ Files ignored due to path filters (1)
docs/public/openapi.jsonis excluded by!docs/public/openapi.json
📒 Files selected for processing (23)
src/gateway/api/routes/settings.pysrc/gateway/static/dashboard/assets/ActivityPage-GBOr6z1H.jssrc/gateway/static/dashboard/assets/AliasesPage-CBlym97u.jssrc/gateway/static/dashboard/assets/BudgetsPage-Ci2Om4P2.jssrc/gateway/static/dashboard/assets/KeysPage-DWer2Zt4.jssrc/gateway/static/dashboard/assets/ModelScopeControl-TznM9VoL.jssrc/gateway/static/dashboard/assets/ModelsPage-16gTbAeA.jssrc/gateway/static/dashboard/assets/OverviewPage-DJKN_XEh.jssrc/gateway/static/dashboard/assets/ProvidersPage-BJkEklg1.jssrc/gateway/static/dashboard/assets/ProvidersPage-X8B2lXUg.jssrc/gateway/static/dashboard/assets/SettingsPage-X-q-HpC1.jssrc/gateway/static/dashboard/assets/ToolsGuardrailsPage-jehHsX-2.jssrc/gateway/static/dashboard/assets/UsagePage-BnXUYCG7.jssrc/gateway/static/dashboard/assets/UsersPage-BHnbX63B.jssrc/gateway/static/dashboard/assets/index-f58_9tRL.jssrc/gateway/static/dashboard/index.htmltests/unit/test_settings_endpoint.pyweb/src/api/types.tsweb/src/components/PricingWarning.test.tsxweb/src/pages/ModelsPage.test.tsxweb/src/pages/ProvidersPage.test.tsxweb/src/pages/ProvidersPage.tsxweb/src/pages/SettingsPage.test.tsx
💤 Files with no reviewable changes (1)
- src/gateway/static/dashboard/assets/ProvidersPage-BJkEklg1.js
5c5dbaa to
48448c2
Compare
Provider credentials are encrypted at rest with OTARI_SECRET_KEY, so storing one over the API fails when it is unset. Previously the operator could fill in the whole add-provider form and only hit the error on submit. Surface the state up front instead: the settings endpoint now reports secret_key_configured, and the Providers page disables the Add provider buttons and shows a banner explaining that the key must be set on the server (config.yml providers keep working without it). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
48448c2 to
606ca4a
Compare
Description
Provider credentials are encrypted at rest with
OTARI_SECRET_KEY, so storing one over the API fails when it is unset. Before this change, an operator could pick a provider, paste a key, fill out the whole add-provider form, and only discover on submit that the gateway could not store it.This surfaces the state up front:
GET /v1/settings) now reportssecret_key_configured, derived fromsecret_box_configured(). Startup validation already rejects an invalid key, sotruehere means present and valid.OTARI_SECRET_KEYmust be set on the server (providers defined inconfig.ymlkeep working without it).The flag defaults to "configured" while settings are still loading and when an older gateway omits the field, so the buttons never falsely gray out.
PR Type
Relevant issues
N/A
Checklist
tests/unit,tests/integration).make lint,make typecheck,make test).uv run python scripts/generate_openapi.py).AI Usage
AI Model/Tool used:
Claude Code (Opus 4.8)
Any additional AI details you'd like to share:
Implemented and reviewed via Claude Code with back-and-forth direction from @njbrake.
NOTE:
When responding to reviewer questions, please respond yourself rather than copy/pasting reviewer comments into an AI and pasting back its answer. We want to discuss with you, not your AI :)