For AI agents: a documentation index is available at /llms.txt. Append .md to any page URL for markdown, or send Accept: text/markdown.
Set up Smart Gate
Connect the Statsig GitHub App, choose which repositories Smart Gate reviews, map folders to Statsig projects, and configure how Smart Gate rolls out and cleans up the gates it creates.
This feature is in Early Access. During this time, aspects of the functionality may still be developed, and this documentation may not always be up to date. If you have any questions, contact Statsig Support.
Smart Gate settings belong to your Statsig organization, not to a single project. Organization admins can change them from any project.
Prerequisites
Statsig has enabled Smart Gate for your organization. Smart Gate is in early access; contact your Statsig account team to request it.
You're an organization admin in Statsig. If your project doesn't belong to an organization, you need the project Admin role with integrations access.
You can install GitHub Apps in your GitHub organization, or someone who can is available to approve the install.
Connect the Statsig GitHub App
Smart Gate uses the Statsig GitHub App, which appears as Statsig Code on GitHub. If you already connected it for code references or the GitHub AI integration, skip to the next step.
- In the Statsig console, go to Settings > Integrations.
- Select the Statsig GitHub App card, then select Enable Connection.
- On GitHub, choose your organization and the repositories to grant access to, then approve the requested permissions.
Other Statsig projects inherit the connection from the same card. Inherit it in each project that should receive gates.
If your GitHub organization restricts access by IP address, allowlist the Statsig IP ranges.
Open the Smart Gate settings
- In the Statsig console, go to Settings > Integrations and select the Statsig GitHub App card.
- On the Smart Gate card, select Set up Smart Gate. After setup, this button reads Manage Smart Gate.
You can also search for Smart Gate Settings from the console search bar.
The settings page has three tabs: Repositories, Projects, and Rollout & cleanup. Changes don't take effect until you select Save changes.
Choose the repositories to review
Smart Gate only reviews pull requests in repositories you add on the Repositories tab, even if the GitHub App can access more.
- Select Add a repository and pick a repository from the list.
- Under Suggest gates for, choose how many suggestions Smart Gate makes:
- High-risk changes (default): the fewest suggestions, only for changes likely to break users.
- Medium and high-risk changes: more suggestions, including moderate behavior changes.
- Under Review new pull requests automatically, choose when Smart Gate reviews a PR:
- On (default): Smart Gate reviews every PR when it opens or someone marks it ready for review.
- Off: Smart Gate only reviews a PR when someone comments
@statsig gate thisor adds thesmart-gatelabel.
- Under Folders, choose where gates go. The root row sets the Statsig project for the whole repository. To send gates for part of a monorepo to a different project, select Add folder rule, pick the folder, and choose a project under Gates created in.
If a single PR changes folders mapped to different projects, Smart Gate doesn't wrap it.
Smart Gate doesn't create the smart-gate label. To let people opt in with the label, create a label named smart-gate in the GitHub repository.
Configure each project that receives gates
The Projects tab lists the projects that receive gates for the folders you mapped. Monitoring and safeguards use each project's own metrics, teams, and alerts. Select a project to edit these settings, which apply to every gate Smart Gate creates in that project:
- Metrics to attach: the metrics Smart Gate adds to each new gate.
- Core metrics (default): the project's metrics tagged Core. This option works with no setup.
- Owning team's gate metrics: the default gate metrics of the team you choose under Owning team.
- Core metrics + suggested: Core metrics, plus metrics Smart Gate suggests for the change.
- Owning team: the team that owns new gates. Required for Owning team's gate metrics, or if the project requires a team on new configs.
- Target apps: the target apps for new gates. Leave empty for all apps.
- Safeguards: the Guardrail alerts and Topline alerts to watch during the ramp. If one fires, Statsig turns the gate back off.
Set at least one safeguard alert. Smart Gate doesn't ramp a gate without one. To create alerts, go to Alerts. To learn how alerts protect a rollout, go to Safeguards.
Configure rollout and cleanup
The Rollout & cleanup tab controls what happens after a wrapped PR merges.
- Rollout schedule: the phases each gate ramps through after its PR deploys. Without a custom schedule, Statsig uses its default of 5%, 25%, then 100%, with 24 hours per phase. To change it, select Customize. The last phase must reach 100%.
- Wait for deploy up to: how long Smart Gate waits for the merged code to reach production before it gives up. The default is 120 hours.
- Clean up launched gates after: how many days a gate stays at 100% before Smart Gate opens a PR to remove it from the code. The default is 10 days.
- Open at most: the daily limit on cleanup PRs. The default is 10.
- Archive the gate when its cleanup PR merges: off by default.
- Fix failing checks on Smart Gate PRs: when on, Smart Gate tries to fix CI failures on its own wrap PRs. Off by default.
- Send Slack notifications: on by default. Choose which events to send: Rollout started, Launched to 100%, Rolled back, Cleanup PR opened, CI repair gave up, and Deploy wait timed out.
Notifications go to the Slack channel of the project that owns each gate. That project needs Slack connected with Smart Gate lifecycle turned on in its event filtering.
Turn on Smart Gate
- At the top of the settings page, set the Smart Gate switch to On.
- Select Save changes.
Smart Gate starts reviewing pull requests opened after you turn it on. To review a PR that was already open, comment @statsig gate this on it.
To stop Smart Gate, set the switch to Off and save. Smart Gate stops reviewing new pull requests.
Was this helpful?