For AI agents: a documentation index is available at /llms.txt. Append .md to any page URL for markdown, or send Accept: text/markdown.
Work with Smart Gate on a pull request
What PR authors see when Smart Gate reviews a pull request, how to opt in with @statsig gate this, how to merge the wrap PR, and how Smart Gate ramps, reverts, and cleans up the gate.
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.
This page is for engineers whose pull requests Smart Gate reviews. Your Statsig organization admin must set up Smart Gate for the repository first.
Commands
| Action | Effect |
|---|---|
Comment @statsig gate this | Opts the PR in and starts the wrap. Also re-wraps the PR after you push new commits. |
Add the smart-gate label | Same as @statsig gate this, if the repository has a label with that name. |
Comment @statsig feedback <your note> | Sends feedback about the suggestion to Statsig. |
Smart Gate accepts commands from your team's members and collaborators.
When Smart Gate reviews a pull request
If the repository reviews pull requests automatically, Smart Gate reviews your PR when you open it or mark it ready for review. Otherwise, it reviews a PR only when someone comments @statsig gate this. Smart Gate doesn't review drafts, or PRs from forks or bots.
If the change doesn't need a gate, Smart Gate marks the PR No gate needed. Its check never fails, so it never blocks your merge. If you disagree, comment @statsig gate this and Smart Gate wraps the PR anyway.
If the change is risky, Smart Gate comments with what could break and the gate it plans to create. To accept, reply @statsig gate this. If you don't want a gate, ignore the comment.
Review and merge the wrap PR
After you opt in, Smart Gate creates the gate, off in production and on in development and staging, and opens a wrap PR into your branch. The wrap PR follows your codebase's conventions for Statsig. If the changed code runs in a service that doesn't use a Statsig SDK yet, Smart Gate sets one up in the wrap PR where it can.
To ship the change:
- Review the wrap PR. You can push changes to its branch like any other PR.
- Merge the wrap PR into your branch.
- Merge your original PR as usual.
If you merge your original PR without the wrap PR, Smart Gate removes the gate and nothing ramps.
If you push more commits to your PR after opting in, the wrap PR doesn't cover them. Reply @statsig gate this again to rebuild the wrap.
If CI fails on the wrap PR, push a fix to the wrap branch. If your organization turned on CI repair, Smart Gate tries to fix it first.
Ramp, revert, and launch
After the code deploys, Statsig ramps the gate on your organization's rollout schedule. Smart Gate's comment on your PR shows the current percentage.
If a safeguard alert fires, Statsig turns the gate back off and Smart Gate mentions you on the PR. Investigate the alert, then ramp the gate from its page in the console when you're ready.
If Smart Gate pauses the ramp, for example because the gate has no safeguard alerts, its comment on the PR says why and what to do.
Cleanup
After the gate has been fully launched for a while, Smart Gate opens a PR that removes the gate from your code. Review and merge it like any other PR. To remove a launched gate sooner, select Remove from Code on the gate's page in the Statsig console.
Stop Smart Gate on a pull request
Smart Gate doesn't change anything until someone opts in. After that, close the wrap PR to stop it from gating your PR.
Was this helpful?