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-08] [$250] Add buttons to chat and copilot with agents #91343
Add two buttons to the agent row in Account > Agents. The first should open the DM with the agent. The second should copilot you into the agent account.
Also add two buttons to the edit agent modal to do the same two actions.
Issue OwnerCurrent Issue Owner: @mallenexpensifyUpwork Automation - Do Not Edit
The Agents page (Account > Agents) and the Edit Agent modal lack buttons to (1) open a DM with the agent and (2) copilot into the agent's account.
Solution
Add two buttons in two locations:
1. AgentsListRow.tsx — Add "Chat" and "Copilot" buttons next to the existing "Edit" button (wide layout), and as icon buttons or a row action menu (narrow layout).
2. EditAgentPage.tsx — Add two MenuItem entries (similar to the existing delete item) for "Chat with agent" and "Copilot as agent", using the same action functions above.
Implementation details
Icons: Use ChatBubble for the DM button and a suitable user icon (e.g., User or UserPlus) for the copilot button, from the existing expensify-icons chunk.
navigateToAndOpenReportWithAccountIDs signature requires several Onyx values (currentUserAccountID, introSelected, isSelfTourViewed, betas, personalDetails). These should be pulled via useOnyx hooks in the components, following the pattern in PromotedActionsBar.
Delegate.connect() signature requires email, delegatedAccess, credentials, session, and activePolicyID. These are available via Onyx keys ONYXKEYS.SESSION, ONYXKEYS.CREDENTIALS, ONYXKEYS.ACCOUNT (for delegatedAccess), and ONYXKEYS.NVP_ACTIVE_POLICY_ID. The CopilotPage implementation at lines 174-210 shows the exact pattern including pre-switch checks for GPS trips and offline state.
Narrow layout handling: On narrow layout, the entire AgentsListRow is currently a single pressable that navigates to edit. The two new buttons could be added as small icon-only buttons within the pressable row (similar to how brickRoadIndicator is already rendered inline), or the row could navigate to the edit page where the buttons are also available.
Next Steps for Contributor+ team: Reply with @MelvinBot implement this to create a draft PR, @MelvinBot <your feedback> to refine this analysis, or explain why you are rejecting Melvin's proposal.
Please re-state the problem that we are trying to solve in this issue.
Users can create and edit custom agents from Account > Agents, but the Agents UI does not expose the two primary actions for an existing agent: opening a DM with the agent and switching into the agent account as a copilot.
What is the root cause of that problem?
The Agents list row is currently edit-only. On narrow layouts, the whole AgentsListRow pressable navigates to the edit route, and on wide layouts the only explicit action button is Edit:
The required behaviors already exist elsewhere. Opening a one-to-one chat is handled by navigateToAndOpenReport, which finds or creates the DM and navigates to it:
Starting a copilot session is handled by Delegate.connect, and the Copilot page already wraps that call with the offline, GPS-trip, and chained-delegation guards:
So this is not a missing backend capability in the client; the Agents surfaces simply do not wire the existing DM and copilot actions into the row or edit modal.
What changes do you think we should make in order to solve the problem?
Add a small shared Agents helper/hook, for example useAgentQuickActions(accountID, login), that exposes openAgentChat and openAgentCopilot. openAgentChat should mirror NewChatPage by using navigateToAndOpenReport([login], personalDetails, currentUserAccountID, introSelected, isSelfTourViewed, betas). openAgentCopilot should reuse the same delegated-access switching rules as CopilotPage: show the existing offline modal while offline, show the GPS in-progress confirmation before switching during an active trip, block chained delegation with the existing "Not so fast" modal, and otherwise call connect({email: login, delegatedAccess: account?.delegatedAccess, credentials, session, activePolicyID}).
Update AgentsListRow to render explicit Chat and Copilot action buttons next to the existing Edit action. On narrow layouts, stop making the entire row the only edit target; render the agent info as its own edit pressable and keep the action buttons as separate pressables so tapping Chat/Copilot does not also navigate to the edit page. Keep all three actions disabled when the row is pending deletion.
Update EditAgentPage to render the same Chat and Copilot actions near the top of the modal, using the selected agent's personalDetails.login. Reuse existing translations where possible (common.chat, delegate.copilot) and add only missing accessibility labels/tooltips if icon-only buttons are used.
Scope boundaries:
Files touched: src/pages/settings/Agents/AgentsListRow.tsx - add Chat/Copilot buttons and avoid nested row pressables; src/pages/settings/Agents/EditAgentPage.tsx - add Chat/Copilot actions; new src/pages/settings/Agents/useAgentQuickActions.ts (or equivalent local helper) - centralize DM and copilot behavior; src/languages/en.ts and generated locale files only if new action labels/accessibility text are needed.
Platforms: web, desktop, iOS, Android, and mWeb through shared React Native settings UI.
Code paths not touched: agent create/update/delete API behavior, the report creation/opening implementation, and the delegate auth-token switching implementation.
API/backend behavior changes: none expected.
What alternative solutions did you explore? (Optional)
Duplicating the chat/copilot code independently in AgentsListRow and EditAgentPage. This would work, but it would duplicate a lot of sensitive copilot switching guard logic; a shared Agents helper keeps both surfaces consistent.
Navigating users to the existing Copilot settings page instead of switching directly. Rejected because the issue asks for a button that copilots into the agent account, and connect is already the direct action used by account switching.
Opening chat by manually searching reports or constructing a report route. Rejected because navigateToAndOpenReport already handles existing chats, optimistic new chats, stale cached DMs, and server revalidation.
⚠️@yusufdeveloper2903 Your proposal is a duplicate of an already existing proposal and has been automatically withdrawn to prevent spam. Please review the existing proposals before submitting a new one.
[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.
N/A, new feature
Link to the comment on the PR:
Link to the comment on the Issue:
[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.
[BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.
If there are posts on the PR or issue that reference a regression or deploy blocker, C+ posts on the issue and confirms regression (which will reduce pay by 50%) or provides reasoning why they shouldn’t be considered. If the C+ doesn’t update the issue, the contributor manager making the payment will assume any mention of a regression or deploy blockers reduces the issue amount.
@mallenexpensify That was a pre-existing bug, unrelated to the changes of this feature.
Same can be seen in MelvinBot's root cause summary #92158 (comment):
Important: PR #91537 only added the profile button — it did not modify the AccountSwitcher, the delegate connect/disconnect logic, or CurrentUserPersonalDetailsProvider. This is a pre-existing reactivity bug that the new entry point exposes, not a defect in the PR's own code.
Activity
NicolasBonet commentedon May 21, 2026
@MelvinBot investigate this
MelvinBot commentedon May 21, 2026
Proposal
Problem
The Agents page (
Account > Agents) and the Edit Agent modal lack buttons to (1) open a DM with the agent and (2) copilot into the agent's account.Solution
Add two buttons in two locations:
1.
AgentsListRow.tsx— Add "Chat" and "Copilot" buttons next to the existing "Edit" button (wide layout), and as icon buttons or a row action menu (narrow layout).navigateToAndOpenReportWithAccountIDswith[accountID]to open/create a DM with the agent. This is the same pattern used inPromotedActionsBar.tsxandHelpPage.tsx.Delegate.connect()with the agent'slogin(email), mirroring theswitchToDelegatorpattern inCopilotPage.tsx.2.
EditAgentPage.tsx— Add twoMenuItementries (similar to the existing delete item) for "Chat with agent" and "Copilot as agent", using the same action functions above.Implementation details
Icons: Use
ChatBubblefor the DM button and a suitable user icon (e.g.,UserorUserPlus) for the copilot button, from the existing expensify-icons chunk.navigateToAndOpenReportWithAccountIDssignature requires several Onyx values (currentUserAccountID,introSelected,isSelfTourViewed,betas,personalDetails). These should be pulled viauseOnyxhooks in the components, following the pattern inPromotedActionsBar.Delegate.connect()signature requiresemail,delegatedAccess,credentials,session, andactivePolicyID. These are available via Onyx keysONYXKEYS.SESSION,ONYXKEYS.CREDENTIALS,ONYXKEYS.ACCOUNT(fordelegatedAccess), andONYXKEYS.NVP_ACTIVE_POLICY_ID. TheCopilotPageimplementation at lines 174-210 shows the exact pattern including pre-switch checks for GPS trips and offline state.Narrow layout handling: On narrow layout, the entire
AgentsListRowis currently a single pressable that navigates to edit. The two new buttons could be added as small icon-only buttons within the pressable row (similar to howbrickRoadIndicatoris already rendered inline), or the row could navigate to the edit page where the buttons are also available.Next Steps for Contributor+ team: Reply with
@MelvinBot implement thisto create a draft PR,@MelvinBot <your feedback>to refine this analysis, or explain why you are rejecting Melvin's proposal.melvin-bot commentedon May 21, 2026
Current assignee @ShridharGoel is eligible for the External assigner, not assigning anyone new.
KJ21-ENG commentedon May 21, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
Users can create and edit custom agents from Account > Agents, but the Agents UI does not expose the two primary actions for an existing agent: opening a DM with the agent and switching into the agent account as a copilot.
What is the root cause of that problem?
The Agents list row is currently edit-only. On narrow layouts, the whole
AgentsListRowpressable navigates to the edit route, and on wide layouts the only explicit action button isEdit:App/src/pages/settings/Agents/AgentsListRow.tsx
Lines 59 to 100 in eaaffe3
The edit page has the same gap: it renders avatar/name/prompt editing plus delete, but no action controls for chat or copilot:
App/src/pages/settings/Agents/EditAgentPage.tsx
Lines 64 to 113 in eaaffe3
The required behaviors already exist elsewhere. Opening a one-to-one chat is handled by
navigateToAndOpenReport, which finds or creates the DM and navigates to it:App/src/libs/actions/Report/index.ts
Lines 2243 to 2312 in eaaffe3
Starting a copilot session is handled by
Delegate.connect, and the Copilot page already wraps that call with the offline, GPS-trip, and chained-delegation guards:App/src/libs/actions/Delegate.ts
Lines 132 to 215 in eaaffe3
App/src/pages/settings/Copilot/CopilotPage.tsx
Lines 171 to 191 in eaaffe3
So this is not a missing backend capability in the client; the Agents surfaces simply do not wire the existing DM and copilot actions into the row or edit modal.
What changes do you think we should make in order to solve the problem?
Add a small shared Agents helper/hook, for example
useAgentQuickActions(accountID, login), that exposesopenAgentChatandopenAgentCopilot.openAgentChatshould mirrorNewChatPageby usingnavigateToAndOpenReport([login], personalDetails, currentUserAccountID, introSelected, isSelfTourViewed, betas).openAgentCopilotshould reuse the same delegated-access switching rules asCopilotPage: show the existing offline modal while offline, show the GPS in-progress confirmation before switching during an active trip, block chained delegation with the existing "Not so fast" modal, and otherwise callconnect({email: login, delegatedAccess: account?.delegatedAccess, credentials, session, activePolicyID}).Update
AgentsListRowto render explicit Chat and Copilot action buttons next to the existing Edit action. On narrow layouts, stop making the entire row the only edit target; render the agent info as its own edit pressable and keep the action buttons as separate pressables so tapping Chat/Copilot does not also navigate to the edit page. Keep all three actions disabled when the row is pending deletion.Update
EditAgentPageto render the same Chat and Copilot actions near the top of the modal, using the selected agent'spersonalDetails.login. Reuse existing translations where possible (common.chat,delegate.copilot) and add only missing accessibility labels/tooltips if icon-only buttons are used.Scope boundaries:
src/pages/settings/Agents/AgentsListRow.tsx- add Chat/Copilot buttons and avoid nested row pressables;src/pages/settings/Agents/EditAgentPage.tsx- add Chat/Copilot actions; newsrc/pages/settings/Agents/useAgentQuickActions.ts(or equivalent local helper) - centralize DM and copilot behavior;src/languages/en.tsand generated locale files only if new action labels/accessibility text are needed.What alternative solutions did you explore? (Optional)
AgentsListRowandEditAgentPage. This would work, but it would duplicate a lot of sensitive copilot switching guard logic; a shared Agents helper keeps both surfaces consistent.connectis already the direct action used by account switching.navigateToAndOpenReportalready handles existing chats, optimistic new chats, stale cached DMs, and server revalidation.[-]Add buttons to chat and copilot with agents[/-][+][$250] Add buttons to chat and copilot with agents[/+]melvin-bot commentedon May 21, 2026
Job added to Upwork: https://www.upwork.com/jobs/~022057563860350797742
yusufdeveloper2903 commentedon May 21, 2026
🚫 Duplicated proposal withdrawn by 🤖 ProposalPolice.
github-actions commentedon May 21, 2026
28 remaining items
ShridharGoel commentedon Jun 5, 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.
N/A, new feature
Link to the comment on the PR:
Link to the comment on the Issue:
[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.
[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/646557
Regression Test Proposal
Precondition:
Test:
Do we agree 👍 or 👎
Zapier Logs
Run ID: 00040eee-6be6-ad7d-0421-34f8e0e9b5a4melvin-bot commentedon Jun 7, 2026
Triggered auto assignment to @mallenexpensify (
Awaiting Payment)melvin-bot commentedon Jun 7, 2026
Payment Summary
Upwork Job
BugZero Checklist (@mallenexpensify)
mallenexpensify commentedon Jun 8, 2026
@ShridharGoel from the C+ doc
^ Test case created. Thx
ShridharGoel commentedon Jun 8, 2026
@mallenexpensify That was a pre-existing bug, unrelated to the changes of this feature.
Same can be seen in MelvinBot's root cause summary #92158 (comment):
mallenexpensify commentedon Jun 8, 2026
Payment Summary
Contributor+: @ShridharGoel due $250 via NewDot
garrettmknight commentedon Jun 10, 2026
$250 approved for @ShridharGoel