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-17] [$250] When a new agent added to workflow offline, it blinks to the admin and back online #92296
Version Number: 9.3.90-2 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): N/A Issue reported by: Applause Internal Team Bug source: Pull Request QA execution Device used: MacBook Air 26.5 Chrome, iPhone 15 iOS 26.5 App Component: Workspace Settings
Action Performed:
Preconditions: user does not have an agent
Sign in to ND with an expensifail account
Create a collect workspace
Open workspace settings - Workflows
Go offline
Click "Add agent", complete the flow
Verify that the greyed out agent is set as the approver
Do not leave the workflows, go online
Observe the Approver row
Expected Result:
Agent is set as the approver and does not change briefly after enabling internet connection
Actual Result:
Agent briefly changes to the workspace owner and back on the workflow card after enabling internet connection
👋 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.
Please re-state the problem that we are trying to solve in this issue.
After adding an agent as approver while offline, restoring the connection makes the Approver row on the workflow card briefly flip to the workspace owner and then back to the agent. Introduced by #91441.
What is the root cause of that problem?
The agent is rendered as approver by only two sources:
On reconnect, the reconciliation effect resolves the agent, fires updateApprovalWorkflow, and immediately clears the overlay (reconciliation L167-L169). From that point the card relies solely on source (2).
But reconnect also refetches the policy via fetchData → openPolicyWorkflowsPage (a READ). The server response carries the pre-approval-updateemployeeList (the agent's submitsTo is the workspace owner, so the owner is still approver — UPDATE_WORKSPACE_APPROVAL hasn't been persisted yet). If that read response lands after the overlay was cleared but before the approval update settles, it overwrites the optimistic agent-approver → the card shows the workspace owner → then flips back to the agent once UPDATE_WORKSPACE_APPROVAL is reflected. That window is the blink.
The "workspace owner" value can only re-enter policy.employeeList/approver from a server payload (nothing client-side rewrites owner-as-approver after the optimistic agent write), and the blink occurs exactly when the connection is restored — which is precisely when the onReconnect refetch fires. CREATE_AGENT itself does not optimistically touch employeeList (Agent.ts successData); the agent only enters employeeList via the backend response with submitsTo = previous default approver.
Evidence chain
Offline: agent lives only in the deferred entry; rawApprovalWorkflows (from employeeList) still shows the owner; overlay (keyed by the owner's firstApproverEmail) renders the agent faded.
Reconnect: backend CREATE_AGENT response adds the agent to employeeList with submitsTo = owner (owner still approver) — overlay still active, still shows agent.
Reconciliation effect resolves the agent → updateApprovalWorkflow(...) (optimistic: agent becomes approver) thenclearDeferredAgentWorkflowSave(...) (overlay off) at L168-L169.
openPolicyWorkflowsPage READ response (Policy.ts L3646-L3685) lands with owner-as-approver, clobbering the optimistic write while the overlay is already gone → blink → resolves when UPDATE_WORKSPACE_APPROVAL settles.
What changes do you think we should make in order to solve the problem?
Keep the deferred overlay alive until the agent is durably the approver, so it bridges the reconnect-refetch window:
In useDeferredAgentWorkflowReconciliation, decouple "fire the save" from "clear the overlay." Continue firing updateApprovalWorkflow exactly once (the reconciledDeferredKeysRef guard at L72 already prevents re-firing), but only clearDeferredAgentWorkflowSave once the raw workflow's first approver email equals the resolved agent email (i.e. policy.employeeList actually reflects the agent as approver). Until then, keep overlaying so the card never falls back to the stale server approver.
Overlay the upgraded approver (real email, pendingAction: undefined) during that retention window so it renders solid rather than faded.
Alternative
Guard the onReconnect refetch: skip / defer openPolicyWorkflowsPage while a DEFERRED_AGENT_WORKFLOW_SAVES entry for that policy is still pending. Simpler, but narrower — it only addresses the refetch clobber, whereas the overlay-retention fix is robust to any server payload that lands during the window.
Next Steps for Contributor+ team: To accept:@MelvinBot implement [this](https://github.com/Expensify/App/issues/92296) to create a draft PR. To refine:@MelvinBot <your feedback> To reject: Explain why you are rejecting Melvin's proposal.
[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:
[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.
[BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.
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/9837aad03b7f748519ba74a86669d6bf61362ade46a8be96853204fa2b1fe71b
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
Proposal
Please re-state the problem that we are trying to solve in this issue.
After adding an agent as approver while offline, restoring the connection makes the Approver row on the workflow card briefly flip to the workspace owner and then back to the agent. Introduced by #91441.
What is the root cause of that problem?
The agent is rendered as approver by only two sources:
useDeferredAgentWorkflowReconciliation(whileDEFERRED_AGENT_WORKFLOW_SAVEShas an entry), andemployeeListwrite fromupdateApprovalWorkflow.On reconnect, the reconciliation effect resolves the agent, fires
updateApprovalWorkflow, and immediately clears the overlay (reconciliation L167-L169). From that point the card relies solely on source (2).But reconnect also refetches the policy via
fetchData→openPolicyWorkflowsPage(a READ). The server response carries the pre-approval-updateemployeeList(the agent'ssubmitsTois the workspace owner, so the owner is still approver —UPDATE_WORKSPACE_APPROVALhasn't been persisted yet). If that read response lands after the overlay was cleared but before the approval update settles, it overwrites the optimistic agent-approver → the card shows the workspace owner → then flips back to the agent onceUPDATE_WORKSPACE_APPROVALis reflected. That window is the blink.The "workspace owner" value can only re-enter
policy.employeeList/approverfrom a server payload (nothing client-side rewrites owner-as-approver after the optimistic agent write), and the blink occurs exactly when the connection is restored — which is precisely when theonReconnectrefetch fires. CREATE_AGENT itself does not optimistically touchemployeeList(Agent.ts successData); the agent only entersemployeeListvia the backend response withsubmitsTo = previous default approver.Evidence chain
rawApprovalWorkflows(fromemployeeList) still shows the owner; overlay (keyed by the owner'sfirstApproverEmail) renders the agent faded.employeeListwithsubmitsTo = owner(owner still approver) — overlay still active, still shows agent.updateApprovalWorkflow(...)(optimistic: agent becomes approver) thenclearDeferredAgentWorkflowSave(...)(overlay off) at L168-L169.openPolicyWorkflowsPageREAD response (Policy.ts L3646-L3685) lands with owner-as-approver, clobbering the optimistic write while the overlay is already gone → blink → resolves whenUPDATE_WORKSPACE_APPROVALsettles.What changes do you think we should make in order to solve the problem?
Keep the deferred overlay alive until the agent is durably the approver, so it bridges the reconnect-refetch window:
useDeferredAgentWorkflowReconciliation, decouple "fire the save" from "clear the overlay." Continue firingupdateApprovalWorkflowexactly once (thereconciledDeferredKeysRefguard at L72 already prevents re-firing), but onlyclearDeferredAgentWorkflowSaveonce the raw workflow's first approver email equals the resolved agent email (i.e.policy.employeeListactually reflects the agent as approver). Until then, keep overlaying so the card never falls back to the stale server approver.pendingAction: undefined) during that retention window so it renders solid rather than faded.Alternative
Guard the
onReconnectrefetch: skip / deferopenPolicyWorkflowsPagewhile aDEFERRED_AGENT_WORKFLOW_SAVESentry for that policy is still pending. Simpler, but narrower — it only addresses the refetch clobber, whereas the overlay-retention fix is robust to any server payload that lands during the window.Related issues
Next Steps for Contributor+ team:
To accept:
@MelvinBot implement [this](https://github.com/Expensify/App/issues/92296)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
It is behind a beta, so demoting
46 remaining items
NicolasBonet commentedon Jun 11, 2026
Changing priority as this has been merged
thesahindia commentedon Jun 11, 2026
Please unassign me.
NicolasBonet commentedon Jun 12, 2026
Done
melvin-bot commentedon Jun 12, 2026
Triggered auto assignment to @mallenexpensify (
Awaiting Payment)mkhutornyi commentedon Jun 15, 2026
BugZero Checklist:
[Contributor] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.
Link to comment: feat: [91244] add agent to workflow approval #91441 (comment)
[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:
[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.
[BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.
Link to issue: https://github.com/Expensify/Expensify/issues/650324
Regression Test Proposal
Preconditions:
user does not have an agent
Test:
Do we agree 👍 or 👎
Zapier Logs
Run ID: 00040eee-70a8-a43b-07bd-f3d890402fe4melvin-bot commentedon Jun 16, 2026
Payment Summary
Upwork Job
BugZero Checklist (@mallenexpensify)
mallenexpensify commentedon Jun 18, 2026
Payment Summary
Contributor+: @mkhutornyi due $250 via NewDot
^ Test case created. Thx
m-natarajan commentedon Jun 22, 2026
@mkhutornyi This is regarding the
Regression test proposalIs this feature reverted? Add agent button not displayed for new expensifail account
Recording.3060.mp4
mkhutornyi commentedon Jun 22, 2026
Looks like it from #93315
trjExpensify commentedon Jun 23, 2026
approved $250 for @mkhutornyi