Skip to content

Merging main #92127

Merged
stephanieelliott merged 37 commits into
helpsite-custom-agentsfrom
main
May 30, 2026
Merged

Merging main #92127
stephanieelliott merged 37 commits into
helpsite-custom-agentsfrom
main

Conversation

@stephanieelliott
Copy link
Copy Markdown
Contributor

Explanation of Change

Fixed Issues

$
PROPOSAL:

Tests

  • Verify that no errors appear in the JS console

Offline tests

QA Steps

// TODO: These must be filled out, or the issue title must include "[No QA]."

  • Verify that no errors appear in the JS console

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

- Updated ROUTES to include dynamic query parameters for adding agents in workflows.
- Modified SCREENS to add a new screen for adding agents.
- Enhanced ApprovalWorkflowSection to support adding agents with a new button.
- Updated multiple language files to include translations for new actions.
- Adjusted navigation and linking configurations to accommodate new agent routes.
- Implemented optimistic UI updates for agent creation in workflows.
- Added tests for new functionalities in ApprovalWorkflowSection and AddAgentPage.
- Introduced a mechanism to capture and manage the creation of new agents within workflows.
- Added functions to set, get, and clear a pending post-create seed for newly created agents.
- Updated AddAgentPage to record known agent account IDs before API submission.
- Enhanced WorkspaceWorkflowsPage to identify and wire the new agent as an approver once the CREATE_AGENT response is received.
- Improved navigation to direct users to the Edit Approval Workflow page with the new agent pre-seeded.
- Refactored the route for adding agents to use a utility function for better parameter handling.
- Introduced a new function to replace approvers in the approval workflow, allowing for seamless updates after agent creation.
- Updated the AddAgentPage to ensure a default agent name is used for better user experience.
- Enhanced the WorkspaceWorkflowsPage to manage optimistic updates for agent approvals, ensuring the correct agent is displayed post-creation.
- Added functionality to track pending agent approver swaps to maintain workflow integrity during agent creation.
- Updated ROUTES to support an optional seed approver email for improved agent management in workflows.
- Modified the AddAgentPage to track known agent account IDs and handle new agent creation more effectively.
- Enhanced WorkspaceWorkflowsApprovalsEditPage to utilize the seed approver email, ensuring the correct agent is displayed as an approver.
- Removed the pending agent approver store to streamline the workflow and reduce complexity.
- Improved navigation logic in WorkspaceWorkflowsPage to accommodate the new agent approval flow.
- Updated the ROUTES configuration to utilize a utility function for generating URLs with optional parameters, specifically for the seed approver email in the approval workflow.
- This change enhances code readability and maintainability by centralizing URL parameter management.
- Eliminated the isCustomAgentBetaEnabled flag from the WorkspaceWorkflowsPage, simplifying the agent addition logic.
- Updated the canAddAgent condition to remove dependency on the custom agent beta, streamlining the approval workflow process.
…ponents

- Updated comments in Agent.ts to clarify the purpose of optimistic personal details during agent creation.
- Removed redundant comments in AddAgentPage and WorkspaceWorkflowsApprovalsEditPage to streamline the code and improve readability.
- Enhanced the description of the seed approver email handling in the approval workflow for better understanding.
…pprovalWorkflowSectionTest

- Replaced the static translations object with a mockTranslate function to improve flexibility and maintainability in unit tests.
- Updated the jest mock for useLocalize to utilize the new mockTranslate function for better clarity in translation handling.
- Introduced a new return route management system in the AddAgentPage and AddAgentAvatarPage to improve navigation after agent creation.
- Updated the pendingAgentAvatarStore to include functions for setting and getting the return route.
- Modified navigation logic to utilize the return route, ensuring users are directed to the correct page after saving agent details.
- Enhanced unit tests to validate the new return route functionality and ensure proper navigation behavior.
…ent addition

- Introduced a new custom hook, useAddAgentToApprovalWorkflow, to manage the addition of agents to approval workflows.
- The hook handles the logic for seeding an approval workflow with owned agents and navigates to the appropriate screens based on the current state.
- Updated WorkspaceWorkflowsPage to utilize the new hook, simplifying the agent addition process and improving code maintainability.
…rocess

- Introduced a mechanism to handle workflow saves for agents created during the approval process while their email is still pending.
- Added new ONYXKEYS and types to manage deferred agent workflow saves, allowing for a smoother user experience when saving workflows with newly created agents.
- Updated the ApprovalWorkflowSection to visually indicate pending agents and ensure proper reconciliation once the agent's email is confirmed.
- Enhanced WorkspaceWorkflowsPage to overlay deferred saves on top of existing workflows, maintaining workflow integrity during agent creation.
- Improved navigation and state management in the AddAgentPage and WorkspaceWorkflowsApprovalsEditPage to accommodate the new deferred save functionality.
…flowsPage

- Introduced a useRef hook to track reconciled deferred-save keys, preventing duplicate updates during intermediate renders.
- Updated the reconciliation logic to clear tracked keys when Onyx entries are removed, allowing for proper handling of reappearing keys.
- Enhanced the logic for upgrading workflow members to ensure new agents are correctly integrated as default approvers in the approval workflow.
- Improved overall state management and clarity in the handling of deferred agent workflow saves.
- Modified the test for agent creation to verify that the pending/error states are correctly mirrored onto the policy, ensuring accurate UI indicators.
- Added a new test case to confirm that no changes occur to the policy when no policyID is provided, enhancing test coverage for agent creation scenarios.
…iliation

- Introduced a new ONYXKEY for mapping optimistic agent account IDs to real server-assigned IDs, enhancing the reconciliation process in the approval workflow.
- Updated the CreateAgentParams to include optimisticAccountID, allowing the server to echo the mapping in responses.
- Enhanced the createAgent function to write optimistic account ID mappings, ensuring proper handling during agent creation.
- Modified WorkspaceWorkflowsPage and WorkspaceWorkflowsApprovalsEditPage to utilize the new mapping for resolving agent details, improving accuracy in email resolution and agent identification.
- Added unit tests to verify the optimistic account ID handling and ensure correct mapping behavior during agent creation and reconciliation.
…havior

- Modified the test case to accurately describe the navigation to the Edit Approval Workflow when policyID and workflowApproverEmail are set, utilizing the optimistic accountID for immediate redirection.
- Enhanced assertions to verify the correct navigation path and parameters, ensuring the test aligns with the updated agent creation workflow.
…ents

- Added a new prop `onDismissApproverError` to the ApprovalWorkflowSection to handle dismissing errors for optimistic agents.
- Introduced a new hook `useDeferredAgentWorkflowReconciliation` to manage the reconciliation of deferred agent workflows, ensuring proper integration of pending agents.
- Implemented a function `clearPendingAgentFromApprovalWorkflow` to discard failed optimistic agents from the approval workflow, improving error management.
- Updated the ApprovalWorkflow type to include transient errors for optimistic agents, enhancing the user experience during the approval process.
- Introduced a new function `openProfilePage` to facilitate navigation to the profile page, enhancing user experience in the agent management workflow.
…number and ensure correct handling of accountID in optimistic personal detail entries.
NicolasBonet and others added 7 commits May 29, 2026 12:21
…kflows

- Refactored `useAddAgentToApprovalWorkflow` to utilize detailed user information from `useCurrentUserPersonalDetails`.
- Updated the `addMembersToWorkspace` function to accept a user object for improved clarity.
- Added translations for 'Agent' and related phrases in multiple languages, enhancing the user experience in agent management.
- Improved descriptions for creating new agents across various language files.
- Introduced `resolveOptimisticAgent` utility to enhance the resolution of pending agent approvers after CREATE_AGENT.
- Refactored `useDeferredAgentWorkflowReconciliation` to utilize the new resolution logic, improving accuracy in agent email and account ID retrieval.
- Updated `WorkspaceWorkflowsApprovalsEditPage` to leverage the `resolveOptimisticAgent` function, streamlining the handling of optimistic agent scenarios.
- Changed the return type of `getOptimisticAccountID` from string to number for better type consistency.
- Updated related test assertions to reflect the new return type, ensuring that the optimistic account ID is validated as a number.
…to-workflow-approval

Co-authored-by: Nicolás Bonet <NicolasBonet@users.noreply.github.com>
…flow-approval

feat: [91244] add agent to workflow approval
@stephanieelliott stephanieelliott requested review from a team as code owners May 30, 2026 00:16
@melvin-bot melvin-bot Bot requested review from joekaufmanexpensify and removed request for a team May 30, 2026 00:16
@stephanieelliott stephanieelliott merged commit 0e46240 into helpsite-custom-agents May 30, 2026
182 of 183 checks passed
@melvin-bot melvin-bot Bot requested a review from Beamanator May 30, 2026 00:16
@melvin-bot
Copy link
Copy Markdown

melvin-bot Bot commented May 30, 2026

@Beamanator 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 30, 2026 00:16
@OSBotify
Copy link
Copy Markdown
Contributor

🦜 Polyglot Parrot! 🦜

Squawk! Looks like you added some shiny new English strings. Allow me to parrot them back to you in other tongues:

View the translation diff
diff --git a/src/languages/fr.ts b/src/languages/fr.ts
index 69a77bc5c1c..e98bd37ea9c 100644
--- a/src/languages/fr.ts
+++ b/src/languages/fr.ts
@@ -2978,7 +2978,7 @@ ${amount} pour ${merchant} - ${date}`,
         phoneOrEmail: 'Téléphone ou e-mail',
         error: {
             agentSignInBlocked:
-                'Les comptes d\u2019agent ne permettent pas de se connecter directement. Pour utiliser un agent, connectez-vous avec votre propre compte et accédez-y via Copilot.',
+                'Les comptes d’agent ne permettent pas de se connecter directement. Pour utiliser un agent, connectez-vous avec votre propre compte et accédez-y via Copilot.',
             invalidFormatEmailLogin: 'L’adresse e-mail saisie est invalide. Veuillez corriger le format et réessayer.',
         },
         cannotGetAccountDetails: 'Impossible de récupérer les détails du compte. Veuillez essayer de vous reconnecter.',

Note

You can apply these changes to your branch by copying the patch to your clipboard, then running pbpaste | git apply 😉

View workflow run

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.

5 participants