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-10-12] [Exploratory] Profile - Invite the secondary contact appear as grey member in Workspace #99823
Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributorNot a priority
The invite flow is keyed by the email string you typed, never by account. When you invite someone's secondary contact, the client optimistically adds employeeList["secondary@x.com"], the backend resolves it to the primary account and returns employeeList["primary@x.com"], and nothing ever deletes the secondary key. The members page renders one row per employeeList key, so you get two rows for one person.
Three steps:
Optimistic entry is keyed by the typed secondary email.src/libs/actions/Policy/Member.ts:841 turns the invite draft into a list of raw login strings, and Member.ts:883-895 writes employeeList[<typed email>] with pendingAction: ADD. successData only sets pendingAction: null — it never removes the key. Both the optimistic write and the server response are Onyx.METHOD.MERGE, so the two keys coexist.
This is already a known state, just never cleaned up. The App documents it in Member.ts:388-392: "the backend always returns the primary login, so we end up with both stored in Onyx." The server returns policy.primaryLoginsInvited (secondary → primary) so the client can reconcile — but that map is only used at removal time and for a caption, never to suppress the duplicate row.
The members list renders every key with no de-dupe.WorkspaceMembersPage.tsx:334-369 iterates Object.entries(policy.employeeList). The orphan secondary key has no personal details (the optimistic ones are nulled in finallyData, PersonalDetailsUtils.ts:362-367), so it falls through to the fallback identity at WorkspaceMembersPage.tsx:347-357 — raw email as display name, default avatar. That is the "grey member".
The page already computes the exact map it needs at WorkspaceMembersPage.tsx:331 — it just doesn't filter with it.
What changes do you think we should make in order to solve the problem?
1. Stop rendering the orphan row (the visible bug). In filteredMembers (WorkspaceMembersPage.tsx:333-369), skip any email that is a key of policy.primaryLoginsInvited whose mapped primary login is also present in employeeList. The primary row already shows the "invited by secondary login" caption (:410), so no information is lost. Frontend-only, no backend change.
2. Clean the stale key out of Onyx (the underlying cause). In buildAddMembersToWorkspaceOnyxData, make successData null the optimistically-added login keys instead of just clearing pendingAction — successMembersState[email] = null at Member.ts:889, the same pattern removeMembers already uses — and let the server's returned employeeList be the source of truth. Confirm first that SaveResponseInOnyx applies successData before the response onyxData; if not, the normal (primary-login) invite would flicker or lose its row.
3. Exclude known secondary logins from the invite picker.getIneligibleInvitees builds its exclusion list purely from Object.keys(employeeList), so a secondary login of someone who is already a member is still invitable. Fold in the keys of primaryLoginsInvited.
Items 1 and 3 fix the reported symptom on their own. Item 2 is the real fix and should be verified carefully.
What alternative solutions did you explore? (Optional)
Alternatives considered and rejected
Resolve secondary → primary before sending the invite. Not possible client-side: PersonalDetails holds a single login per account (types/onyx/PersonalDetails.ts) and loginList covers only the current user's contact methods. The app has no way to know an arbitrary email is someone else's secondary login. Only the backend can map it, which is what primaryLoginsInvited exists for.
Have the backend return employeeList: {<secondary>: null}. Correct in principle, but it requires a Web-Expensify change and would leave every already-affected workspace with the stale key. The client-side filter also fixes existing bad state.
De-dupe by accountID instead of email. Doesn't work — the orphan key has no real accountID; it falls back to generateAccountID(email), a hash of the string (WorkspaceMembersPage.tsx:347), which never collides with the primary's real accountID.
Separate pre-existing bug spotted nearby: dismissAddedWithPrimaryLoginMessages sets primaryLoginsInvited: null (Policy.ts:4363). Once the banner is dismissed the pairing map is gone, so today the orphan row becomes unremovable. Change 2 makes this moot; change 1 alone does not.
What I could not verify
I confirmed the duplicate-row mechanism from code, but did not reproduce it at runtime (it needs two accounts, one with a validated secondary contact method). So I can't say from code alone whether the row is dimmed by OfflineWithFeedback opacity — which needs offline + pendingAction, or an error (OfflineWithFeedback.tsx:104-107) — or simply looks grey because of the fallback email-as-name and default avatar. Either way the row should not be there.
Related issue
#93732 (Workflows — approver invited by secondary login is rejected with 402 either a submitsTo or forwardsTo value is not a member of the policy) has the same root cause: the typed secondary login is passed straight through as submitsTo at ReportSubmitToContent.tsx:206-234. Change 3 (excluding secondary logins from pickers) would help there too, but that flow needs its own fix.
Next Steps for Contributor+ team: To accept:@MelvinBot implement [this](https://github.com/Expensify/App/issues/99823) to create a draft PR. To refine:@MelvinBot <your feedback> To reject: Explain why you are rejecting Melvin's proposal.
@MelvinBot I see that this issue is reproducible in BrowserStack tests—which means that this issue already existed before and was fixed. You can look up the issue or PR that addressed this in the past and see how they fixed it. It seems like someone might have simply overwritten their fix.
Eskalifer1 — you're right that this is a regression, with one twist: there was no earlier merged fix to overwrite. The thing that used to hide this row was accidental, and the one deliberate fix was closed unmerged.
The regression is Expensify/App#98483 (merged 2026-08-24, production in 9.4.60-2 on 2026-08-25). It removed the if (!details) { continue; } guard in filteredMembers and replaced it with a synthetic identity — WorkspaceMembersPage.tsx:347-357. That guard was the only thing keeping the orphan secondary-login row invisible. This issue was filed 2026-08-29, four days after that hit production.
Timeline
When
What
2023-08-22
#22622 (a SelectionList refactor) leaves if (!details) { continue; } in the members loop. Not a de-dupe fix — incidental, and framed as a Log.hmmm anomaly. But it hides the ghost row, because the invite clears the secondary login's optimistic personal details on success, so the join comes up empty.
2023-10-27
#23702 adds primaryLoginsInvited and the "Added by secondary login" caption for #21639. Its own PR body says the two keys are by design: "the member will be added with their secondary login optimistically, then get added by their primary (preferred) login." The caption was the accepted UX — the secondary key was never meant to render its own row.
2024-11-14
#52517 reports this exact bug ("there appears to be two entries in the workspace's employeeList"), then rendering as Hidden rather than grey.
2024-12-09
#53038 — a one-line fix, if (!accountID || isDeletedPolicyEmployee(...)) — is closed unmerged: "Just tried reproducing it locally and on staging and I'm seeing the correct expected behavior." The accidental guard had made it look already fixed.
2025-12-08
#76523 fixes the removal side (#75514) — it sweeps the orphan key away when you remove the member, but never stopped it existing or rendering.
2026-08-24
#98483 removes the guard. Production 9.4.60-2, 2026-08-25.
2026-08-29
This issue, on v9.4.64-0.
Recommended fix
Don't revert #98483 — it fixed a real bug (#97591: members with genuinely missing personal details were being dropped from the list).
Instead, keep the fallback but make it not apply to an employeeList key that policy.primaryLoginsInvited identifies as a secondary login whose primary is also present. The page already computes that map one line away, at WorkspaceMembersPage.tsx:331, purely to render the caption. This re-lands #53038's intent without re-dropping legitimately detail-less members.
There is already in-repo precedent for reconciling the secondary key this way: #96449 at WorkspaceMemberDetailsPage.tsx:99, and #98483 itself adopted primaryLoginsInvited pairing in removeMembers.
Why the row is grey, and one loose end
The orphan key has no personal details, so :347-357 gives it a hashed generateAccountID(email) and the raw email as its display name, which means no avatar and no real name. In 2024 the same orphan rendered as Hidden instead, because Number('') was 0 and personalDetails[0] was a live key at the time — same bug, different cosmetics.
Worth noting the asymmetry this created: the identical guard still exists at WorkspaceWorkflowsPayerPage.tsx:119-123, and in DynamicRoomMembersPage and AgentsPage. So the Payer list still hides this ghost while the Members page shows it. getMemberAccountIDsForWorkspace also still skips the orphan — #98483 bypassed it rather than changing it.
Not verified
I confirmed the timeline and the code path, but did not reproduce it at runtime — that needs two accounts, one with a validated secondary contact method. The version dates are from the release list (9.4.60-2 production 2026-08-25) rather than a deploy comment on the PR, since #98483 only got a staging comment.
The root cause in my earlier proposal still stands — the invite flow keys employeeList by the typed email and never deletes that key. What's new is that the duplicate only became visible again because of #98483, so the fix belongs in filteredMembers rather than in the invite action.
Next Steps for Contributor+ team: To accept:@MelvinBot implement [this](https://github.com/Expensify/App/issues/99823) to create a draft PR. To refine:@MelvinBot <your feedback> To reject: Explain why you are rejecting Melvin's proposal.
@MelvinBot I don't think we should clean up successData because it could cause a lot more regressions, and it's not worth it—since the bug we're talking about here isn't really that critical and is more of an edge case. So please send me a code diff for the solution you're recommending here: #99823 (comment)
[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: N/A
[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
Precondition:
User A has set up a secondary contact in the account
Test:
Open the New Dot app as another Admin user of a Workspace
Navigate to the Members page
Invite the secondary contact of User A to the Workspace
Verify that after the API is done, only primary contact of user A appears in the member list
Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributorNot a priority
Activity
applause-bot commentedon Aug 29, 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/366fde2994023ae8924fa6f65e6b9b664b2620dfe18f56af47a596a5f8b5070d
MelvinBot commentedon Sep 5, 2026
Proposal
What is the root cause of that problem?
The invite flow is keyed by the email string you typed, never by account. When you invite someone's secondary contact, the client optimistically adds
employeeList["secondary@x.com"], the backend resolves it to the primary account and returnsemployeeList["primary@x.com"], and nothing ever deletes the secondary key. The members page renders one row peremployeeListkey, so you get two rows for one person.Three steps:
Optimistic entry is keyed by the typed secondary email.
src/libs/actions/Policy/Member.ts:841turns the invite draft into a list of raw login strings, andMember.ts:883-895writesemployeeList[<typed email>]withpendingAction: ADD.successDataonly setspendingAction: null— it never removes the key. Both the optimistic write and the server response areOnyx.METHOD.MERGE, so the two keys coexist.This is already a known state, just never cleaned up. The App documents it in
Member.ts:388-392: "the backend always returns the primary login, so we end up with both stored in Onyx." The server returnspolicy.primaryLoginsInvited(secondary → primary) so the client can reconcile — but that map is only used at removal time and for a caption, never to suppress the duplicate row.The members list renders every key with no de-dupe.
WorkspaceMembersPage.tsx:334-369iteratesObject.entries(policy.employeeList). The orphan secondary key has no personal details (the optimistic ones are nulled infinallyData,PersonalDetailsUtils.ts:362-367), so it falls through to the fallback identity atWorkspaceMembersPage.tsx:347-357— raw email as display name, default avatar. That is the "grey member".The page already computes the exact map it needs at
WorkspaceMembersPage.tsx:331— it just doesn't filter with it.What changes do you think we should make in order to solve the problem?
1. Stop rendering the orphan row (the visible bug). In
filteredMembers(WorkspaceMembersPage.tsx:333-369), skip anyemailthat is a key ofpolicy.primaryLoginsInvitedwhose mapped primary login is also present inemployeeList. The primary row already shows the "invited by secondary login" caption (:410), so no information is lost. Frontend-only, no backend change.2. Clean the stale key out of Onyx (the underlying cause). In
buildAddMembersToWorkspaceOnyxData, makesuccessDatanull the optimistically-added login keys instead of just clearingpendingAction—successMembersState[email] = nullatMember.ts:889, the same patternremoveMembersalready uses — and let the server's returnedemployeeListbe the source of truth. Confirm first thatSaveResponseInOnyxappliessuccessDatabefore the responseonyxData; if not, the normal (primary-login) invite would flicker or lose its row.3. Exclude known secondary logins from the invite picker.
getIneligibleInviteesbuilds its exclusion list purely fromObject.keys(employeeList), so a secondary login of someone who is already a member is still invitable. Fold in the keys ofprimaryLoginsInvited.Items 1 and 3 fix the reported symptom on their own. Item 2 is the real fix and should be verified carefully.
What alternative solutions did you explore? (Optional)
Alternatives considered and rejected
PersonalDetailsholds a singleloginper account (types/onyx/PersonalDetails.ts) andloginListcovers only the current user's contact methods. The app has no way to know an arbitrary email is someone else's secondary login. Only the backend can map it, which is whatprimaryLoginsInvitedexists for.employeeList: {<secondary>: null}. Correct in principle, but it requires a Web-Expensify change and would leave every already-affected workspace with the stale key. The client-side filter also fixes existing bad state.generateAccountID(email), a hash of the string (WorkspaceMembersPage.tsx:347), which never collides with the primary's real accountID.Regression risk and what to test
tests/actions/PolicyMemberTest.ts:1086-1129currently asserts that both the primary and secondary keys live inemployeeList. It will need updating for change 2.Member.ts:396-408. Verify removal still works after the filter.WorkspaceMemberDetailsPage.tsx:98-107recovers a member whose route accountID came from the secondary login — make sure deep links still resolve.dismissAddedWithPrimaryLoginMessagessetsprimaryLoginsInvited: null(Policy.ts:4363). Once the banner is dismissed the pairing map is gone, so today the orphan row becomes unremovable. Change 2 makes this moot; change 1 alone does not.What I could not verify
I confirmed the duplicate-row mechanism from code, but did not reproduce it at runtime (it needs two accounts, one with a validated secondary contact method). So I can't say from code alone whether the row is dimmed by
OfflineWithFeedbackopacity — which needs offline +pendingAction, or an error (OfflineWithFeedback.tsx:104-107) — or simply looks grey because of the fallback email-as-name and default avatar. Either way the row should not be there.Related issue
#93732 (Workflows — approver invited by secondary login is rejected with
402 either a submitsTo or forwardsTo value is not a member of the policy) has the same root cause: the typed secondary login is passed straight through assubmitsToatReportSubmitToContent.tsx:206-234. Change 3 (excluding secondary logins from pickers) would help there too, but that flow needs its own fix.Next Steps for Contributor+ team:
To accept:
@MelvinBot implement [this](https://github.com/Expensify/App/issues/99823)to create a draft PR.To refine:
@MelvinBot <your feedback>To reject: Explain why you are rejecting Melvin's proposal.
view run · view recording
melvin-bot commentedon Sep 5, 2026
Triggered auto assignment to Contributor-plus team member for initial proposal review - @Eskalifer1 (
External)melvin-bot commentedon Sep 5, 2026
Unable to auto-create job on Upwork. The BZ team member should create it manually for this issue.
Eskalifer1 commentedon Sep 7, 2026
@MelvinBot I see that this issue is reproducible in BrowserStack tests—which means that this issue already existed before and was fixed. You can look up the issue or PR that addressed this in the past and see how they fixed it. It seems like someone might have simply overwritten their fix.
MelvinBot commentedon Sep 7, 2026
Eskalifer1— you're right that this is a regression, with one twist: there was no earlier merged fix to overwrite. The thing that used to hide this row was accidental, and the one deliberate fix was closed unmerged.The regression is Expensify/App#98483 (merged 2026-08-24, production in 9.4.60-2 on 2026-08-25). It removed the
if (!details) { continue; }guard infilteredMembersand replaced it with a synthetic identity —WorkspaceMembersPage.tsx:347-357. That guard was the only thing keeping the orphan secondary-login row invisible. This issue was filed 2026-08-29, four days after that hit production.Timeline
if (!details) { continue; }in the members loop. Not a de-dupe fix — incidental, and framed as aLog.hmmmanomaly. But it hides the ghost row, because the invite clears the secondary login's optimistic personal details on success, so the join comes up empty.primaryLoginsInvitedand the "Added by secondary login" caption for #21639. Its own PR body says the two keys are by design: "the member will be added with their secondary login optimistically, then get added by their primary (preferred) login." The caption was the accepted UX — the secondary key was never meant to render its own row.employeeList"), then rendering asHiddenrather than grey.if (!accountID || isDeletedPolicyEmployee(...))— is closed unmerged: "Just tried reproducing it locally and on staging and I'm seeing the correct expected behavior." The accidental guard had made it look already fixed.Recommended fix
Don't revert #98483 — it fixed a real bug (#97591: members with genuinely missing personal details were being dropped from the list).
Instead, keep the fallback but make it not apply to an
employeeListkey thatpolicy.primaryLoginsInvitedidentifies as a secondary login whose primary is also present. The page already computes that map one line away, atWorkspaceMembersPage.tsx:331, purely to render the caption. This re-lands #53038's intent without re-dropping legitimately detail-less members.There is already in-repo precedent for reconciling the secondary key this way: #96449 at
WorkspaceMemberDetailsPage.tsx:99, and #98483 itself adoptedprimaryLoginsInvitedpairing inremoveMembers.Why the row is grey, and one loose end
The orphan key has no personal details, so
:347-357gives it a hashedgenerateAccountID(email)and the raw email as its display name, which means no avatar and no real name. In 2024 the same orphan rendered asHiddeninstead, becauseNumber('')was0andpersonalDetails[0]was a live key at the time — same bug, different cosmetics.Worth noting the asymmetry this created: the identical guard still exists at
WorkspaceWorkflowsPayerPage.tsx:119-123, and inDynamicRoomMembersPageandAgentsPage. So the Payer list still hides this ghost while the Members page shows it.getMemberAccountIDsForWorkspacealso still skips the orphan — #98483 bypassed it rather than changing it.Not verified
I confirmed the timeline and the code path, but did not reproduce it at runtime — that needs two accounts, one with a validated secondary contact method. The version dates are from the release list (9.4.60-2 production 2026-08-25) rather than a deploy comment on the PR, since #98483 only got a staging comment.
The root cause in my earlier proposal still stands — the invite flow keys
employeeListby the typed email and never deletes that key. What's new is that the duplicate only became visible again because of #98483, so the fix belongs infilteredMembersrather than in the invite action.Next Steps for Contributor+ team:
To accept:
@MelvinBot implement [this](https://github.com/Expensify/App/issues/99823)to create a draft PR.To refine:
@MelvinBot <your feedback>To reject: Explain why you are rejecting Melvin's proposal.
view run · no recording available
Eskalifer1 commentedon Sep 7, 2026
@MelvinBot I don't think we should clean up
successDatabecause it could cause a lot more regressions, and it's not worth it—since the bug we're talking about here isn't really that critical and is more of an edge case. So please send me a code diff for the solution you're recommending here: #99823 (comment)77 remaining items
melvin-bot commentedon Oct 11, 2026
Triggered auto assignment to @mallenexpensify (
Awaiting Payment)melvin-bot commentedon Oct 11, 2026
Payment Summary
Resolving PRs:
fix: Invite the secondary contact appear as grey member in Workspace #102386
Assignee: @Eskalifer1 requires payment (Needs manual offer from BZ)
Reviewer: @nkdengineer owed $175 via NewDot
BugZero Checklist (@mallenexpensify)
Eskalifer1 commentedon Oct 12, 2026
Contributor+ 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: https://github.com/Expensify/App/pull/98483/changes#r4245284460
[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: N/A
[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
Precondition:
Test:
Do we agree 👍 or 👎
Eskalifer1 commentedon Oct 12, 2026
Note for payment: Price for this issue should be 250$, sice it was created and worked on before introducing 175$ price update
I'm getting paid via Upwork
mallenexpensify commentedon Oct 14, 2026
Payment Summary
Contributor: @nkdengineer due $250 via NewDot
Contributor+: @Eskalifer1 paid $250 via NewDot
@Eskalifer1 can you please accept the job below? Please reply here and tag me once you have.
https://www.upwork.com/jobs/~022110480109166281599
Eskalifer1 commentedon Oct 14, 2026
Hi @mallenexpensify! I have accepted, thank you!
mallenexpensify commentedon Oct 15, 2026
@Eskalifer1 paid, summary updated above. Thx.
twisterdotcom commentedon Oct 30, 2026
$250 approved for @nkdengineer in Report ID: R00AgwJoQv11.
Zapier Logs
Run ID: 00040eee-1aeb-af35-a91a-e5f46ac68884SO: https://stackoverflowteams.com/c/expensify/questions/7582