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
Related pull request
Implemented in #285
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
utils/enterprise-gateway.jsmodule with:canUseEnterpriseGatewayFromStorage)normalizeGatewayBaseUrl)assertSelfHostedGatewayReady)Popup UI
API routing
CloudService.getReviewApiBaseUrl()routes patch review and conversational review to the configured gateway whenaiProviderisself-hostedbackground.jsgates conversational and patch review requests throughassertSelfHostedGatewayReadyreviewPatchCode_1_1,getConversationalReview_1_1) use dynamic base URLPortal auth hardening
content-webapp-auth.jsguards against invalidated extension context after reload/updateAcceptance criteria
Related pull request
Implemented in #285