You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Due for payment 2026-06-16] [$250] Workflows - Second approver becomes first approver after upgrading workspace #92211
Version Number: 9.3.90-0 Reproducible in staging?: Yes Reproducible in production?: N/A - new feature, doesn't exist in prod If this was caught during regression testing, add the test name, ID and link from BrowserStack:#91441 Email or phone of affected tester (no customers):applausetester+ssndjois2jd1@applause.expensifail.com Issue reported by: Applause Internal Team Bug source: Exploratory - Significant User Experience Deterioration Device used: Mac 26.5 / Chrome App Component: Workspace Settings
Action Performed:
Precondition:
Log in with Expensifail account.
Create an agent on Account > Agents.
Go to staging.new.expensify.com
Create a Collect workspace.
Go to workspace settings > Workflows.
Click Add agent.
Click Additional approver.
Click Upgrade > Got it, thanks.
Select approver > Save.
Expected Result:
The selected approver will be the second approver, while the first approver will be agent.
Actual Result:
Second approver becomes first approver after upgrading workspace.
👋 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:
Identify the pull request that introduced this issue and revert it.
Root Cause (structural — high confidence): The "Add agent" flow seeds the agent only into the transient APPROVAL_WORKFLOW Onyx editor key — it is never persisted to the policy (employeeList / approver). When the admin clicks Additional approver on a Collect workspace, the upgrade flow calls setWorkspaceApprovalMode(policy, defaultApprover, ADVANCED, …), which rewrites policy.approvalMode/approver but does not touch APPROVAL_WORKFLOW. The editor then re-derives its "default" workflow from the policy via convertPolicyEmployeesToApprovalWorkflows, anchored on policy.approver (the owner) — building approvers with calculateApprovers(firstEmail: defaultApprover). Since the seeded agent never made it into the policy, it is invisible to this derivation and drops out across the upgrade, leaving the newly-selected approver at index 0.
Why it's specific to Collect: on Control the agent is prepended to the existing chain ([agent, ...approvers]); on Collect the agent replaces the lone approver ([agent, ...approvers.slice(1)]) and that placement lives entirely in editor state that the upgrade discards. See WorkspaceWorkflowsApprovalsEditPage.tsx:213.
Recommended Fix: Make the in-progress seeded-agent approver chain survive the Collect→Control upgrade. Two viable directions:
Preserve/re-seed editor state across the upgrade — guard the edit-page seed/derive so it never clobbers a non-empty APPROVAL_WORKFLOW that already contains the seeded agent, or re-seed the agent at approver[0] once the upgrade resolves. This mirrors the existing deferred-save mechanism (queueDeferredAgentWorkflowSave / useDeferredAgentWorkflowReconciliation) that already exists to carry an in-progress agent workflow across an async boundary.
Persist the agent into the policy approver chain before navigating to Upgrade, so the post-upgrade re-derivation includes it.
⚠️Deploy-blocker mitigation: if a fix can't be verified quickly, the safest immediate action is to revert PR #91441 (the github-actions bot's option 1), since this is a brand-new feature with no production exposure.
Investigation details & one item to confirm
Verified:
Precondition created the agent, so "Add agent" uses the real-email seed path (useAddAgentToApprovalWorkflow.ts:81), not the optimistic/pending-agent path — so the deferred-save reconciliation is not involved here.
setWorkspaceApprovalMode (ADVANCED) writes approver/approvalMode and an empty employeeList merge; grep confirms noAPPROVAL_WORKFLOW write.
withPolicyAndFullscreenLoading only unmounts the page when the policy is empty, which is not the case during an upgrade — so a remount is not forced by that HOC.
To confirm (the exact overwrite trigger): static tracing shows the editor's Onyx state should survive if the edit page stays mounted, yet the bug reproduces — so the drop happens at one of these points, worth a 2-minute console.log repro to pin down before fixing:
the edit page remounts after the upgrade and re-runs the seed/derive at WorkspaceWorkflowsApprovalsEditPage.tsx:151-240 against the now-Control policy-derived workflow (which lacks the agent); or
the approver selection writes at index 0 because approverCount read 0 — i.e. APPROVAL_WORKFLOW.approvers was empty when Additional approver was clicked (setApprovalWorkflowApprover, Workflow.ts:276-327).
Either way the fix is the same: don't let the upgrade boundary discard the seeded agent's position.
Next Steps for Contributor+ team: To accept:@MelvinBot implement [this](https://github.com/Expensify/App/issues/92211) to create a draft PR. To refine:@MelvinBot <your feedback> To reject: Explain why you are rejecting Melvin's proposal.
[Contributor] The offending PR and associated issue have been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.
[Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.
Link to discussion: NA
[Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.
Regression Test Proposal
Test:
Create an agent on Account > Agents.
Create a Collect workspace.
Go to workspace settings > Workflows.
Click Add agent.
Click Additional approver.
Click Upgrade > Got it, thanks.
Select an approver > Save.
Verify the selected approver is the second approver and the agent remains the first approver (the second approver does NOT replace the first).
Activity
applause-bot commentedon Jun 1, 2026
While Applause doesn't embed attachments for this bug, here are the links for quick view:
https://platform.applause.com/services/links/v1/external/cf08ff879b6f9921d2e4c88957fc7d9b333b8994b80d9677baf7ddc643e6b2ef
melvin-bot commentedon Jun 1, 2026
You have been assigned to this deploy blocker because you recently merged this PR: #91441
melvin-bot commentedon Jun 1, 2026
💬 A slack conversation has been started in #expensify-open-source
github-actions commentedon Jun 1, 2026
👋 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:
MelvinBot commentedon Jun 1, 2026
Issue Analysis
Root Cause (structural — high confidence): The "Add agent" flow seeds the agent only into the transient
APPROVAL_WORKFLOWOnyx editor key — it is never persisted to the policy (employeeList/approver). When the admin clicks Additional approver on a Collect workspace, the upgrade flow callssetWorkspaceApprovalMode(policy, defaultApprover, ADVANCED, …), which rewritespolicy.approvalMode/approverbut does not touchAPPROVAL_WORKFLOW. The editor then re-derives its "default" workflow from the policy viaconvertPolicyEmployeesToApprovalWorkflows, anchored onpolicy.approver(the owner) — building approvers withcalculateApprovers(firstEmail: defaultApprover). Since the seeded agent never made it into the policy, it is invisible to this derivation and drops out across the upgrade, leaving the newly-selected approver at index 0.Why it's specific to Collect: on Control the agent is prepended to the existing chain (
[agent, ...approvers]); on Collect the agent replaces the lone approver ([agent, ...approvers.slice(1)]) and that placement lives entirely in editor state that the upgrade discards. SeeWorkspaceWorkflowsApprovalsEditPage.tsx:213.Recommended Fix: Make the in-progress seeded-agent approver chain survive the Collect→Control upgrade. Two viable directions:
APPROVAL_WORKFLOWthat already contains the seeded agent, or re-seed the agent at approver[0] once the upgrade resolves. This mirrors the existing deferred-save mechanism (queueDeferredAgentWorkflowSave/useDeferredAgentWorkflowReconciliation) that already exists to carry an in-progress agent workflow across an async boundary.Investigation details & one item to confirm
Verified:
useAddAgentToApprovalWorkflow.ts:81), not the optimistic/pending-agent path — so the deferred-save reconciliation is not involved here.addAdditionalApproverroutes to Upgrade withbackTo= approver page at indexapproverCount(ApprovalWorkflowEditor.tsx:139-151).setWorkspaceApprovalMode(ADVANCED) writesapprover/approvalModeand an emptyemployeeListmerge; grep confirms noAPPROVAL_WORKFLOWwrite.withPolicyAndFullscreenLoadingonly unmounts the page when the policy is empty, which is not the case during an upgrade — so a remount is not forced by that HOC.To confirm (the exact overwrite trigger): static tracing shows the editor's Onyx state should survive if the edit page stays mounted, yet the bug reproduces — so the drop happens at one of these points, worth a 2-minute console.log repro to pin down before fixing:
WorkspaceWorkflowsApprovalsEditPage.tsx:151-240against the now-Control policy-derived workflow (which lacks the agent); orapproverCountread 0 — i.e.APPROVAL_WORKFLOW.approverswas empty when Additional approver was clicked (setApprovalWorkflowApprover,Workflow.ts:276-327).Either way the fix is the same: don't let the upgrade boundary discard the seeded agent's position.
Next Steps for Contributor+ team:
To accept:
@MelvinBot implement [this](https://github.com/Expensify/App/issues/92211)to create a draft PR.To refine:
@MelvinBot <your feedback>To reject: Explain why you are rejecting Melvin's proposal.
NicolasBonet commentedon Jun 1, 2026
Under beta so not a blocker
53 remaining items
NicolasBonet commentedon Jun 12, 2026
ZhenjaHorbach commentedon Jun 12, 2026
@NicolasBonet
I believe I deserve to be paid 🥲
And I will complete the checklist before 06-16
melvin-bot commentedon Jun 12, 2026
Triggered auto assignment to @mallenexpensify (
Awaiting Payment)ZhenjaHorbach commentedon Jun 15, 2026
BugZero Checklist:
[Contributor] The offending PR and associated issue have been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.
Link to the comment on the PR: feat: [91244] add agent to workflow approval #91441
[Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.
Link to discussion: NA
[Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.
Regression Test Proposal
Test:
Do we agree 👍 or 👎
Zapier Logs
Run ID: 00040eee-7555-af17-1a13-2cb22d59c764ZhenjaHorbach commentedon Jun 15, 2026
@NicolasBonet
Can you please reopen this issue?
melvin-bot commentedon Jun 15, 2026
Payment Summary
Upwork Job
BugZero Checklist (@mallenexpensify)
mallenexpensify commentedon Jun 17, 2026
Payment Summary
Contributor+: @ZhenjaHorbach due $250 via NewDot
^ Test case created. Thx
garrettmknight commentedon Jun 18, 2026
$250 approved for @ZhenjaHorbach