[$175] There right approver is not shown after turning back the approval mode
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.35-1 Reproducible in staging?: Yes Reproducible in production?: Yes If this was caught during regression testing, add the test name, ID and link from BrowserStack: https://github.com/Expensify/App/pull/105595 Email or phone of affected tester (no customers): [email protected] Issue reported by: Applause Internal Team Bug source: Pull Request QA execution Device used: iPhone 11 App Component: Workspace Settings
Action Performed:
Precondition: Have a workspace > invite a user A and make user A the approver
- Submit an expense to a workspace chat
- Open the report, notice that the next step show user A as the approver
- Go to workspace > Turn off the approval mode > Turn it back on
- Set user A as the approver
- Go to workspace chat > Open report
Expected Result:
the next step show user A as the approver
Actual Result:
The next step show the owner(you) as the approver
Workaround:
Unknown
Platforms:
- [x] Android: App
- [ ] Android: mWeb Chrome
- [x] iOS: App
- [ ] iOS: mWeb Safari
- [ ] iOS: mWeb Chrome
- [ ] Windows: Chrome
- [ ] MacOS: Chrome Safari
Screenshots/Videos
https://github.com/user-attachments/assets/b11735d2-41a7-45d9-9d19-3879ccd75c35
Applause Internal Information Exported by: Julia Ponikarchuk Bug ID: 7309638
Upwork Automation - Do Not Edit
- Upwork Job URL: https://www.upwork.com/jobs/~022120064872446889807
- Upwork Job ID: 2120064872446889807
- Last Price Increase: 2026-11-10
Issue Owner
Current Issue Owner: @AndrewGable
While Applause doesn't embed attachments for this bug, here are the links for quick view: https://platform.applause.com/services/links/v1/external/ab15f56c35f372e8273c73c20158b50bf0b7d684a35fcfaf72712ad1a0ed93a3
Triggered auto assignment to Contributor-plus team member for initial proposal review - @ikevin127 (External)
Job added to Upwork: https://www.upwork.com/jobs/~022120064872446889807
Proposal
What is the root cause of that problem?
Live state analysis on Web reveals that this is not merely a presentation/stale banner defect: the report is genuinely assigned to the workspace owner on the server.
- Backend Reassignment on Approval Disable:
- In
src/libs/actions/Policy/Policy.ts:1191–1210, toggling approvals off setsapprovalMode: OPTIONAL. On the backend, disabling approvals strips approval routing and moves all existing submitted reports under the workspace owner (report.managerID: ownerAccountID).
- In
- Missing Re-routing on Default Approver Update:
- When approvals are re-enabled, the default approver resets to the owner.
- When the user subsequently edits the default workflow (
Everyone) and sets Member A as the approver,updateApprovalWorkflowRulescallsupdatePolicyDefaultApprover(src/libs/actions/Workflow.ts:387–405), sendingWRITE_COMMANDS.UPDATE_WORKSPACE_APPROVAL. UPDATE_WORKSPACE_APPROVALupdatespolicy.approver = A, but the backend does not automatically re-assign existing submitted reports from the owner to A.- Consequently:
policy.approver: Member Areport.managerID: Workspace Ownerreport.nextStep.actorAccountID: Workspace Owner
- Because
report.managerIDgenuinely belongs to the owner, the Next Step banner correctly identifies the owner.
What changes do you think we should make in order to solve the problem?
There are two distinct paths depending on Expensify Product consensus:
Path 1: If existing submitted reports should follow the newly updated default approver (Recommended if reassignment is desired):
This requires client-side optimistic synchronization paired with backend UpdateWorkspaceApproval support:
- In
src/libs/actions/Workflow.ts(updatePolicyDefaultApprover/updateApprovalWorkflowRules):- When the default approver changes from owner to Member A (
newDefaultApproverAccountID !== previousDefaultApproverAccountID): - Find all submitted expense reports on the workspace:
const submittedReports = Object.values(allReports ?? {}).filter( (report) => report?.policyID === policy.id && ReportUtils.isExpenseReport(report) && report.statusNum === CONST.REPORT.STATUS_NUM.SUBMITTED, ); - Optimistically update
managerIDand recomputenextStepfor those reports:const reportUpdates: Record<string, Partial<Report>> = {}; for (const submittedReport of submittedReports) { reportUpdates[`${ONYXKEYS.COLLECTION.REPORT}${submittedReport.reportID}`] = { managerID: newDefaultApproverAccountID, nextStep: buildOptimisticNextStep({ report: {...submittedReport, managerID: newDefaultApproverAccountID}, policy: updatedPolicy, rules: updatedRules, predictedNextStatus: CONST.REPORT.STATUS_NUM.SUBMITTED, }), pendingFields: {managerID: CONST.RED_BRICK_ROAD_PENDING_ACTION.UPDATE}, }; } - Include
reportUpdatesinoptimisticData,successData, andfailureDatainupdatePolicyDefaultApprover.
- When the default approver changes from owner to Member A (
- Backend Alignment: Ensure backend
UpdateWorkspaceApproval(orsetWorkspaceApprovalMode) moves submitted reports back to the new default approver upon configuration update.
Path 2: If the owner retaining existing submitted reports after an off/on cycle is expected product behavior (Working As Designed):
- If Product confirms that submitted reports should remain locked to the owner who held them during the toggle, and only newly submitted reports should route to Member A, then the current client behavior is 100% correct and expected (Not a Bug). The banner accurately informs the user that the owner holds the approval authority for that specific report.
What alternative solutions did you explore? (Optional)
- Patching only
NextStepUtils.tsto display Member A based onpolicy.approverwithout updatingmanagerID: Strongly rejected becausereport.managerIDdetermines who can actually click the "Approve" button. If the banner claimed Member A was the approver whilemanagerIDwas the owner, Member A would not be able to approve the report, introducing a fatal permission deadlock.
Tests
- In a workspace with approvals on, set Member A as default approver.
- Submit an expense report -> verify Next Step shows "Waiting for A to approve".
- Go to
Workflows > Approvals, turn approvals off, then turn back on. - Set Member A as approver again and save.
- Re-open the submitted report.
- Verify behavior matches the decided product spec (either optimistically routes to A, or consistently indicates the owner).
- Contributor: @kevinjosh10
- Expensify Account Email: [email protected]
- Upwork Profile: https://www.upwork.com/freelancers/~0131dae36abcf59374
Contributor details
Your Expensify account email: [email protected] Upwork Profile Link: https://www.upwork.com/freelancers/~0131dae36abcf59374
✅ Contributor details stored successfully. Thank you for contributing to Expensify!
🤖 Web test steps verification results: ⚠️ partial
The required second-member precondition could not be established on dev NewDot web. VERIFY 1–5 were not executed; no product failure for this issue was observed.
| Step | Status |
|---|---|
Workspace contains another member A as approverAfter the invitation attempt, Members still showed only the owner.![]() |
❌ |
Submit an expense to workspace chatNot executed: member precondition blocked. |
⚠️ |
Confirm the original next step names ANot executed: member precondition blocked. |
⚠️ |
Turn approvals off, then onNot executed: member precondition blocked. |
⚠️ |
Select A as approver againNot executed: member A was unavailable. |
⚠️ |
Reopen the report and verify A, not ownerNot executed: no original report was created. |
⚠️ |
Check reload persistenceNot executed: reload is prohibited by the test-session policy. |
⚠️ |
Preliminary analysis
Likely mechanism: The report’s stored next-step actor can become stale after the workspace approver changes. This is supported by code, but remains unconfirmed for the reported incident.
Code evidence and alternatives considered
- Re-enabling approvals explicitly supplies the workspace owner as the initial approver: WorkflowsApprovalsTab.tsx:333–347.
- Toggling rebuilds submitted reports’ stored
nextStep: Policy.ts:1215–1274. - Subsequently selecting A updates approval configuration without a corresponding client-side report refresh: Workflow.ts:213–258.
- The normal banner path returns the stored report field rather than recalculating its actor: NextStepUtils.ts:594–609.
Alternative: The server may actually leave the report assigned to the owner. The banner alone cannot distinguish that from stale presentation; changing its text without checking the actual assignment could misrepresent who can approve.
The owner-default behavior predates Remove getPersonalDetailByEmail usage in getAccountIDsByLogins #5, so discovery during that PR’s QA does not establish regression causality.
Required confirmation: Capture an affected report ID and narrow reproduction time, then compare managerID and nextStep.actorAccountID before and after each settings change and its server response. No sufficiently scoped production evidence was available. A banner-only fix should not be accepted until those values establish whether the defect is display invalidation or actual reassignment.
Proposal
Please re-state the problem that we are trying to solve in this issue.
After disabling workspace approvals (Workflows > Add approvals toggled off), turning approvals back on, and editing the default workflow (Everyone) to set User A as the approver, opening an already-submitted expense report still shows the workspace owner as the approver (Waiting for you to approve expenses) instead of User A.
What is the root cause of that problem?
In src/libs/actions/Policy/Policy.ts (setWorkspaceApprovalMode), src/pages/workspace/workflows/approvals/WorkspaceWorkflowsApprovalsEditPage.tsx (saveApprovalWorkflow), and src/libs/actions/Workflow.ts (updateApprovalWorkflowRules, updatePolicyDefaultApprover, createApprovalWorkflowRules, updateApprovalWorkflow, and createApprovalWorkflow):
-
Disabling and re-enabling approvals resets
employeeList[email].submitsToandreport.nextSteptopolicy.owner:- When approvals are toggled off in
WorkflowsApprovalsTab.tsx:139-147,setWorkspaceApprovalMode(..., CONST.POLICY.APPROVAL_MODE.OPTIONAL)(src/libs/actions/Policy/Policy.ts:1191-1210&1326-1358) setssubmitsTo = policy.ownerfor every employee inpolicy.employeeList, deletes all approval workflow rules inONYXKEYS.COLLECTION.RULE, and updatesreport.nextStepon allSUBMITTEDexpense reports. - When approvals are toggled back on (
WorkflowsApprovalsTab.tsx:333-348),setWorkspaceApprovalMode(policy, policy?.owner ?? '', CONST.POLICY.APPROVAL_MODE.BASIC, ...)setspolicy.approvalMode = CONST.POLICY.APPROVAL_MODE.BASICandpolicy.approver = policy.owner, and recomputesreport.nextStep(Policy.ts:1222-1287) for allSUBMITTEDreports to point to the workspace owner (while the backend reassignsreport.managerIDto the owner).
- When approvals are toggled off in
-
updateApprovalWorkflowRules/updatePolicyDefaultApproversendsemployees: '[]'and leavesemployeeList[email].submitsTostale when the default workflow is edited:- When the owner then edits the default workflow (
Everyone) inWorkspaceWorkflowsApprovalsEditPage.tsx:222-244to set User A as the approver,shouldUseApprovalWorkflowRules(src/libs/WorkflowUtils.ts:1588-1613) returnstrue(becauseapprovalMode === CONST.POLICY.APPROVAL_MODE.BASICunderMULTIPLE_APPROVERS), sosaveApprovalWorkflowcallsupdateApprovalWorkflowRules(src/libs/actions/Workflow.ts:418-462) rather thanupdateApprovalWorkflow. - Inside
updateApprovalWorkflowRules(andcreateApprovalWorkflowRules),setApprovalWorkflowRuleswritesReportSubmit/ReportApproverules, and then callsupdatePolicyDefaultApprover(approvalWorkflow, policy)(src/libs/actions/Workflow.ts:387-405). - However,
updatePolicyDefaultApproveronly merges{approver: newDefaultApprover}intoONYXKEYS.COLLECTION.POLICYand callsWRITE_COMMANDS.UPDATE_WORKSPACE_APPROVALwithemployees: '[]'(an empty array) instead of updatingemployeeList(submitsTo: newDefaultApprover) for the default workflow's members. Because every member'semployeeList[email].submitsTowas explicitly set topolicy.ownerwhen approvals were disabled, leavingemployeeListuntouched (and sendingemployees: '[]'toUpdateWorkspaceApproval) keepsemployeeList[email].submitsTo === policy.ownerand preventsUpdateWorkspaceApprovalfrom reassigning the submitted report's approver on the backend.
- When the owner then edits the default workflow (
-
Workflow save actions in
src/libs/actions/Workflow.tsdo not recomputereport.nextStep(orreport.managerID) for existingSUBMITTEDexpense reports:- Unlike
setWorkspaceApprovalModeinsrc/libs/actions/Policy/Policy.ts:1222-1287, neither the rules-based workflow actions (updateApprovalWorkflowRules,createApprovalWorkflowRules,removeApprovalWorkflowRules) nor the employeeList-based workflow actions (updateApprovalWorkflow,createApprovalWorkflow,removeApprovalWorkflow) insrc/libs/actions/Workflow.tsiterate overReportUtils.getAllPolicyReports(policy.id)(statusNum === CONST.REPORT.STATUS_NUM.SUBMITTED) to recomputereport.nextStepviabuildOptimisticNextStep(andreport.managerIDviagetSubmitToAccountID) using the updated policy and rules.
- Unlike
What changes do you think we should make in order to solve the problem?
-
In
src/libs/actions/Workflow.ts(updatePolicyDefaultApprover):- When
approvalWorkflow.isDefaultistrueandnewDefaultApprover !== previousDefaultApprover, updatesubmitsTo: newDefaultApproverinpolicy.employeeListfor the members inapprovalWorkflow.members(and self-submit fornewDefaultApprover, matchingupdateApprovalWorkflowlines179-194) and pass the updatedemployeesJSON payload toWRITE_COMMANDS.UPDATE_WORKSPACE_APPROVAL(instead ofemployees: '[]'), with matchingoptimisticData,successData, andfailureDatarollback onONYXKEYS.COLLECTION.POLICY.
- When
-
In
src/libs/actions/Workflow.ts(updateApprovalWorkflowRules,createApprovalWorkflowRules,removeApprovalWorkflowRules,updateApprovalWorkflow,createApprovalWorkflow,removeApprovalWorkflow):- Extract a shared helper
buildActiveSubmittedReportsNextStepUpdates({policy: updatedPolicy, rules: updatedRules, ...})(mirroringsetWorkspaceApprovalModeinsrc/libs/actions/Policy/Policy.ts:1222-1287). - For every submitted expense report on the policy (
ReportUtils.getAllPolicyReports(policy.id).filter((report) => !!report && ReportUtils.isExpenseReport(report) && report.statusNum === CONST.REPORT.STATUS_NUM.SUBMITTED)), compute:nextStepviabuildOptimisticNextStep({report, policy: updatedPolicy, rules: updatedRules, predictedNextStatus: CONST.REPORT.STATUS_NUM.SUBMITTED, ...})managerIDviagetSubmitToAccountID(updatedPolicy, report, ownerLogin, updatedRules)
- Include the
ONYXKEYS.COLLECTION.REPORTupdates (nextStep,managerID, andpendingFields.nextStep) inoptimisticData,successData, andfailureData.
- Extract a shared helper
What alternative solutions did you explore? (Optional)
Computing nextStep dynamically at render time in MoneyRequestReportView / ReportHeader without persisting report.nextStep in Onyx was considered, but setWorkspaceApprovalMode (src/libs/actions/Policy/Policy.ts:1222-1287) already establishes the pattern of updating report.nextStep in Onyx optimistic/success/failure data so offline state and LHN/report headers stay consistent.
Contributor details Your Expensify account email: [email protected] Upwork Profile Link: https://www.upwork.com/freelancers/~01ca8ad8ce36b9eceb
Proposal
Please re-state the problem that we are trying to solve in this issue.
After turning workspace approvals off and then turning them back on and setting User A as the approver, opening an already-submitted expense report continues to show the workspace owner as the approver in the Next Step section instead of User A.
What is the root cause of that problem?
This issue involves two compounding gaps in src/libs/actions/Policy/Policy.ts and src/libs/actions/Workflow.ts:
-
updatePolicyDefaultApproveromitsemployeeListupdates when the default workflow is reconfigured: When approvals are turned off,setWorkspaceApprovalMode(src/libs/actions/Policy/Policy.ts) sets all members'employeeList[email].submitsTotopolicy.ownerand updatesreport.nextStepon submitted reports to the owner. When the owner re-enables approvals and assigns User A as the default approver,updateApprovalWorkflowRulescallsupdatePolicyDefaultApprover(src/libs/actions/Workflow.ts). However,updatePolicyDefaultApproveronly updates{approver: newDefaultApprover}on the policy and sends an empty arrayemployees: '[]'toWRITE_COMMANDS.UPDATE_WORKSPACE_APPROVAL. It does not updateemployeeList[email].submitsTo = newDefaultApprover. Consequently, members'submitsToremains set topolicy.owner. -
Workflow actions in
Workflow.tsdo not recomputereport.nextStepon existing submitted reports: UnlikesetWorkspaceApprovalModeinPolicy.ts, the workflow update functions insrc/libs/actions/Workflow.ts(updateApprovalWorkflowRules,createApprovalWorkflowRules,updateApprovalWorkflow) do not recomputereport.nextStepfor existing submitted expense reports on the policy (ReportUtils.getAllPolicyReports(policy.id).filter(r => isExpenseReport(r) && r.statusNum === CONST.REPORT.STATUS_NUM.SUBMITTED)). As a result, previously submitted expense reports continue to hold the stale cachednextStepfrom the disable step pointing to the owner.
What changes do you think we should make in order to solve the problem?
-
Update
employeeListinsrc/libs/actions/Workflow.ts(updatePolicyDefaultApprover): When updating the default approver, updatesubmitsTo: newDefaultApproverinpolicy.employeeListfor all members in the default workflow (matching the self-submit and member assignment logic inupdateApprovalWorkflow) and send the updatedemployeeslist in theWRITE_COMMANDS.UPDATE_WORKSPACE_APPROVALpayload. -
Recompute
nextStepfor active submitted reports insrc/libs/actions/Workflow.ts: InupdateApprovalWorkflowRules,createApprovalWorkflowRules, andupdateApprovalWorkflow: Query active submitted reports on the policy:const submittedReports = ReportUtils.getAllPolicyReports(policy.id).filter( (report) => ReportUtils.isExpenseReport(report) && report?.statusNum === CONST.REPORT.STATUS_NUM.SUBMITTED, );For each report, recompute:
nextStepviabuildOptimisticNextStep(...)with the updated policy, employee list, and rules.managerIDviagetSubmitToAccountID(...). Add the updatednextStepandmanagerIDtoreportsOptimisticDataandreportsSuccessDataon${ONYXKEYS.COLLECTION.REPORT}${report.reportID}(mirroringsetWorkspaceApprovalMode).
-
Regression Tests: Add test in
tests/actions/IOUTest/ReportWorkflowTest.tsverifying that disabling approvals, re-enabling approvals, and assigning a new default approver immediately updatesnextStepon existing submitted expense reports to the new approver.
What alternative solutions did you explore? (Optional)
Evaluating nextStep dynamically solely inside MoneyRequestReportView without persisting to Onyx was considered, but persisting report.nextStep in Onyx is required by Expensify architectural standards so that offline mode and Push Notifications remain consistent.
:warning: Unable to store contributor details
Details
Auth SetContributorDetails returned an error 401 Contributor details already exist
Proposal
Please re-state the problem that we are trying to solve in this issue.
After workspace approvals are switched off and back on, and the default workflow (Everyone) is edited to set User A as the approver, an already-submitted expense report still shows the workspace owner as the approver in its Next Step section ("Waiting for you to approve expenses") instead of User A.
What is the root cause of that problem?
Two compounding gaps, both verified against main:
-
Disabling approvals pins every member to the owner, and re-enabling never unpins them.
setWorkspaceApprovalModeinsrc/libs/actions/Policy/Policy.ts:1196-1197setssubmitsTo = policy.ownerfor every employee when approvals are turned off, and recomputesreport.nextStepfor submitted reports to point at the owner. When the default workflow is later edited, the save goes through the rules path (shouldUseApprovalWorkflowRulesreturnstrueforBASICmode,src/libs/WorkflowUtils.ts), soupdateApprovalWorkflowRulescallsupdatePolicyDefaultApprover(src/libs/actions/Workflow.ts:387-413). That function only merges{approver: newDefaultApprover}intoONYXKEYS.COLLECTION.POLICYand callsUPDATE_WORKSPACE_APPROVALwithemployees: '[]'. Nothing ever writessubmitsTo: newDefaultApproverback intopolicy.employeeList, so every member keeps submitting to the owner and the backend has no employee change to apply. -
No workflow-save action recomputes
nextStepfor existing submitted reports.src/libs/actions/Workflow.tscontains no reference tonextSteporbuildOptimisticNextStepat all, unlikesetWorkspaceApprovalMode(Policy.ts:1222-1287), which recomputes it. So even after the approver is corrected in policy, already-submitted reports keep the stalenextStep(andmanagerID) pointing at the owner until something else touches them.
What changes do you think we should make in order to solve the problem?
A minimal fix in src/libs/actions/Workflow.ts, without refactoring all six workflow actions:
- In
updatePolicyDefaultApprover, whenapprovalWorkflow.isDefaultand the approver changed, build theemployeespayload from the default workflow's members withsubmitsTo: newDefaultApprover(self-submit for the new approver, mirroringupdateApprovalWorkflow), pass it toUPDATE_WORKSPACE_APPROVALinstead ofemployees: '[]', and add matching optimistic/failure data forPOLICY.employeeListso the change is visible offline and rolls back on failure. - In
updateApprovalWorkflowRules(andcreateApprovalWorkflowRulesfor the default workflow), after the rules write, recomputenextStepviabuildOptimisticNextStepandmanagerIDviagetSubmitToAccountIDfor the policy's submitted expense reports whosemanagerIDstill points at the previous default approver, and include thoseONYXKEYS.COLLECTION.REPORTupdates in optimistic/success/failure data. Scoping to reports owned by the previous approver keeps the change small and avoids touching unrelated reports.
What alternative solutions did you explore? (Optional)
A shared helper extracting the setWorkspaceApprovalMode recompute loop across all six workflow actions in Workflow.ts was considered, but it is a larger refactor for this bug; the scoped fix above covers the reported flow (off, on, edit default workflow) and the default-workflow create path. Computing nextStep dynamically at render time was also considered, but setWorkspaceApprovalMode already establishes the pattern of persisting nextStep in Onyx so offline state and headers stay consistent.
Tests
- Unit test for
updatePolicyDefaultApprover: a default-workflow approver change sends a non-emptyemployeespayload withsubmitsToset to the new approver, andemployeeListoptimistic data reflects it. - Workflow test for the reported flow: approvals off, approvals on, edit default workflow to User A, with a submitted expense report present; assert the report's
nextStepnames User A andmanagerIDequals User A's account ID. - Manual: reproduce the issue steps on staging and confirm the submitted report shows "Waiting for User A to approve expenses"; confirm a report submitted after the fix shows the same without any toggle cycle.
Contributor details
Your Expensify account email: [email protected]
Upwork Profile Link: https://www.upwork.com/freelancers/~01c5c6bc0e7d162f7b
✅ Contributor details stored successfully. Thank you for contributing to Expensify!
@MelvinBot Investigate whether this issue is coming from the PR mentioned in the issue's description, if not find the root cause and write-up a formal proposal.
Proposal
PR attribution: I found a pre-existing client-side defect that explains a stale approver banner. The evidence does not establish that Remove getPersonalDetailByEmail usage in getAccountIDsByLogins #5 introduced this issue. However, conclusively ruling it out still requires a before/after reproduction because it changes the personal-details lookup source.
What is the root cause of that problem?
The displayed approver can remain stale after workflow settings change. Approval toggling refreshes existing reports’ stored nextStep, but subsequently saving another approver updates policy/rules without refreshing those reports. The ordinary banner continues displaying the cached actor.
I reproduced this client inconsistency with a controlled test: after saving A, the policy and report assignment both identified A, while the displayed next step still identified the owner.
Confidence: medium for explaining this incident; confirmed for the controlled client case. The affected production report’s actual assignment remains unknown.
Evidence, PR comparison, and verification
- Before the linked PR, re-enabling approvals already selected the owner: WorkflowsApprovalsTab.tsx:329–342. The submitted-report refresh also already existed: Policy.ts:1214–1284.
- Workflow-save code was unchanged by that merge. It saves rules/default approver without refreshing existing reports: Workflow.ts:387–462.
- The ordinary banner returns cached
report.nextStep: NextStepUtils.ts:594–609. - Actual approval eligibility checks
managerID, independently of the banner: ReportUtils.ts:3476–3483. - Three selected existing tests and two temporary, uncommitted diagnostic tests passed. The diagnostic tests demonstrated the stale banner and a separate policy-snapshot inconsistency. They did not reproduce the complete server-backed toggle sequence.
- The earlier web attempt was blocked by the second-member precondition. No successful browser reproduction or production assignment capture is available.
What changes do you think we should make in order to solve the problem?
For the confirmed display inconsistency, keep the ordinary pending-approval banner consistent with the report’s current assignment:
- In the next-step selection path, correct a mismatched cached approver using a valid
report.managerID, narrowly scoped to ordinary submitted expense reports awaiting approval. Preserve existing special-case banners and workflow overrides. - Add regression tests covering manager=A/banner=owner, manager=owner, subsequent assignment updates, different viewers, takeover/forwarding, and invalid manager data.
This avoids changing approval authority merely to repair its presentation.
Validation gate: Capture the affected report’s managerID and nextStep.actorAccountID after the final save and server response. If both identify the owner, this display correction is not the complete solution; the assignment behavior requires separate investigation before implementation.
What alternative solutions did you explore? (Optional)
- Rewrite every submitted report’s
managerID: unsafe without confirming server semantics; it can overwrite intentional reassignment. - Populate
employeesinstead of sending an empty array: not established as necessary. Rules-based routing can override legacy employee routing, so an empty employee payload does not prove broken assignment. - Recompute from the latest policy alone: can display a configured approver who is not the report’s actual assignee.
Next Steps for Contributor+ team: Confirm the affected report’s assignment before accepting an implementation scope.
To refine: @MelvinBot <your feedback>
🔴 Proposal 1 (MelvinBot): I can't accept this yet. The live repro shows a different root cause than the one in the proposal.
I reproduced this on web. After the final save (approvals off, then on, then A set as default approver again), the submitted report has:
policy.approver: Areport.managerID: ownerreport.nextStep.actorAccountID: owner
So the report really is assigned to the owner. The banner isn't just stale. That's the case your validation gate describes, and the managerID-based banner correction would still show the owner. setWorkspaceApprovalMode never writes managerID on the client, so the backend reassigns submitted reports to the owner when approvals are disabled. updatePolicyDefaultApprover then calls UpdateWorkspaceApproval, and that call doesn't move them back to the new default approver.
Your note on employees: '[]' holds up. Before the toggle, every member's employeeList[].submitsTo was already the owner, yet the report still went to A on submit. That means the rules-based routing decides the assignment, and the empty employees payload isn't what blocks it.
There are two possible outcomes. Either reports that are already submitted should follow the new default approver, which looks like a backend change, or the owner keeping them after an approvals off/on cycle is expected.
I can reproduce this on web. Here's what I did:
- In a workspace with approvals on, set member A as the default approver.
- Submit an expense to the workspace chat. The next step shows "Waiting for A to approve expenses."
- Go to Workflows > Approvals, turn approvals off, then turn them back on. The default approver resets to the owner.
- Edit the default workflow, set A as the approver again and save.
- Open the submitted report from the workspace chat. The next step now shows "Waiting for you to approve expenses."
After step 5 the report data shows policy.approver as A, but report.managerID and report.nextStep.actorAccountID both point to the owner. So the report is actually assigned to the owner, not just showing a stale banner. The client never writes managerID when approvals are toggled, which means the backend moves submitted reports to the owner on disable. Setting the default approver afterwards (UpdateWorkspaceApproval) doesn't move them back.
I see two possible outcomes:
- Reports that are already submitted should follow the new default approver. That looks like a backend change in
UpdateWorkspaceApproval(or in how re-enabling approvals handles submitted reports), with the client only updatingnextStep/managerIDoptimistically. - The owner keeping those reports after an approvals off/on cycle is expected, and only reports submitted after the change should go to A. In that case the current behavior is correct and we can close this.
@AndrewGable Could you confirm which one is expected before we move on with an implementation ?
🎀👀🎀 C+ reviewed
Triggered auto assignment to @AndrewGable, see https://stackoverflow.com/c/expensify/questions/7972 for more details.
Proposal
Please re-state the problem that we are trying to solve in this issue.
In workspace approval settings, after toggling approval mode back and forth, the right/correct approver is not displayed in the approver field.
What is the root cause of that problem?
In src/pages/workspace/workflows/WorkspaceWorkflowsApprovalsPage.tsx and src/libs/actions/Policy/Policy.ts:
When switching approval modes (e.g. from Advanced to Basic or vice versa), the local state or optimistic update clears defaultApprover from the policy draft object without restoring the saved approver email from the policy Onyx data policy.approver. The selector falls back to an empty string instead of the workspace owner or previously configured default approver.
What changes do you think we should make in order to solve the problem?
- In
src/pages/workspace/workflows/WorkspaceWorkflowsApprovalsPage.tsx:- When switching back approval mode, read the active
policy?.approver ?? policy?.owneras the initial fallback value rather than defaulting to empty.
- When switching back approval mode, read the active
- In
src/libs/actions/Policy/Policy.ts(setApprovalMode):- Preserve
defaultApproverin the optimistic data payload when reverting approval modes so the UI remains consistent before and after API response.
- Preserve
What alternative solutions did you explore? (Optional)
Forcing a full policy refetch on every toggle, which introduces unnecessary network latency and UI flickering.
@AndrewGable Still overdue 6 days?! Let's take care of this!
@AndrewGable 8 days overdue is a lot. Should this be a Weekly issue? If so, feel free to change it!
@AndrewGable @ikevin127 this issue was created 2 weeks ago. Are we close to approving a proposal? If not, what's blocking us from getting this issue assigned? Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks!
@AndrewGable 12 days overdue now... This issue's end is nigh!