Skip to content

Conversation

@waleedlatif1
Copy link
Collaborator

Summary

  • add back condition for isHosted FF

Type of Change

  • Bug fix

Testing

Tested manually

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel
Copy link

vercel bot commented Jan 13, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Review Updated (UTC)
docs Skipped Skipped Jan 13, 2026 4:38pm

@waleedlatif1 waleedlatif1 merged commit 048eddd into staging Jan 13, 2026
6 checks passed
@waleedlatif1 waleedlatif1 deleted the fix/app-url branch January 13, 2026 16:38
@greptile-apps
Copy link
Contributor

greptile-apps bot commented Jan 13, 2026

Greptile Overview

Greptile Summary

This PR fixes a critical regression that broke self-hosted deployments by restoring the conditional isHosted feature flag check and standardizing URL construction across deployment components.

Key Changes:

  • Restored conditional isHosted check in feature-flags.ts that evaluates NEXT_PUBLIC_APP_URL against hosted domains (www.sim.ai and www.staging.sim.ai), fixing regression introduced in feat(enterprise): permission groups, access control  #2736
  • Replaced direct getEnv('NEXT_PUBLIC_APP_URL') calls with the getBaseUrl() helper function across deployment modal components (chat, form, and API endpoint construction)
  • Added missing getEnv import to feature-flags.ts to support the conditional check
  • Removed unused getEnv import from form component after switching to getBaseUrl()

Impact:
The isHosted flag is critical for self-hosted deployments as it controls authentication bypass (isAuthDisabled), feature access (SSO, credential sets, access control), and billing enforcement. Hardcoding it to true incorrectly treated all deployments as hosted, preventing self-hosted users from accessing intended features.

Confidence Score: 5/5

  • This PR is safe to merge - it fixes a critical bug affecting self-hosted deployments with well-tested, straightforward changes
  • All changes are clean reversions and refactorings that restore intended functionality. The isHosted conditional logic was previously working correctly and was accidentally simplified in feat(enterprise): permission groups, access control  #2736. The URL construction refactoring to use getBaseUrl() is a positive improvement that centralizes URL handling logic with proper validation. No new logic or edge cases introduced.
  • No files require special attention

Important Files Changed

File Analysis

Filename Score Overview
apps/sim/lib/core/config/feature-flags.ts 5/5 Restored conditional isHosted check based on NEXT_PUBLIC_APP_URL to properly support self-hosted deployments, fixing regression from #2736
apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/deploy/components/deploy-modal/deploy-modal.tsx 5/5 Replaced multiple direct getEnv('NEXT_PUBLIC_APP_URL') calls with getBaseUrl() helper across 4 locations

Sequence Diagram

sequenceDiagram
    participant App as Application
    participant FF as feature-flags.ts
    participant Env as env.ts
    participant Config as Environment Config
    
    Note over App,Config: Feature Flag Check Flow
    
    App->>FF: Check isHosted flag
    FF->>Env: getEnv('NEXT_PUBLIC_APP_URL')
    Env->>Config: Retrieve NEXT_PUBLIC_APP_URL
    Config-->>Env: Return URL value
    Env-->>FF: Return URL string
    
    alt URL is https://www.sim.ai
        FF-->>App: isHosted = true
    else URL is https://www.staging.sim.ai
        FF-->>App: isHosted = true
    else URL is other (self-hosted)
        FF-->>App: isHosted = false
    end
    
    Note over App,FF: URL Construction Flow
    
    App->>FF: Need base URL for deployment
    FF->>Env: getBaseUrl()
    Env->>Config: Retrieve NEXT_PUBLIC_APP_URL
    Config-->>Env: Return URL
    Env-->>FF: Validated base URL
    FF-->>App: Construct endpoint URLs
    
    Note over App: Deploy modal, chat, and form<br/>now use consistent getBaseUrl()<br/>instead of direct getEnv() calls
Loading

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

No files reviewed, no comments

Edit Code Review Agent Settings | Greptile

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