Skip to content

Don't allow adding multiple local providers#1423

Merged
deep1401 merged 4 commits intomainfrom
fix/local-provider-multiple
Mar 2, 2026
Merged

Don't allow adding multiple local providers#1423
deep1401 merged 4 commits intomainfrom
fix/local-provider-multiple

Conversation

@deep1401
Copy link
Copy Markdown
Member

@deep1401 deep1401 commented Mar 2, 2026

Summary by CodeRabbit

  • New Features
    • Added conditional restrictions to the Local (beta) provider option during provider setup to prevent duplicate local providers. The option is now disabled when a local provider already exists in add-mode scenarios.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 2, 2026

Warning

Rate limit exceeded

@deep1401 has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 7 minutes and 28 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 02cee7c and d87149e.

📒 Files selected for processing (1)
  • src/renderer/components/Team/ProviderDetailsModal.tsx
📝 Walkthrough

Walkthrough

Introduces conditional logic to disable the Local provider option in the provider details modal when a local provider already exists, preventing duplicate local provider creation. The hasLocalProvider prop is derived from the existing providers array.

Changes

Cohort / File(s) Summary
Provider Type Selection Enhancement
src/renderer/components/Team/ProviderDetailsModal.tsx, src/renderer/components/Team/Team.tsx
Added hasLocalProvider prop to control whether Local provider option is disabled. The modal now disables Local selection in add-mode when a local provider already exists. The prop is computed in Team.tsx by checking if any provider has type 'local' and passed to two ProviderDetailsModal instances.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Suggested reviewers

  • dadmobile
  • aliasaria
🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately captures the main objective of the changeset: preventing users from adding multiple local providers by conditionally disabling the Local option when one already exists.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/local-provider-multiple

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

<Option value="slurm">SLURM</Option>
<Option value="runpod">Runpod (beta)</Option>
<Option value="local">Local (beta)</Option>
<Option
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I would just remove it from the list altogether?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Done

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/renderer/components/Team/ProviderDetailsModal.tsx`:
- Around line 362-367: The dropdown disable is insufficient—add a submit-time
guard in ProviderDetailsModal's submit handler (e.g., handleSubmit/onSave) that
re-checks hasLocalProvider and providerId and aborts with a user-facing error if
another local provider already exists; additionally ensure the provider-create
API enforces uniqueness server-side (returning a conflict error like 409) and
handle that error in the modal to show a clear message to the user.

In `@src/renderer/components/Team/Team.tsx`:
- Around line 1134-1137: The predicate uses an unsafe any for provider; replace
it with the correct typed shape (e.g., Provider or TeamProvider) and/or optional
typing to preserve type-safety: update the declaration referenced in the
hasLocalProvider expression (the providers variable and the providers.some
callback) to use the project's Provider interface (or define a local interface
with at least a nullable type?: string field), e.g. providers.some((provider?:
Provider) => provider?.type === 'local'), and import or reuse the existing
Provider type used elsewhere in the Team component.

ℹ️ Review info

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between edc61c9 and 02cee7c.

📒 Files selected for processing (2)
  • src/renderer/components/Team/ProviderDetailsModal.tsx
  • src/renderer/components/Team/Team.tsx

Comment thread src/renderer/components/Team/ProviderDetailsModal.tsx Outdated
Comment thread src/renderer/components/Team/Team.tsx
@deep1401 deep1401 requested a review from dadmobile March 2, 2026 15:11
@paragon-review
Copy link
Copy Markdown

paragon-review bot commented Mar 2, 2026

Paragon Summary

This pull request review identified 1 issue across 1 category in 2 files. The review analyzed code changes, potential bugs, security vulnerabilities, performance issues, and code quality concerns using automated analysis tools.

This PR prevents users from adding multiple local providers by adding validation logic to the provider management UI, restricting the system to only allow one local provider instance.

Key changes:

  • Based on the PR information provided:
  • Prevents adding multiple local providers (restriction feature)
  • Modified ProviderDetailsModal.tsx to enforce single local provider constraint
  • Updated Team.tsx with provider management logic changes
  • Affects provider creation/addition flow in Team UI

Confidence score: 5/5

  • This PR has low risk with no critical or high-priority issues identified
  • Score reflects clean code review with only minor suggestions or no issues found
  • Code quality checks passed - safe to proceed with merge

2 files reviewed, 1 comment

Severity breakdown: Low: 1


Tip: @paragon-run <instructions> to chat with our agent or push fixes!

Dashboard

providerId={providerId}
hasLocalProvider={
Array.isArray(providers) &&
providers.some((provider: any) => provider?.type === 'local')
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Bug: The provider type uses 'any' instead of a proper type

The provider type uses 'any' instead of a proper type. Type safety is lost for provider objects. Define a proper Provider interface.

View Details

Location: src/renderer/components/Team/Team.tsx (lines 1136)

Analysis

The provider type uses 'any' instead of a proper type. Type safety is lost for provider objects

What fails TypeScript type safety is bypassed using 'any' type for provider parameter
Result No compile-time type checking for provider properties like 'type'
Expected Should use a defined Provider interface with typed properties
Impact Loss of type safety increases risk of runtime errors if provider structure changes
How to reproduce
Review the code at line 1135 where providers.some() callback uses (provider: any)
AI Fix Prompt
Fix this issue: The provider type uses 'any' instead of a proper type. Type safety is lost for provider objects. Define a proper Provider interface.

Location: src/renderer/components/Team/Team.tsx (lines 1136)
Problem: TypeScript type safety is bypassed using 'any' type for provider parameter
Current behavior: No compile-time type checking for provider properties like 'type'
Expected: Should use a defined Provider interface with typed properties
Steps to reproduce: Review the code at line 1135 where providers.some() callback uses (provider: any)

Provide a code fix.


Tip: Reply with @paragon-run to automatically fix this issue

@deep1401 deep1401 merged commit 86cdafc into main Mar 2, 2026
4 checks passed
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