Skip to content

Auto-apply paid defaults (model + web search) for pro/max/team users#470

Merged
AnthonyRonning merged 1 commit intomasterfrom
devin/1776185727-paid-defaults-auto-apply
Apr 14, 2026
Merged

Auto-apply paid defaults (model + web search) for pro/max/team users#470
AnthonyRonning merged 1 commit intomasterfrom
devin/1776185727-paid-defaults-auto-apply

Conversation

@devin-ai-integration
Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration Bot commented Apr 14, 2026

Summary

When a user upgrades to a pro/max/team plan, we now automatically select the "Powerful" model (kimi-k2-5) and enable web search as a one-time flip. This addresses the problem of paid users staying on the default free model with no web search, leading to a degraded experience and refund requests.

Key changes:

  • One-time paid defaults flip (LocalStateContext.tsx): When setBillingStatus detects a pro/max/team plan and paidDefaultsApplied is not set in localStorage, auto-set model to kimi-k2-5 and enable web search. The paidDefaultsApplied key stores an ISO date string for future extensibility.
  • setModelInternal vs setModel split: New internal setter for system-initiated model changes (billing logic). The public setModel continues to be used for user-initiated changes. Both write to selectedModel in localStorage.
  • getInitialWebSearchEnabled(): New exported function that checks localStorage → paidDefaultsApplied → cached billing status, so returning paid users see correct defaults instantly on load (no flicker).
  • Downgrade handling: On downgrade to free/starter, clears paidDefaultsApplied and selectedModel so defaults re-apply if they upgrade again.
  • Removed WebSearchInfoDialog: The first-time web search explainer dialog is deleted entirely. Toggle handlers simplified to just flip the boolean.
  • Billing sync effect in UnifiedChat.tsx: A new useEffect picks up the localStorage webSearchEnabled value when localState.billingStatus changes, so the UI reflects the one-time flip without a full remount.

Review & Testing Checklist for Human

  • Verify no preference loss on upgrade: Manually test the flow where a user has already selected a specific model and toggled web search off, then "upgrades" — their choices should be preserved because paidDefaultsApplied was already set. The one-time flip should NOT override existing preferences.
  • Verify the downgrade → re-upgrade cycle: When a user downgrades, paidDefaultsApplied and selectedModel are cleared. On re-upgrade, defaults should re-apply. Confirm this doesn't surprise users who had a model preference before downgrading.
  • Check for flicker on load: For a returning paid user, getInitialModel() and getInitialWebSearchEnabled() read cached billing synchronously. Verify there's no visible flicker — model and web search should be correct from the first render.
  • Inspect the useEffect sync in UnifiedChat (lines 965-972): This reads localStorage when localState.billingStatus changes. Confirm it doesn't cause a write-loop with the useEffect that persists isWebSearchEnabled to localStorage (lines 960-962). They should converge since the value is the same, but worth confirming in practice.
  • Test plan: Log in as a free user → upgrade to pro → verify model switches to "Powerful" and web search turns on. Then manually change model → refresh → verify your choice is preserved. Downgrade → verify free model is restored. Re-upgrade → verify defaults re-apply.

Notes

  • paidDefaultsApplied stores an ISO date string (not a boolean) so future features can check when defaults were applied and decide whether to apply newer defaults.
  • Both setModelInternal and setModel write to selectedModel in localStorage — the system vs user distinction is conceptual and gated by paidDefaultsApplied, not by a separate storage key.
  • The early return in setBillingStatus after applying paid defaults (around line 253) means the subsequent billingChanged model-update logic is skipped on first application. This is intentional since defaults are set right there.

Link to Devin session: https://app.devin.ai/sessions/b7ad265f32ad4e3e81f69a4555f1ac50


Open with Devin

- Add one-time paid defaults flip: when billing confirms pro/max/team and
  paidDefaultsApplied is not set, auto-select 'Powerful' model (kimi-k2-5)
  and enable web search
- Store paidDefaultsApplied as ISO date string for future extensibility
- Add getInitialWebSearchEnabled() for billing-aware fast initial load
- Add setModelInternal() to distinguish system vs user model changes
- Respect manual user choices: once defaults are applied, never override
- Handle downgrade: clear paid defaults when switching to free/starter
- Remove WebSearchInfoDialog entirely (no longer needed with auto-enable)
- Simplify web search toggle handlers (remove first-time dialog logic)

Co-Authored-By: tony@opensecret.cloud <TonyGiorgio@protonmail.com>
@devin-ai-integration
Copy link
Copy Markdown
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

Copy link
Copy Markdown
Contributor Author

@devin-ai-integration devin-ai-integration Bot left a comment

Choose a reason for hiding this comment

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

Devin Review found 1 potential issue.

View 5 additional findings in Devin Review.

Open in Devin Review

Comment thread frontend/src/state/LocalStateContext.tsx
@devin-ai-integration
Copy link
Copy Markdown
Contributor Author

End-to-End Test Results: Paid Defaults Auto-Apply

Tested on localhost:5173 (dev server) using Zaprite test payment provider. All 4 tests passed.

Test 2: Upgrade to Pro — auto-defaults apply (PASSED)

Free user upgraded to Pro via Zaprite test checkout (Card, "CONFIRMED"). After redirect:

  • Model auto-switched from QuickPowerful
  • Web search auto-enabled (globe blue)
  • paidDefaultsApplied = "2026-04-14T17:20:57.461Z" (ISO date)
  • Sidebar badge: FREE PLAN → PRO PLAN
Before (Free) After (Pro)
before after
Test 1: Free user baseline (PASSED)
  • Model: Quick, Web search: OFF, paidDefaultsApplied: null
Test 3: Manual model change preserved after reload (PASSED)

Manually switched to Quick → reloaded page → Quick still selected. paidDefaultsApplied retained.

Test 4: Web search toggle — no info dialog (PASSED)

Toggled globe OFF then ON. No "first time using web search" dialog appeared.


Devin session

@marksftw
Copy link
Copy Markdown
Contributor

Worked for me

  1. Created a free account
  2. Changed model to Llama under the More Models menu
  3. Made a chat
  4. Upgraded to Max
  5. Went back to chat and it was set to Powerful and web search was enabled
  6. Continuing the same chat it used Powerful instead of Llama

@AnthonyRonning AnthonyRonning merged commit ab09696 into master Apr 14, 2026
15 checks passed
@AnthonyRonning AnthonyRonning deleted the devin/1776185727-paid-defaults-auto-apply branch April 14, 2026 20:43
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