Skip to content

Feature: ThinkReview enterprise self-hosted gateway option #286

Description

@cursor

Summary

Add support for ThinkReview Self-Hosted Gateway as an AI provider option, allowing Teams subscribers to route code review traffic to an on-prem enterprise gateway while keeping sign-in, agents, and billing on ThinkReview cloud.

Motivation

Enterprise customers on the Teams plan need the ability to run AI-powered code reviews on their own infrastructure with their own LLM, keeping code within their network.

Changes

New self-hosted gateway provider

  • Add ThinkReview Self-Hosted Gateway as a selectable AI provider in the extension popup (Teams plan only)
  • New utils/enterprise-gateway.js module with:
    • Teams subscription validation (canUseEnterpriseGatewayFromStorage)
    • Gateway base URL normalization (normalizeGatewayBaseUrl)
    • Pre-flight checks before routing review traffic (assertSelfHostedGatewayReady)

Popup UI

  • New provider card for self-hosted gateway with Teams badge
  • Configuration panel with gateway base URL input, Test Connection, and Save Settings buttons
  • Provider visibility gated on Teams subscription status
  • Auto-migrate provider selection when gateway URL is configured

API routing

  • CloudService.getReviewApiBaseUrl() routes patch review and conversational review to the configured gateway when aiProvider is self-hosted
  • background.js gates conversational and patch review requests through assertSelfHostedGatewayReady
  • Review endpoints (reviewPatchCode_1_1, getConversationalReview_1_1) use dynamic base URL

Portal auth hardening

  • content-webapp-auth.js guards against invalidated extension context after reload/update
  • Prevents errors when syncing portal sign-in with the extension after an update

Acceptance criteria

  • Teams subscribers see the Self-Hosted Gateway provider option in popup settings
  • Non-Teams users do not see or cannot select the self-hosted provider
  • Gateway base URL can be configured, tested, and saved
  • Patch review and conversational review route to the configured gateway URL when self-hosted is selected
  • Clear error messages when gateway is not configured or user lacks Teams subscription
  • Portal auth sync degrades gracefully after extension updates

Related pull request

Implemented in #285

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions