Skip to content

[$175] Gusto-Setting defaulted to "Manager approval" instead of "Custom approval" #103307

Closed

Description

@applause-bot

If you haven’t already, check out our contributing guidelines for onboarding. To join our Slack channel, fill out this form.


Version Number: 9.5.4-0
Reproducible in staging?: Yes
Reproducible in production?: Unable to validate in Prod - Provide reasoning.
If this was caught during regression testing, add the test name, ID and link from BrowserStack: #102750
Email or phone of affected tester (no customers): N/A
Issue reported by: Applause Internal Team
Bug source: Pull Request QA execution
Device used: Windows 11 / Chrome, iPhone 13 / iOS 27 Beta, Samsung Galaxy A52 / Android 14
App Component: Workspace Settings

Action Performed:

Preconditions:

  • logged in to a new gmail account
  • create a workspace, invite 2 members to the workspace

Steps:

  1. Go to workflow in workspace setting
  2. Navigate to approval in workflow, disable and enable the approval
  3. Click edit on default workflow, add a second approver
  4. Add another approval workflow that will create 2 approvers
  5. Go to more features, enable HR
  6. Connect Gusto in HR
  7. Close the gusto sync complete RHP page
  8. Observe the approval mode

Expected Result:

it should starts with a Custom approval setting as default

Actual Result:

it starts with a Manager approval setting as default

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Bug7279603_1791341418415.bandicam_2026-10-07_09-27-45-467.mp4

View all open jobs on GitHub

Applause Internal Information
Exported by: Julia Ponikarchuk
Bug ID: 7279603

Upwork Automation - Do Not Edit
Issue OwnerCurrent Issue Owner: @MonilBhavsar

Activity

  1. added
    Daily
    Bug
    on Oct 7, 2026
  2. applause-bot commented on Oct 7, 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/19890865fab07280f4eb62ac479cfea3d838d24b31c2bcb406b35855e055a9fa

  3. MelvinBot commented on Oct 7, 2026

    @MelvinBot
    Contributor

    Issue Analysis

    Root Cause: The App does not choose the Gusto approval mode. It only displays the approvalMode value stored on the policy (GustoApprovalModePage.tsx:31). "Manager approval" appears because the backend saved APPROVAL_ADVANCED when Gusto connected. This appears to be a backend/internal issue. A separate internal investigation is needed.

    Recommended Fix: The fix requires changes outside the App repo. Please escalate to an internal engineer with backend access. No App code change is recommended.

    Investigation details

    How the App picks the selected option

    • HRApprovalModePageBase.tsx:71-73 selects draftApprovalMode ?? currentApprovalMode. Each option is selected by a plain equality check.
    • Mode values are in CONST/index.ts:3420-3426. MANAGER maps to APPROVAL_ADVANCED, and CUSTOM maps to APPROVAL_MANUAL.
    • The App has no fallback to Manager. If the value were empty, the page would select nothing and the HR card would show "Not set".
    • The App never infers "Custom" from existing approval workflows.

    Connect and sync flow

    • Connecting Gusto only opens a backend link (Gusto.ts:17-24). It sends no optimistic approvalMode.
    • The sync-complete page only reads sync result counts.
    • The App writes approvalMode only when the user presses Save on the approval mode page (Gusto.ts:26).

    Possible trigger (unconfirmed)
    Approval workflows are saved in two formats, depending on the multipleApprovers beta (WorkspaceWorkflowsApprovalsCreatePage.tsx:78-82):

    • With the beta on, workflows are saved as approval rules.
    • With the beta off, workflows are saved on the member list.

    The reviewer of [Payment due @mkhutornyi] Keep approval workflow rules working with HR integrations saw Gusto start in Custom mode. Test step 5 there checks approval "rules", which suggests the beta was on. QA used a new Gmail account, which probably does not have the beta. If the backend picks Custom only when approval rules exist, that account would get Manager. An internal engineer should confirm what the backend checks and whether the QA account has the beta.

    Alternatives considered

    • An App-side default to Manager: none exists.
    • The sync-complete page overwriting the mode: it does not touch approvalMode.

    Related open issues:


    Next Steps: Reply with @MelvinBot <your feedback> to refine this analysis.

  4. added
    External
    on Oct 7, 2026
  5. melvin-bot commented on Oct 7, 2026

    @melvin-bot

    Triggered auto assignment to Contributor-plus team member for initial proposal review - @thelullabyy (External)

  6. changed the title [-]Gusto-Setting defaulted to "Manager approval" instead of "Custom approval"[/-] [+][$175] Gusto-Setting defaulted to "Manager approval" instead of "Custom approval"[/+] on Oct 7, 2026
  7. melvin-bot commented on Oct 7, 2026

    @melvin-bot
  8. yuvrajangadsingh commented on Oct 7, 2026

    @yuvrajangadsingh
    Contributor

    withdrawing this, it went up before the issue had the Help Wanted label. will come back if the label is added.

  9. jloa-dev commented on Oct 11, 2026

    @jloa-dev

    Proposal

    Please re-state the problem that we are trying to solve in this issue.

    When a workspace already has custom approval workflows configured (e.g. multiple approvers or custom rules) and Gusto is connected via Workspace Settings > More features > HR, the Gusto approval mode is displayed and defaulted to "Manager approval" instead of preserving "Custom approval".

    What is the root cause of that problem?

    In PR #102750, support was added to keep approval workflow rules working with HR integrations (hasApprovalWorkflowRules). However:

    1. In src/pages/workspace/hr/utils.ts and src/pages/workspace/hr/HRApprovalModePageBase.tsx:
      • getCurrentApprovalMode reads policy?.connections?.gusto?.config?.approvalMode.
      • When Gusto is newly connected, approvalMode is not yet explicitly set in the connection config.
      • getHRApprovalMode in src/libs/merge/HRUtils.ts falls back to null, and getApprovalModeLabel or default selection fails to inspect whether the workspace already has custom approval workflow rules.
      • As a result, the UI falls back to the default HR provider behavior, showing "Manager approval", which risks deleting existing custom workflow rules upon saving.

    What changes do you think we should make in order to solve the problem?

    1. Update getHRApprovalMode in src/libs/merge/HRUtils.ts:
      Accept rulesCollection?: OnyxCollection<Rule> (or policyID) and default unconfigured HR connections to CUSTOM if the workspace has active approval workflow rules:

      function getHRApprovalMode(
          policy?: OnyxEntry<Policy>,
          connectionName?: HRConnectionName,
          rules?: OnyxCollection<Rule>,
      ): ValueOf<typeof CONST.GUSTO.APPROVAL_MODE> | ValueOf<typeof CONST.ZENEFITS.APPROVAL_MODE> | MergeApprovalMode | null {
          if (!connectionName || !policy?.connections) {
              return null;
          }
          const configuredMode = policy.connections[connectionName]?.config?.approvalMode;
          if (configuredMode) {
              return configuredMode;
          }
          // If the workspace already has custom approval workflow rules, default to CUSTOM approval
          if (hasApprovalWorkflowRules(rules, policy?.id)) {
              return CONST.GUSTO.APPROVAL_MODE.CUSTOM;
          }
          return null;
      }
    2. In src/pages/workspace/hr/HRApprovalModePageBase.tsx:
      Pass rules to derive currentApprovalMode so that if no approval mode was explicitly stored yet on the connection, it correctly preselects CUSTOM:

      const currentApprovalMode = config.getCurrentApprovalMode(policy, rules) ?? (hasApprovalWorkflowRules(rules, policyID) ? config.approvalModes.CUSTOM : config.approvalModes.MANAGER);
    3. In src/pages/workspace/hr/gusto/GustoApprovalModePage.tsx:
      Update getCurrentApprovalMode config signature to support rule detection:

      getCurrentApprovalMode: (policy, rules) => policy?.connections?.gusto?.config?.approvalMode ?? (hasApprovalWorkflowRules(rules, policyID) ? CONST.GUSTO.APPROVAL_MODE.CUSTOM : undefined),

    What alternative solutions did you explore? (Optional)

    • Only changing the display label in utils.ts: Insufficient because HRApprovalModePageBase would still stage MANAGER mode upon save, triggering the prompt to delete workflow rules.

    What specific scenarios should we cover in automated tests?

    In tests/unit/WorkflowUtilsTest.ts and tests/unit/HRConnectionActionTest.ts:

    1. Workspace with 2+ approvers (custom workflow rules) connecting Gusto defaults to CUSTOM approval mode.
    2. Workspace with default/single approver without custom rules defaults to standard manager or basic mode.
    3. Verify that saving in custom mode does not delete approval workflow rules in Onyx.
  10. melvin-bot commented on Oct 12, 2026

    @melvin-bot

    @thelullabyy Huh... This is 4 days overdue. Who can take care of this?

  11. thelullabyy commented on Oct 13, 2026

    @thelullabyy
    Contributor
  12. 19 remaining items

  13. melvin-bot commented on Nov 3, 2026

    @melvin-bot

    @MonilBhavsar 12 days overdue now... This issue's end is nigh!

  14. MonilBhavsar commented on Nov 3, 2026

    @MonilBhavsar
    Contributor

    Exported to BEC

  15. melvin-bot commented on Nov 3, 2026

    @melvin-bot

    @MonilBhavsar 12 days overdue now... This issue's end is nigh!

  16. melvin-bot commented on Nov 4, 2026

    @melvin-bot

    @MonilBhavsar @thelullabyy this issue is now 4 weeks old, please consider:

    • Finding a contributor to fix the bug
    • Closing the issue if BZ has been unable to add the issue to a VIP or Wave project
    • If you have any questions, don't hesitate to start a discussion in #expensify-open-source

    Thanks!

  17. m-natarajan commented on Nov 5, 2026

    @m-natarajan

    @MonilBhavsar Unable to connect to Gusto and locked your message displayed, Used the following credentials for 1Password
    expensify@gustodemo.com Could you please look in to this?

    Image
  18. MonilBhavsar commented on Nov 5, 2026

    @MonilBhavsar
    Contributor

    @m-natarajan i can login. Can you retry

    Image
  19. m-natarajan commented on Nov 6, 2026

    @m-natarajan

    @MonilBhavsar Issue not repro in Win11/Chrome, v9.5.32-7
    Please note still the credentials (expensify@gustodemo.com) not working, used the other credentials(francois@expensify.com) to validate the test

    Recording.3793.mp4
  20. MonilBhavsar commented on Nov 7, 2026

    @MonilBhavsar
    Contributor

    Thanks!! Closing

  21. melvin-bot commented on Nov 8, 2026

    @melvin-bot

    📣 @jeff-graham-ai! 📣
    Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork.
    Please follow these steps:

    1. Make sure you've read and understood the contributing guidelines.
    2. Get the email address used to login to your Expensify account. If you don't already have an Expensify account, create one here. If you have multiple accounts (e.g. one for testing), please use your main account email.
    3. Get the link to your Upwork profile. It's necessary because we only pay via Upwork. You can access it by logging in, and then clicking on your name. It'll look like this. If you don't already have an account, sign up for one here.
    4. Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details.
      Screen Shot 2022-11-16 at 4 42 54 PM
      Format:
    Contributor details
    Your Expensify account email: <REPLACE EMAIL HERE>
    Upwork Profile Link: <REPLACE LINK HERE>
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

BugDailyExternal

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions