Skip to content

[$250] Emails-Two "Your free trial has started" emails sent to the user after onboarding #91783

Closed

Description

@applause-bot

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Version Number: 9.3.83-0
Reproducible in staging?: Yes
Reproducible in production?: No
If this was caught during regression testing, add the test name, ID and link from BrowserStack: https://test-management.browserstack.com/projects/2219752/folder/13176726/test-cases/41237090
Email or phone of affected tester (no customers): N/A
Issue reported by: Applause Internal Team
Bug source: Exploratory - Significant User Experience Deterioration
Device used: MacBook Air 26.5 Chrome, iPhone 15 iOS 26.5
App Component: Notifications

Action Performed:

  1. Navigate to staging.new.expensify.com
  2. Enter a new email address with a "+"that you can access
  3. On the onboarding select "Manage my team's expenses" - 5-10 - QBO
  4. Complete the onboarding
  5. Open the Inbox for the onboarded user, look for the email with the subject "Your free trial has started! Let's get you set up."

Expected Result:

Only one "Free trial" email arrives

Actual Result:

Onboarded user receives two identical "Your free trial has started! Let's get you set up." emails

Workaround:

Unknown

Platforms:

  • Android: App
  • Android: mWeb Chrome
  • iOS: App
  • iOS: mWeb Safari
  • iOS: mWeb Chrome
  • Windows: Chrome
  • MacOS: Chrome Safari

Screenshots/Videos

Bug7163943_1779849942783.two_emails.mp4

View all open jobs on GitHub

Applause Internal Information
Exported by: Mita Rachim
Bug ID: 7163943

Upwork Automation - Do Not Edit

Activity

  1. applause-bot commented on May 27, 2026

    @applause-bot
    Author

    While Applause doesn't embed attachments for this bug, here are the links for quick view:
    https://platform.applause.com/services/links/v1/external/4c2be4870cff65042b4dfe1599684397196cae398892cf403d4a37e648008d83

  2. added
    DeployBlockerCashThis issue or pull request should block deployment
    BugSomething is broken. Auto assigns a BugZero manager.
    on May 27, 2026
  3. melvin-bot commented on May 27, 2026

    @melvin-bot

    Triggered auto assignment to @mjasikowski (DeployBlockerCash), see https://stackoverflowteams.com/c/expensify/questions/9980/ for more details.

  4. melvin-bot commented on May 27, 2026

    @melvin-bot

    💬 A slack conversation has been started in #expensify-open-source

  5. github-actions commented on May 27, 2026

    @github-actions
    Contributor

    👋 Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open `StagingDeployCash` deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:

    1. Identify the pull request that introduced this issue and revert it.
    2. Find someone who can quickly fix the issue.
    3. Fix the issue yourself.
  6. mitarachim commented on May 27, 2026

    @mitarachim

    Issue not reproducible when Use Staging Server is OFF / Disable

    ss.off.email.mp4
  7. MelvinBot commented on May 27, 2026

    @MelvinBot
    Contributor

    Proposal

    Problem: During the "Manage my team's expenses" onboarding flow, the App sends two separate API calls to the backend — CreateWorkspace then CompleteGuidedSetup — and both carry engagementChoice='newDotManageTeam'. The backend appears to trigger the "free trial started" email on both commands, resulting in two identical emails.

    Solution: The backend should deduplicate the free trial email. However, from the App side, the fix is to stop sending engagementChoice on CreateWorkspace when it will also be sent on the subsequent CompleteGuidedSetup call (i.e., when shouldAddOnboardingTasks is false). This way, only CompleteGuidedSetup triggers the trial email.

    In buildPolicyData in Policy.ts, engagementChoice is unconditionally included in CreateWorkspace params (line ~3021), but guidedSetupData is only included when shouldAddOnboardingTasks is true (line ~3031). When shouldAddOnboardingTasks is false (the MANAGE_TEAM flow from BaseOnboardingInterestedFeatures.tsx:207), CreateWorkspace sends engagementChoice without guidedSetupData, and then CompleteGuidedSetup sends engagementChoice again with the full guided setup data — giving the backend two separate signals to start the trial.

    What needs to change:

    • In Policy.ts around line 3021: Only include engagementChoice (and companySize, userReportedIntegration) in CreateWorkspace params when shouldAddOnboardingTasks is true — i.e., when CreateWorkspace is bundling the guided setup data and no separate CompleteGuidedSetup call will follow. When shouldAddOnboardingTasks is false, these fields should be omitted from CreateWorkspace since they'll be sent on the subsequent CompleteGuidedSetup call.
    Investigation details

    Why staging-only: PR Expensify/App#89469 (merged May 21) dropped the cohort gate so that all MANAGE_TEAM signups now use the bespoke server-side welcome path. The key commit 41c1461264c ("Remove client-side bespoke welcome message generation") made the server the sole source of truth for admins room welcome content. This likely changed how the backend processes CreateWorkspace with engagementChoice — previously the backend may not have acted on engagementChoice in CreateWorkspace for trial email purposes, but with the server now owning welcome message generation, it processes the engagement choice on both commands.

    Data flow:

    1. User selects "Manage my team's expenses" → 5-10 → QBO → Continue
    2. BaseOnboardingInterestedFeatures.tsx:199: createWorkspace() sends CreateWorkspace API with engagementChoice='newDotManageTeam', companySize, shouldAddOnboardingTasks: false
    3. BaseOnboardingInterestedFeatures.tsx:227: completeOnboarding() sends CompleteGuidedSetup API with same engagementChoice, companySize, plus guidedSetupData
    4. Backend receives both → triggers trial email twice

    Alternative considered: Double-tap on the Continue button could also cause CompleteGuidedSetup to fire twice, but the isLoading guard at line 186 and the pattern of exactly two emails (not random multiples) more strongly supports the two-different-API-calls theory.

    Note: The backend (Auth/Web-Expensify) should also add deduplication for the trial email as a defense-in-depth measure, but those repos were inaccessible for this investigation.


    Next Steps for Contributor+ team: Reply with @MelvinBot implement this to create a draft PR, @MelvinBot <your feedback> to refine this analysis, or explain why you are rejecting Melvin's proposal.

  8. mjasikowski commented on May 27, 2026

    @mjasikowski
    Contributor

    @MelvinBot which PR introduced the duplication?

  9. MelvinBot commented on May 27, 2026

    @MelvinBot
    Contributor

    Based on my earlier analysis, the likely introducing PR is #89469 ("Onboarding: drop cohort gate now that server generates per-tier welcome"), merged May 21.

    That PR removed the cohort gate so all MANAGE_TEAM signups use the server-side welcome path. This changed how the backend processes the engagementChoice param — it now acts on it in both the CreateWorkspace and CompleteGuidedSetup API calls, triggering the trial email twice. Previously, the backend likely only triggered the email on CompleteGuidedSetup.

  10. mjasikowski commented on May 27, 2026

    @mjasikowski
    Contributor

    @MelvinBot #89469 is already in production and the bug doesn't seem to be reproducible in production, only on staging

  11. 57 remaining items

  12. mjasikowski commented on Jun 8, 2026

    @mjasikowski
    Contributor

    Still working on the BE fix

  13. mjasikowski commented on Jun 11, 2026

    @mjasikowski
    Contributor

    BE fix in review

  14. mjasikowski commented on Jun 15, 2026

    @mjasikowski
    Contributor

    Still waiting for review

  15. mjasikowski commented on Jun 18, 2026

    @mjasikowski
    Contributor

    This is merged now and should be no longer happening

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

DailyKSv2Help WantedApply this label when an issue is open to proposals by contributors

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions