Repository navigation
Description
If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!
Version Number: 9.3.83-3
Reproducible in staging?: Needs reproduction (Unable to reproduce)
Reproducible in production?: Needs reproduction
If this was caught during regression testing, add the test name, ID and link from BrowserStack:
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Expensify/Expensify Issue URL:
Issue reported by: @Tmjarnesk1
Slack conversation (hyperlinked to channel name): #Expensify Bugs
Action Performed:
- Customer opens the Capital One company card connection in New Expensify.
- Customer selects Assign new cards.
- Customer logs into Capital One using the master Capital One credentials.
- Customer attempts to assign a new employee card.
- The new card does not appear as available to assign.
Expected Result:
The new Capital One card should appear in the available card list so it can be assigned to the employee.
Actual Result:
The card does not appear in New Expensify as available to assign, even though the card is visible in Capital One and has posted activity.
Additional context:
- Card Provider: Capital One
- Card is new and has never been assigned in Expensify.
- Customer confirmed card is visible in Capital One.
- Customer confirmed the card has a posted transaction.
- Customer confirmed they are using the master Capital One credentials.
- Customer confirmed the Capital One username/credentials have not changed since the original connection was created.
- Existing Capital One connection appears to work for other cards; only this new card is missing.
- Customer does not want to rebuild/disconnect the connection because unassigning cards may remove unapproved transactions or Draft reports, and reassignment could risk duplicate imports if the Transaction Start Date is not set carefully.
Workaround:
Unknown
Platforms:
Select the officially supported platforms where the issue was reproduced:
- Android: App
- Android: mWeb Chrome
- iOS: App
- iOS: mWeb Safari
- iOS: mWeb Chrome
- Windows: Chrome
- MacOS: Chrome / Safari
Screenshots/Videos
Upwork Automation - Do Not Edit
- Upwork Job URL: https://www.upwork.com/jobs/~022060005944690707454
- Upwork Job ID: 2060005944690707454
- Last Price Increase: 2026-06-11
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
MelvinBot commentedon May 28, 2026
Proposal
What is the root cause of that problem?
The App displays available Capital One cards based entirely on the
accountListarray provided by the backend. For direct/OAuth feeds like Capital One (oauth.capitalone.com), the card assignment flow inCardSelectionStep.tsxreadsaccountListfrom Onyx (populated by theOpenPolicyCompanyCardsPage/OpenPolicyCompanyCardsFeedbackend API responses) and filters out already-assigned cards viagetFilteredCardList. No other client-side filtering is applied.If the new Capital One card is not in the backend-returned
accountList, it will never appear in the UI. TheaccountListis only refreshed when the user re-authenticates via the OAuth flow — navigating to Company Cards → Settings → "Assign new cards" triggersstartCardFeedRefresh, which opens the bank's OAuth popup. The backend then refreshes the connection and updatesaccountList.Critically, simply navigating to the card assignment screen does not trigger a fresh fetch from Capital One — it only reads the cached backend data. This means:
accountListis stale and won't include the new card.accountListafter re-authentication.This appears to be a backend/internal issue. A separate internal investigation is needed to confirm whether
accountListis being properly refreshed after OAuth re-authentication and whether Capital One's API returns the new card.What changes do you think we should make in order to solve the problem?
The fix depends on which layer is at fault:
If the customer hasn't used the refresh flow: This is working as designed — the customer should use Company Cards → Settings → "Assign new cards" to trigger a re-authentication with Capital One, which refreshes the card list.
If the refresh flow was used but the card still doesn't appear: The backend needs to be investigated. The
OpenPolicyCompanyCardsPageandOpenPolicyCompanyCardsFeedAPI responses should be checked to see if the new card is present inaccountListafter re-authentication. The fix would be on the backend to ensure newly added bank cards are included in theaccountListreturned after an OAuth refresh.Potential App-side improvement: Unlike Plaid feeds which automatically refresh the card list when starting the assign flow (via
importPlaidAccounts), OAuth feeds like Capital One have no such automatic refresh. Adding an equivalent mechanism for OAuth feeds could prevent this class of issue.Investigation details
Data flow for Capital One card assignment:
openPolicyCompanyCardsPage()andopenPolicyCompanyCardsFeed()send READ API calls to the backendaccountList(array of card names) via Onyx updatesCardSelectionSteprendersgetFilteredCardList()takesaccountList, removes already-assigned cards, returns available cardsaccountList, it cannot appear in the UIKey code references:
CONST.COMPANY_CARD.FEED_BANK_NAME.CAPITAL_ONE = 'oauth.capitalone.com'isDirectFeed()— matchesoauth.*prefixDirectCardFeedData.accountListstartCardFeedRefresh()→ opens OAuth popupRefreshCardFeedConnectionPage— watches for feed expiration changeRelated issue: #91199 — Capital One credential errors when assigning cards to a second workspace (different issue but same feed type)
Next Steps for Contributor+ team:
To accept:
@MelvinBot implement thisto create a draft PR.To refine:
@MelvinBot <your feedback>To reject: Explain why you are rejecting Melvin's proposal.
yusufdeveloper2903 commentedon May 28, 2026
Proposal
What is the root cause of that problem?
When a new Capital One card is added after the initial connection is established, the card assignment flow relies on a cached or previously fetched list of available cards. The fetch/refresh of available cards during the assignment flow does not trigger a re-sync from the Capital One connection, so newly issued cards that exist in Capital One but were never imported into Expensify are absent from the assignable card list.
What changes do you think we should make in order to solve the problem?
I'd suggest adding a "Refresh available cards" trigger when the user enters the card assignment step, so the list is re-fetched from the server rather than relying solely on cached Onyx data. The relevant action likely lives around
src/libs/actions/Card.ts(or a similar cards action file).Additionally, I'd suggest surfacing a manual "Refresh" button or an informational note on the assign card screen so users can trigger a re-sync without rebuilding the entire connection, avoiding the risk of duplicate imports or lost transactions.
What alternative solutions did you explore?
One alternative is to increase the polling frequency of the card list sync job on the backend so new cards are picked up automatically within a short window — but that doesn't help users who are actively sitting on the assignment screen and need the card to appear immediately. The UI-side refresh on mount is a simpler, lower-risk fix that preserves the existing connection state.
KJ21-ENG commentedon May 28, 2026
🚨 Edited by proposal-police: This proposal was edited at 2026-05-28 14:41:07 UTC.
Proposal
What is the root cause of that problem?
Capital One is an OAuth direct feed. The "Assign new cards" setting starts a refresh flow by seeding
ASSIGN_CARD.currentStepand openingRefreshCardFeedConnectionPage, but that page reuses the normal assign-cardBankConnectionbehavior.That existing-feed behavior is built for expired/broken assignment recovery. If the feed is not expired, it advances to the assignee step instead of forcing a Capital One refresh. If the feed does re-authenticate,
RefreshCardFeedConnectionPagecloses whenexpiration/isRefreshingchanges, but it does not reload theaccountList/WORKSPACE_CARDS_LISTdata used by the table and card picker. The picker then runsgetFilteredCardList()against stale data, so the newly issued Capital One card is missing.What changes do you think we should make in order to solve the problem?
Add explicit refresh/discovery handling for direct-feed "Assign new cards" instead of reusing the regular assign-card recovery path.
For OAuth feeds such as Capital One, the refresh path should not treat "feed is not expired" as completion. It should either force the selected bank OAuth refresh or call the existing
OpenAssignFeedCardPage/company-card feed read command intended to refresh assignable feed cards. After the refresh completes, reload the selected policy/feed card data with the existingdomainAccountID,policyID, andfeedparams before closing or rendering the picker, soaccountListandWORKSPACE_CARDS_LISTare fresh.Keep the current fast path for clicking an already visible unassigned card row, and keep the existing expired/broken connection recovery behavior for normal assignment. Plaid can continue using
ImportPlaidAccounts, but it should trigger the same post-refresh data reload before the flow closes.Add tests for:
accountListdata making a new unassigned Capital One card appear inCardSelectionStep,What alternative solutions did you explore? (Optional)
Changing
getFilteredCardList()alone would not solve this because it can only display cards already present inaccountListorcardList. Disconnecting and rebuilding the feed is also not acceptable because it can unassign cards and risks duplicate imports.melvin-bot commentedon May 28, 2026
Triggered auto assignment to Contributor-plus team member for initial proposal review - @DylanDylann (
External)[-]NewDot Capital One card assignment flow does not surface new card available to assign[/-][+][$250] NewDot Capital One card assignment flow does not surface new card available to assign[/+]melvin-bot commentedon May 28, 2026
Job added to Upwork: https://www.upwork.com/jobs/~022060005944690707454
Abdulloh0109 commentedon May 28, 2026
Proposal
What is the root cause of that problem?
I started from the exact UI element the customer describes — the assignable-card list shown in the "Assign new cards" picker for an OAuth direct feed (Capital One,
oauth.capitalone.comper CONST/index.ts#L4233). That list is built in CardSelectionStep.tsx#L56 by feedingcardFeeds?.[feed]?.accountListinto getFilteredCardList. For direct feeds (OAuth or Plaid, detected by isDirectFeed),accountListis the only source of truth — any card name missing from it cannot appear, regardless of what Capital One actually shows on the bank side.I then traced the write path that keeps
accountListcurrent.accountListonly changes when the backend pushes an Onyx update in response to a card-feed READ. Two READs touch it:OPEN_POLICY_COMPANY_CARDS_FEED(called on the company-cards page load via openPolicyCompanyCardsFeed) and the Plaid-specificimportPlaidAccounts, whichuseAssignCardfires for Plaid feeds at useAssignCard.ts#L163-L167 immediately before the picker is shown.Direct OAuth feeds like Capital One never get an equivalent refresh between OAuth re-authentication and the picker render. Clicking "Assign new cards" routes through startCardFeedRefresh → BankConnection/index.tsx#L122-L145, which only opens the bank's OAuth popup; the OAuth round-trip eventually advances
cardFeeds?.[feed]?.expiration(which is what RefreshCardFeedConnectionPage.tsx#L51-L58 waits for before closing the RHP) but nothing in the assign-card flow then asks the server to publish the newaccountListfor that specific feed. The picker re-renders against whateveraccountListhappened to be cached the last time the company-cards page was loaded — so a newly issued Capital One card whose name was not yet on that cached list is invisible.The backend has the right primitive for this gap already: API/types.ts#L1330 defines
READ_COMMANDS.OPEN_ASSIGN_FEED_CARD_PAGE(typed at API/types.ts#L1443 with the sameOpenPolicyCompanyCardsFeedParamsshape), but no caller exists anywhere undersrc/. The write-side counterpart that the OAuth picker needs is wired up but never invoked.What changes do you think we should make in order to solve the problem?
The fix is at the data layer feeding the picker, not the OAuth flow itself. Mirror the Plaid pre-render refresh for direct OAuth feeds, using the already-defined
OPEN_ASSIGN_FEED_CARD_PAGEcommand.Add an action wrapper in
src/libs/actions/CompanyCards.ts— e.g.openAssignFeedCardPage(domainAccountID, policyID, feed, translate)that callsAPI.read(READ_COMMANDS.OPEN_ASSIGN_FEED_CARD_PAGE, parameters, ...). Reuse the samecardFeedsStatus.[feed].isLoading/FEED_LOAD_ERRORoptimistic/success/failure pattern as the existing openPolicyCompanyCardsFeed, so the skeleton/error UI the picker already supports continues to work.Invoke it from
useInitialAssignCardStepnext to the Plaid branch — alongside useAssignCard.ts#L163-L167, add a sibling branch guarded byisDirectFeed(selectedFeed) && !plaidAccessToken && !isFeedExpired, fired once per mount via auseRefflag the same wayhasImportedPlaidAccountsis. This ensures every entry into the OAuth picker triggers exactly one freshaccountListpull, matching the Plaid behavior contributors already rely on.Also fire it after OAuth re-authentication in
RefreshCardFeedConnectionPage— the existing effect at RefreshCardFeedConnectionPage.tsx#L51-L58 detects OAuth completion viafeedExpirationchange and immediately closes the RHP. Before closing, dispatchopenAssignFeedCardPageso the very next time the user opens the picker,accountListreflects what Capital One returned to the backend a moment ago rather than what was cached before the OAuth round-trip.Gate the picker empty state on the new loading flag — in CardSelectionStep.tsx#L56, read
cardFeeds?.[feed]?.status?.isLoading(or the existingcardFeedsStatus[feed].isLoadingflag set by the optimistic data above) and render the existing loading skeleton whilefilteredCardListis empty AND the refresh request is in flight, so the customer doesn't see a "no cards" state momentarily flash before the new card lands.No change to the OAuth bank-connection flow itself, no change to the Plaid branch, and no schema change — the backend command type and Onyx loading-status fields already exist.
What alternative solutions did you explore? (Optional)
The "useEffect on
CardSelectionStepmount that calls a genericrefreshCompanyCards(policyID)" approach — this refreshes every feed on the workspace each time the picker mounts, even feeds the user isn't touching, and goes through the sameOPEN_POLICY_COMPANY_CARDS_PAGEpath that already fired when the workspace page was opened. It doesn't reuse the backend's per-feedOPEN_ASSIGN_FEED_CARD_PAGEprimitive that was clearly added for this exact surface, and there's no precise loading state to gate the empty-list UI against, so the picker can still flash "no cards" before the bulk refresh lands. The narrower per-feed action is both cheaper and aligned with the existing Plaid pattern at useAssignCard.ts#L163-L167.The "always force OAuth re-authentication when no
cardIDis given" approach — would makeuseAssignCardsend the user back through the bank-login popup every time they enter "Assign new cards", regardless offeedExpiration. The existing fast-path in BankConnection/index.tsx#L122-L145 deliberately skips OAuth when!isFeedExpired, because re-entering master credentials per assignment is a real UX regression (and in many orgs the assigner doesn't hold those credentials). It also doesn't address the actual gap:accountListis never re-fetched on the client between OAuth completion and the next picker render — even if the OAuth round-trip is forced, the symptom recurs as soon as a different admin opens the picker later without re-authenticating.github-actions commentedon May 28, 2026
David-2002065 commentedon May 28, 2026
Proposal
What is the root cause of that problem?
The customer in this bug did use the "Assign new cards" → OAuth re-authentication flow (per the repro, steps 2–3), yet the new card still doesn't surface. So the proposals that focus on adding an upfront refresh before the picker don't address what actually happened here — the refresh did happen, the data just never re-arrived.
Looking at the post-OAuth handoff in
RefreshCardFeedConnectionPage.tsx#L54-L60:The App treats "expiration changed" as a synonym for "accountList is now fresh and complete" — it closes the RHP the moment the new expiration date lands and never explicitly re-reads the feed. But the two Onyx fields are updated by separate backend code paths: the OAuth callback bumps the expiration immediately when re-auth succeeds, while
accountListis repopulated by a downstream account-discovery job that fans out to Capital One's API. If that job hasn't completed (or hasn't yet propagated back to the user's Onyx) by the timefeedExpirationupdates, the RHP closes andCardSelectionStepreads a staleaccountListthat's missing the newly-issued card.Compare to the Plaid path on
#L46-L52whereisRefreshingis cleared by theimportPlaidAccountssuccessDataitself — so closing the flow is gated on the data arriving, not on a sibling field. The OAuth branch has no equivalent data-arrival signal; it gates only onexpiration, which is the wrong sentinel.The "no auto-refresh on assign entry" path that KJ21-ENG and MelvinBot focus on is a real gap too, but it's a different gap: it covers users who never re-authed. This customer did re-auth, and we still let them out of the refresh page before
accountListwas actually fresh.What changes do you think we should make in order to solve the problem?
Don't trust
expirationas a proxy for "accountList is fresh." After the OAuth callback flips the expiration, explicitly re-read the feed and wait for that read to finish before closing the RHP:// OAuth feeds: expiration updates after bank re-authentication completes useEffect(() => { if (prevFeedExpiration === undefined || prevFeedExpiration === feedExpiration || !isRefreshing) { return; } - Navigation.closeRHPFlow(); + // expiration just changed → OAuth re-auth completed, but accountList may not yet reflect + // newly-discovered cards. Force a re-read of the feed and gate the close on that response + // so the picker never opens against stale data. + const domainAccountID = cardFeeds?.[feed]?.domainAccountID ?? CONST.DEFAULT_NUMBER_ID; + openPolicyCompanyCardsFeed(domainAccountID, policyID, feed, translate)?.then(() => { + Navigation.closeRHPFlow(); + }); }, [prevFeedExpiration, feedExpiration, isRefreshing]);(
openPolicyCompanyCardsFeedalready lives inCompanyCards.ts#L959— it needs to return itsAPI.readpromise so the caller can await it. That's a one-linereturnaddition.)Secondary improvement: surface a manual "Refresh card list" affordance in
CardSelectionStepwhenfilteredCardList.length === 0(or always, as a small icon button next to the search input), wired to the sameopenPolicyCompanyCardsFeedaction. That gives the customer a self-serve recovery path without requiring them to disconnect/rebuild the feed (which they explicitly want to avoid per the bug's "Additional context").Tests to add in
tests/unit/CompanyCardsTest.ts: simulate an OAuth refresh wherefeedExpirationupdates beforeaccountListdoes (stale → fresh on a second Onyx tick); assert the RHP doesn't close until the explicit feed re-read resolves, and that the picker renders the new card name.What alternative solutions did you explore? (Optional)
Navigation.closeRHPFlow()to giveaccountListtime to land. Rejected — race-condition band-aids don't scale, and on slow backends the delay either isn't long enough (bug persists) or hurts UX for everyone.READ_COMMANDS.OPEN_ASSIGN_FEED_CARD_PAGEbefore the picker (KJ21-ENG's angle). Good defensive measure for users who haven't re-authed, but doesn't help this specific bug — the customer did re-auth and the picker already opened against the stale feed; they'd hit the same problem on the second attempt unless the feed read this time happens to land in the right order. The post-OAuth fix above closes that ordering hole at its source.accountListtruly never includes the new card, no amount of client refresh fixes it. But the App still has a correctness bug today (closing the refresh flow on the wrong signal), and a frontend fix is reproducible/testable without backend access.7 remaining items
melvin-bot commentedon Jun 2, 2026
@DylanDylann Eep! 4 days overdue now. Issues have feelings too...
melvin-bot commentedon Jun 4, 2026
📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸
melvin-bot commentedon Jun 4, 2026
@DylanDylann Still overdue 6 days?! Let's take care of this!
DylanDylann commentedon Jun 5, 2026
Discussing on Slack thread: https://expensify.slack.com/archives/C049HHMV9SM/p1779923364378919
melvin-bot commentedon Jun 8, 2026
@DylanDylann Whoops! This issue is 2 days overdue. Let's get this updated quick!
melvin-bot commentedon Jun 10, 2026
@DylanDylann Eep! 4 days overdue now. Issues have feelings too...
melvin-bot commentedon Jun 11, 2026
📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸
melvin-bot commentedon Jun 11, 2026
@DylanDylann 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!
DylanDylann commentedon Jun 12, 2026
@joekaufmanexpensify Based on your last message in the Slack thread, should we close this issue or is there anything else we need to do here?
joekaufmanexpensify commentedon Jun 12, 2026
Yeah, we can close it. The issue is resolved for the customer, seems like may have been an issue on the bank side 👍