Auto oss vs cost efficient 50/50 A/B test (#9355)

I want to run an a/b test where 50% of free users get defaulted to auto
cost efficient, and other 50% to auto open weights.

## Tests
- 50% of the time when i open the app with a different WARP_DATA_DIR i
get the expected flip/flopping
- my default gets persisted throughout signup

---------

Co-authored-by: Oz <oz-agent@warp.dev>
This commit is contained in:
Isaiah
2026-04-28 23:33:23 -04:00
committed by GitHub
co-authored by Oz
parent f0c8b7f723
commit d0f045c01b
4 changed files with 110 additions and 4 deletions
+26
View File
@@ -7,10 +7,15 @@ use warp_core::ui::icons::Icon;
use warpui::{AppContext, SingletonEntity};
use crate::auth::AuthStateProvider;
use crate::experiments::FreeTierDefaultModel;
use crate::workspaces::user_workspaces::UserWorkspaces;
use super::llms::{DisableReason, LLMInfo, LLMPreferences};
/// mirrors server-side model ids
const AUTO_OPEN_LLM_ID: &str = "auto-open";
const AUTO_COST_EFFICIENT_LLM_ID: &str = "auto-efficient";
impl From<&LLMInfo> for OnboardingModelInfo {
fn from(llm: &LLMInfo) -> Self {
Self {
@@ -36,6 +41,27 @@ pub fn build_onboarding_models(prefs: &LLMPreferences) -> (Vec<OnboardingModelIn
(models, default_id)
}
pub fn apply_free_tier_default_model_override(
models: &mut [OnboardingModelInfo],
server_default_id: LLMId,
ctx: &mut AppContext,
) -> LLMId {
// server only gives back cost-efficient as a default if you're on a free or no plan
// if you ARE on some sort of plan... we should respect what the server says
if server_default_id != LLMId::from(AUTO_COST_EFFICIENT_LLM_ID) {
return server_default_id;
}
let auto_open_id = LLMId::from(AUTO_OPEN_LLM_ID);
let auto_open_available = models.iter().any(|m| m.id == auto_open_id);
if !auto_open_available || !FreeTierDefaultModel::should_default_to_auto_open(ctx) {
return server_default_id;
}
for m in models.iter_mut() {
m.is_default = m.id == auto_open_id;
}
auto_open_id
}
pub fn current_onboarding_auth_state(ctx: &AppContext) -> OnboardingAuthState {
let auth_state = AuthStateProvider::as_ref(ctx).get();
if auth_state.is_anonymous_or_logged_out() {