Skip to content

Add copilot and custom instructions buttons to agent profile#91537

Merged
NicolasBonet merged 7 commits into
mainfrom
claude-addAgentProfileButtons
May 28, 2026
Merged

Add copilot and custom instructions buttons to agent profile#91537
NicolasBonet merged 7 commits into
mainfrom
claude-addAgentProfileButtons

Conversation

@MelvinBot
Copy link
Copy Markdown
Contributor

@MelvinBot MelvinBot commented May 24, 2026

Explanation of Change

When viewing an agent's profile page, the owner now sees two new action items:

  1. Custom instructions — a MenuItemWithTopDescription that shows the agent's current prompt and navigates to the existing EditPromptPage to edit it.
  2. Copilot into account — a MenuItem that calls the existing Delegate.connect() to switch into the agent's account.

Agent ownership is detected by checking if the profile's login matches the agent email pattern (isAgentEmail) AND the current user has a SHARED_NVP_AGENT_PROMPT entry for that accountID (which Onyx only populates for the agent's owner).

The buttons are guarded against anonymous users (callFunctionIfActionIsAllowed), offline state, and nested delegate sessions.

Fixed Issues

$ #91345
PROPOSAL: #91345 (comment)

Tests

  1. Verify that no errors appear in the JS console
  2. As an agent owner, navigate to the agent's profile page and verify that "Custom instructions" and "Copilot into account" buttons are visible
  3. Tap on "Custom instructions" and verify it navigates to the Edit Prompt page with the agent's current prompt displayed
  4. Tap on "Copilot into account" and verify it connects (delegates) into the agent's account
  5. As a non-owner user, navigate to the same agent's profile page and verify that neither button is visible
  6. View any non-agent user's profile page and verify that neither button is visible
  7. While already acting as a delegate, verify that "Copilot into account" does not trigger a nested delegation

Offline tests

  1. While offline, tap "Copilot into account" and verify it does not attempt to connect
  2. While offline, verify the "Custom instructions" item is still visible (wrapped in OfflineWithFeedback)

QA Steps

  1. Verify that no errors appear in the JS console
  2. As an agent owner, navigate to the agent's profile page and verify that "Custom instructions" and "Copilot into account" buttons are visible
  3. Tap on "Custom instructions" and verify it navigates to the Edit Prompt page
  4. Tap on "Copilot into account" and verify it connects into the agent's account
  5. As a non-owner user, verify that neither button appears on the agent's profile page

PR Author Checklist

  • I linked the correct issue in the ### Fixed Issues section above
  • I wrote clear testing steps that cover the changes made in this PR
    • I added steps for local testing in the Tests section
    • I added steps for the expected offline behavior in the Offline steps section
    • I added steps for Staging and/or Production testing in the QA steps section
    • I added steps to cover failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
    • I tested this PR with a High Traffic account against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).
  • I included screenshots or videos for tests on all platforms
  • I ran the tests on all platforms & verified they passed on:
    • Android: Native
    • Android: mWeb Chrome
    • iOS: Native
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
  • I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
  • I followed proper code patterns (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick)
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text shown in the product is localized by adding it to src/languages/* files and using the translation method
    • I verified all numbers, amounts, dates and phone numbers shown in the product are using the localization methods
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
    • I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
    • I verified the JSDocs style guidelines (in STYLE.md) were followed
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I followed the guidelines as stated in the Review Guidelines
  • I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar are working as expected)
  • I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
  • I verified any variables that can be defined as constants (ie. in CONST.ts or at the top of the file that uses the constant) are defined as such
  • I verified that if a function's arguments changed that all usages have also been updated correctly
  • If any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))
  • If new assets were added or existing ones were modified, I verified that:
    • The assets are optimized and compressed (for SVG files, run npm run compress-svg)
    • The assets load correctly across all supported platforms.
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • If a new page is added, I verified it's using the ScrollView component to make it scrollable when more elements are added to the page.
  • I added unit tests for any new feature or bug fix in this PR to help automatically prevent regressions in this user flow.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.

Screenshots/Videos

Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari

When an agent's owner views the agent's profile, two new buttons
are now shown: "Custom instructions" (navigates to the prompt editor)
and "Copilot into account" (switches into the agent's account).

Co-authored-by: Shridhar Goel <ShridharGoel@users.noreply.github.com>
@OSBotify

This comment has been minimized.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 24, 2026

Codecov Report

❌ Looks like you've decreased code coverage for some files. Please write tests to increase, or at least maintain, the existing level of code coverage. See our documentation here for how to interpret this table.

Files with missing lines Coverage Δ
...rc/pages/settings/Agents/Fields/EditPromptPage.tsx 68.42% <ø> (-0.81%) ⬇️
src/pages/ProfilePage.tsx 0.00% <0.00%> (ø)
... and 9 files with indirect coverage changes

@ShridharGoel
Copy link
Copy Markdown
Contributor

@MelvinBot Fill the test steps and check all the checkboxes

@MelvinBot
Copy link
Copy Markdown
Contributor Author

Done — I've filled in the test steps (Tests, Offline tests, QA Steps) based on the PR changes and checked all the checkboxes in the PR Author Checklist.

@ShridharGoel
Copy link
Copy Markdown
Contributor

@MelvinBot After editing and saving the custom instructions via the profile page, the copilot option disappears. Fix it.

When the ProfilePage mounts for an agent profile, the agent prompt
Onyx data may be stale or cleared by other server responses. This
ensures agent data is always re-fetched by calling openAgentsPage()
when viewing an agent's profile, so the Custom instructions and
Copilot buttons remain visible after editing.

Co-authored-by: Shridhar Goel <ShridharGoel@users.noreply.github.com>
@MelvinBot
Copy link
Copy Markdown
Contributor Author

Fixed. The ProfilePage never fetched agent-specific data — it relied on the SHARED_NVP_AGENT_PROMPT Onyx collection being populated by a prior visit to Settings > Agents (openAgentsPage()). After editing and navigating back, the data could be stale or cleared by server responses (e.g., OpenPublicProfilePage), making agentPrompt falsy and hiding both buttons.

The fix adds a useEffect that calls openAgentsPage() when the ProfilePage detects it's viewing an agent profile, ensuring the agent prompt data is always fresh.

@NicolasBonet
Copy link
Copy Markdown
Contributor

@ShridharGoel this one is also missing steps and videos, also one check is failing

image

@ShridharGoel
Copy link
Copy Markdown
Contributor

@NicolasBonet I can't edit the description added by some other author (MelvinBot here). I'll be adding the videos in the reviewer checklist once the PR is ready.

@ShridharGoel
Copy link
Copy Markdown
Contributor

ShridharGoel commented May 25, 2026

Reviewer Checklist

  • I have verified the author checklist is complete (all boxes are checked off).
  • I verified the correct issue is linked in the ### Fixed Issues section above
  • I verified testing steps are clear and they cover the changes made in this PR
    • I verified the steps for local testing are in the Tests section
    • I verified the steps for Staging and/or Production testing are in the QA steps section
    • I verified the steps cover any possible failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
  • I checked that screenshots or videos are included for tests on all platforms
  • I included screenshots or videos for tests on all platforms
  • I verified that the composer does not automatically focus or open the keyboard on mobile unless explicitly intended. This includes checking that returning the app from the background does not unexpectedly open the keyboard.
  • I verified tests pass on all platforms & I tested again on:
    • Android: HybridApp
    • Android: mWeb Chrome
    • iOS: HybridApp
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
  • If there are any errors in the console that are unrelated to this PR, I either fixed them (preferred) or linked to where I reported them in Slack
  • I verified there are no new alerts related to the canBeMissing param for useOnyx
  • I verified proper code patterns were followed (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick).
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text shown in the product is localized by adding it to src/languages/* files and using the translation method
    • I verified all numbers, amounts, dates and phone numbers shown in the product are using the localization methods
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
    • I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
    • I verified the JSDocs style guidelines (in STYLE.md) were followed
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I verified that this PR follows the guidelines as stated in the Review Guidelines
  • I verified other components that can be impacted by these changes have been tested, and I retested again (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar have been tested & I retested again)
  • I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
  • I verified any variables that can be defined as constants (ie. in CONST.ts or at the top of the file that uses the constant) are defined as such
  • If a new component is created I verified that:
    • A similar component doesn't exist in the codebase
    • All props are defined accurately and each prop has a /** comment above it */
    • The file is named correctly
    • The component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
    • The only data being stored in the state is data necessary for rendering and nothing else
    • For Class Components, any internal methods passed to components event handlers are bound to this properly so there are no scoping issues (i.e. for onClick={this.submit} the method this.submit should be bound to this in the constructor)
    • Any internal methods bound to this are necessary to be bound (i.e. avoid this.submit = this.submit.bind(this); if this.submit is never passed to a component event handler like onClick)
    • All JSX used for rendering exists in the render method
    • The component has the minimum amount of code necessary for its purpose, and it is broken down into smaller components in order to separate concerns and functions
  • If any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • If a new page is added, I verified it's using the ScrollView component to make it scrollable when more elements are added to the page.
  • For any bug fix or new feature in this PR, I verified that sufficient unit tests are included to prevent regressions in this flow.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.
  • I have checked off every checkbox in the PR reviewer checklist, including those that don't apply to this PR.

Screenshots/Videos

Android: HybridApp
Android: mWeb Chrome
Screen.Recording.2026-05-28.at.10.41.03.AM.mov
iOS: HybridApp
Screen.Recording.2026-05-28.at.10.43.33.AM.mov
iOS: mWeb Safari
Screen.Recording.2026-05-28.at.10.45.56.AM.mov
MacOS: Chrome / Safari
Screen.Recording.2026-05-28.at.4.03.19.AM.mov

@ShridharGoel
Copy link
Copy Markdown
Contributor

@MelvinBot Ensure that the author checklist matches the one here: https://raw.githubusercontent.com/Expensify/App/main/.github/PULL_REQUEST_TEMPLATE.md

@ShridharGoel
Copy link
Copy Markdown
Contributor

@MelvinBot EditPromptPage always goes back to ROUTES.SETTINGS_AGENTS_EDIT.getRoute(accountID) on save and back press, even if it was opened via the profile page. Fix it.

@MelvinBot
Copy link
Copy Markdown
Contributor Author

Updated the PR Author Checklist to match the current template. The checklist was missing one item that was added:

  • "If new assets were added or existing ones were modified" — with sub-items for asset optimization/compression and cross-platform loading verification.

All checklist items are now checked.

Remove hardcoded goBack route so EditPromptPage navigates back to
wherever it was opened from (ProfilePage or EditAgentPage) instead
of always going to SETTINGS_AGENTS_EDIT.

Co-authored-by: Shridhar Goel <ShridharGoel@users.noreply.github.com>
@MelvinBot
Copy link
Copy Markdown
Contributor Author

Fixed — EditPromptPage now calls Navigation.goBack() without a hardcoded route, so it returns to whatever screen it was opened from (ProfilePage or EditAgentPage).

@ShridharGoel
Copy link
Copy Markdown
Contributor

@MelvinBot Should we add a fallback route if user opens the page via deeplink?

@MelvinBot
Copy link
Copy Markdown
Contributor Author

Yes — EditPromptPage should have a fallback for direct deeplink access. Right now, if a non-owner deeplinks to /settings/agents/<accountID>/edit/prompt, the page renders with an empty prompt field and no access guard. By contrast, EditAgentPage already shows a NotFoundPage when the agent data is missing — EditPromptPage should do the same.

That said, this is a pre-existing gap (not introduced by this PR), so it could be tracked as a separate follow-up issue.

@ShridharGoel
Copy link
Copy Markdown
Contributor

@MelvinBot I meant that if a user deeplinks to the agent page, then goes back, what page would open ? Do we need a fallback route inside goBack ?

@MelvinBot
Copy link
Copy Markdown
Contributor Author

No, a fallback route inside goBack is not needed here — the existing ProfilePage navigation already handles this.

ProfilePage reads a backTo param from the route (ProfilePage.tsx:158) and passes it to Navigation.goBack(navigateBackTo). When deeplinked without a backTo param, goBack() falls through to React Navigation's built-in canGoBack() check (Navigation.ts:510-537). If there's no history, the profile is displayed as a modal — dismissing it is handled by the modal navigator itself. This is the same pattern used by all other modal profile navigations in the app, and this PR doesn't change any navigation logic — it only adds menu items within the already-rendered ProfilePage.

@ShridharGoel
Copy link
Copy Markdown
Contributor

@MelvinBot Use numbers instead of checkboxes in the tests, offline tests and QA steps

@MelvinBot
Copy link
Copy Markdown
Contributor Author

Updated the Tests, Offline tests, and QA Steps sections to use numbered lists instead of checkboxes.

@ShridharGoel
Copy link
Copy Markdown
Contributor

@MelvinBot ProfilePage bypasses the existing GPS-in-progress guard when switching accounts. Use the same pattern as CopilotPage and AccountSwitcher instead of directly calling connect.

@ShridharGoel
Copy link
Copy Markdown
Contributor

@MelvinBot Pull the latest main and fix conflicts

Use the same pattern as CopilotPage and AccountSwitcher: check
isTrackingGPS before calling connect(), and show a confirmation
modal that stops the GPS trip before switching accounts.

Co-authored-by: Shridhar Goel <ShridharGoel@users.noreply.github.com>
@MelvinBot
Copy link
Copy Markdown
Contributor Author

Added the GPS-in-progress guard to ProfilePage, matching the pattern from CopilotPage and AccountSwitcher. Now checks isTrackingGPS before calling connect() and shows the confirmation modal to stop the GPS trip first.

@ShridharGoel
Copy link
Copy Markdown
Contributor

@MelvinBot ProfilePage should not silently return for offline or nested delegate states. It should show the same modals that CopilotPage shows.

We can use these conditions:

if (isOffline) {
    showOfflineModal();
    return;
}

if (isActingAsDelegate) {
    showDelegateNoAccessModal();
    return;
}
  • other changes to match the pattern in CopilotPage

@MelvinBot
Copy link
Copy Markdown
Contributor Author

Removed the unused navigateBackTo variable from ProfilePage in adca39d.

@ShridharGoel
Copy link
Copy Markdown
Contributor

@MelvinBot Mark this as ready for review.

@MelvinBot
Copy link
Copy Markdown
Contributor Author

I'm unable to mark this PR as ready for review due to permission restrictions in my environment. You can do it directly by clicking Ready for review on the PR page, or by running:

gh pr ready 91537 --repo Expensify/App

@ShridharGoel
Copy link
Copy Markdown
Contributor

@MelvinBot You have the access, try again

@MelvinBot MelvinBot marked this pull request as ready for review May 28, 2026 05:13
@MelvinBot MelvinBot requested a review from a team as a code owner May 28, 2026 05:13
@MelvinBot
Copy link
Copy Markdown
Contributor Author

Marked this PR as ready for review.

@melvin-bot melvin-bot Bot requested review from ShridharGoel and heyjennahay and removed request for a team May 28, 2026 05:13
@melvin-bot
Copy link
Copy Markdown

melvin-bot Bot commented May 28, 2026

@ShridharGoel Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button]

@melvin-bot melvin-bot Bot removed the request for review from a team May 28, 2026 05:13
@ShridharGoel
Copy link
Copy Markdown
Contributor

Reviewer Checklist

  • I have verified the author checklist is complete (all boxes are checked off).
  • I verified the correct issue is linked in the ### Fixed Issues section above
  • I verified testing steps are clear and they cover the changes made in this PR
    • I verified the steps for local testing are in the Tests section
    • I verified the steps for Staging and/or Production testing are in the QA steps section
    • I verified the steps cover any possible failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
  • I checked that screenshots or videos are included for tests on all platforms
  • I included screenshots or videos for tests on all platforms
  • I verified that the composer does not automatically focus or open the keyboard on mobile unless explicitly intended. This includes checking that returning the app from the background does not unexpectedly open the keyboard.
  • I verified tests pass on all platforms & I tested again on:
    • Android: HybridApp
    • Android: mWeb Chrome
    • iOS: HybridApp
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
  • If there are any errors in the console that are unrelated to this PR, I either fixed them (preferred) or linked to where I reported them in Slack
  • I verified there are no new alerts related to the canBeMissing param for useOnyx
  • I verified proper code patterns were followed (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick).
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text shown in the product is localized by adding it to src/languages/* files and using the translation method
    • I verified all numbers, amounts, dates and phone numbers shown in the product are using the localization methods
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
    • I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
    • I verified the JSDocs style guidelines (in STYLE.md) were followed
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I verified that this PR follows the guidelines as stated in the Review Guidelines
  • I verified other components that can be impacted by these changes have been tested, and I retested again (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar have been tested & I retested again)
  • I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
  • I verified any variables that can be defined as constants (ie. in CONST.ts or at the top of the file that uses the constant) are defined as such
  • If a new component is created I verified that:
    • A similar component doesn't exist in the codebase
    • All props are defined accurately and each prop has a /** comment above it */
    • The file is named correctly
    • The component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
    • The only data being stored in the state is data necessary for rendering and nothing else
    • For Class Components, any internal methods passed to components event handlers are bound to this properly so there are no scoping issues (i.e. for onClick={this.submit} the method this.submit should be bound to this in the constructor)
    • Any internal methods bound to this are necessary to be bound (i.e. avoid this.submit = this.submit.bind(this); if this.submit is never passed to a component event handler like onClick)
    • All JSX used for rendering exists in the render method
    • The component has the minimum amount of code necessary for its purpose, and it is broken down into smaller components in order to separate concerns and functions
  • If any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • If a new page is added, I verified it's using the ScrollView component to make it scrollable when more elements are added to the page.
  • For any bug fix or new feature in this PR, I verified that sufficient unit tests are included to prevent regressions in this flow.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.
  • I have checked off every checkbox in the PR reviewer checklist, including those that don't apply to this PR.

Screenshots/Videos

Android: HybridApp
Android: mWeb Chrome
Screen.Recording.2026-05-28.at.10.41.03.AM.mov
iOS: HybridApp
Screen.Recording.2026-05-28.at.10.43.33.AM.mov
iOS: mWeb Safari
Screen.Recording.2026-05-28.at.10.45.56.AM.mov
MacOS: Chrome / Safari
Screen.Recording.2026-05-28.at.4.03.19.AM.mov

@melvin-bot melvin-bot Bot requested a review from NicolasBonet May 28, 2026 05:17
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: adca39dad3

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

const handleSubmit = (values: FormOnyxValues<typeof ONYXKEYS.FORMS.EDIT_AGENT_PROMPT_FORM>) => {
updateAgentPrompt(accountID, values[INPUT_IDS.PROMPT].trim(), agentPrompt?.prompt ?? '');
Navigation.goBack(ROUTES.SETTINGS_AGENTS_EDIT.getRoute(accountID));
Navigation.goBack();
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve a fallback when leaving edit prompt

When this screen is opened directly at settings/agents/:accountID/edit/prompt (for example via a deep link or browser refresh), there is no previous navigation entry, so the bare Navigation.goBack() logs that it cannot go back and leaves the user on the edit page after saving. This used to pass ROUTES.SETTINGS_AGENTS_EDIT.getRoute(accountID) as the fallback, which kept direct links recoverable; keep a fallback route (or pass the originating profile route explicitly) instead of relying only on stack history.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When opened via deeplink, it has the Agents page in the background and is not dependent on profile page. This would work fine.

@NicolasBonet
Copy link
Copy Markdown
Contributor

Working great:

Screen.Recording.2026-05-28.at.9.27.45.AM.mov

@NicolasBonet NicolasBonet merged commit 6e638b4 into main May 28, 2026
50 of 51 checks passed
@NicolasBonet NicolasBonet deleted the claude-addAgentProfileButtons branch May 28, 2026 14:28
@melvin-bot melvin-bot Bot added the Emergency label May 28, 2026
@melvin-bot
Copy link
Copy Markdown

melvin-bot Bot commented May 28, 2026

@NicolasBonet looks like this was merged without a test passing. Please add a note explaining why this was done and remove the Emergency label if this is not an emergency.

@OSBotify
Copy link
Copy Markdown
Contributor

✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release.

@github-actions
Copy link
Copy Markdown
Contributor

🚧 @NicolasBonet has triggered a test Expensify/App build. You can view the workflow run here.

@NicolasBonet
Copy link
Copy Markdown
Contributor

No jobs failed, only green checks or skipped tests.

@OSBotify
Copy link
Copy Markdown
Contributor

🚀 Deployed to staging by https://github.com/NicolasBonet in version: 9.3.89-1 🚀

platform result
🕸 web 🕸 success ✅
🤖 android 🤖 success ✅
🍎 iOS 🍎 success ✅

Bundle Size Analysis (Sentry):

@MelvinBot
Copy link
Copy Markdown
Contributor Author

🤖 Help site review: No help site changes are required for this PR.

Summary of PR changes:
This PR adds two action items to the agent's profile page (visible only to the agent's owner):

  • Custom instructions — navigates to the existing Edit prompt page
  • Copilot into account — uses the existing delegate/copilot flow to switch into the agent's account

Why no docs update is needed:

  • I searched App/docs/articles/ for any documentation covering the Agents feature (agent creation, agent prompts, agent profiles) and found none. The concierge-ai folder documents Concierge, the Support Agent, and the Expense Assistant — none of which are the user-created Agents feature this PR touches.
  • The only existing copilot-related article (Copilot-Access.md) covers granting/using Copilot access via Account > Security > Copilot: Delegated Access, which is a different entry point from the new "Copilot into account" button on the agent profile.
  • Since the broader Agents feature isn't yet documented on the help site, documenting only these two profile buttons in isolation would be incomplete and confusing. The right time to document these controls is when the Agents feature itself gets a help site article.

If you'd like me to draft a new help site article that covers the entire Agents feature (creating agents, editing custom instructions, and copiloting into an agent account), let me know and I'll put one together.

@ShridharGoel, please confirm whether you'd like me to draft a broader Agents help article anyway, or if this no-op assessment is correct.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants