Skip to content

Add confirmation modal after creating first agent rule#93466

Open
MelvinBot wants to merge 4 commits into
mainfrom
claude-aiRuleAgentCreatedModal
Open

Add confirmation modal after creating first agent rule#93466
MelvinBot wants to merge 4 commits into
mainfrom
claude-aiRuleAgentCreatedModal

Conversation

@MelvinBot

@MelvinBot MelvinBot commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Details

When a user creates their first agent rule on a workspace, the backend silently creates the "RuleBot" agent and adds it as a workspace admin. This PR surfaces a one-time confirmation modal explaining that side effect so the behavior is no longer silent.

The modal is shown in src/pages/workspace/rules/AgentRules/AddAgentRulePage.tsx. On submit, we determine whether this is the first rule via isEmptyObject(policy?.rules?.agentRules). If it is, after dispatching addPolicyAgentRule(...) we show a confirmation modal (using the useConfirmModal hook) with title "RuleBot has been added to your workspace" and a description explaining the agent was created and added as an admin, with a single "Got it" style confirm button. Navigation back happens only after the modal is dismissed. For subsequent rules the behavior is unchanged (navigate back immediately).

New copy was added to workspace.rules.agentRules (agentCreatedTitle and agentCreatedDescription) in en.ts and translated across all 9 other locale files. "RuleBot" is kept as a proper noun across locales.

Fixed Issues

$ #93448

PROPOSAL: #93448 (comment)

Tests

  1. Create a new workspace
  2. Go to Rules
  3. Create an Agent Rule
  4. See that the modal is shown, click the agents hyperlink and check you are redirect to the Agents page.
  5. Go back to rules at the same workspace
  6. Create a different Agent Rule
  7. Check that no modal is shown
  • Verify that no errors appear in the JS console

Offline tests

N/A

QA Steps

  • 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


Note for reviewers: npm run typecheck-tsgo reports 10 pre-existing errors in src/libs/API/types.ts (Duplicate identifier WRITE_COMMANDS). These are unrelated to this PR — that file is not part of this change. The files modified in this PR produce zero type errors, and lint/tests pass.

@OSBotify

This comment has been minimized.

@codecov

codecov Bot commented Jun 12, 2026

Copy link
Copy Markdown

Codecov Report

✅ Changes either increased or maintained existing code coverage, great job!

Files with missing lines Coverage Δ
...es/workspace/rules/AgentRules/AddAgentRulePage.tsx 0.00% <0.00%> (ø)
... and 21 files with indirect coverage changes

MelvinBot and others added 2 commits June 12, 2026 15:44
Co-authored-by: Nicolás Bonet <NicolasBonet@users.noreply.github.com>
Co-authored-by: Nicolás Bonet <NicolasBonet@users.noreply.github.com>
@NicolasBonet NicolasBonet force-pushed the claude-aiRuleAgentCreatedModal branch from b1741fe to 11ea76d Compare June 12, 2026 20:44
@NicolasBonet

Copy link
Copy Markdown
Contributor

@shawnborton Implementation:

image

…navigation

Updated the agent creation confirmation modal to include HTML rendering for the description, allowing for clickable links. This change improves user experience by providing direct navigation to the agent settings. Additionally, the title of the modal has been updated for consistency across multiple languages.
@NicolasBonet NicolasBonet marked this pull request as ready for review June 12, 2026 21:33
@NicolasBonet NicolasBonet requested a review from a team as a code owner June 12, 2026 21:33
@melvin-bot melvin-bot Bot requested review from QichenZhu and removed request for a team June 12, 2026 21:33
@melvin-bot

melvin-bot Bot commented Jun 12, 2026

Copy link
Copy Markdown

@QichenZhu 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 requested review from trjExpensify and removed request for a team June 12, 2026 21:33
@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/de.ts b/src/languages/de.ts
index 11ef133d59d..a041633ace3 100644
--- a/src/languages/de.ts
+++ b/src/languages/de.ts
@@ -7401,9 +7401,9 @@ Fügen Sie weitere Ausgabelimits hinzu, um den Cashflow Ihres Unternehmens zu sc
                 describeRuleTitle: 'Beschreiben Sie Ihre Regel',
                 describeRuleSubtitle: 'Beschreiben Sie Ihre Regel und Concierge erstellt sie',
                 disclaimer: 'KI-Agenten können Fehler machen.',
-                agentCreatedTitle: 'RuleBot wurde zu Ihrem Arbeitsbereich hinzugefügt!',
+                agentCreatedTitle: 'RuleBot wurde zu Ihrem Workspace hinzugefügt!',
                 agentCreatedDescription: (agentsRoute: string) =>
-                    `Um Ihre Agent-Regeln durchzusetzen, haben wir einen Agenten für Sie erstellt und ihn als Administrator zu Ihrem Arbeitsbereich hinzugefügt.<br><br>Bearbeiten Sie die Details Ihres Agenten unter <a href="${agentsRoute}">Konto &gt; Agenten</a>.`,
+                    `Um Ihre Agentenregeln durchzusetzen, haben wir einen Agenten für Sie erstellt und ihn als Admin zu Ihrem Workspace hinzugefügt.<br><br>Bearbeiten Sie die Details Ihres Agenten unter <a href="${agentsRoute}">Konto &gt; Agenten</a>.`,
             },
         },
         planTypePage: {
diff --git a/src/languages/es.ts b/src/languages/es.ts
index 73447e6497f..b5bc72fcd6d 100644
--- a/src/languages/es.ts
+++ b/src/languages/es.ts
@@ -1753,7 +1753,6 @@ const translations: TranslationDeepObject<typeof en> = {
                 }
             },
             [CONST.NEXT_STEP.MESSAGE_KEY.WAITING_TO_MARK_AS_DONE]: (actor, actorType, _eta, _etaType) => {
-                // eslint-disable-next-line default-case
                 switch (actorType) {
                     case CONST.NEXT_STEP.ACTOR_TYPE.CURRENT_USER:
                         return `Esperando a que <strong>tú</strong> lo marques como listo.`;
@@ -7299,7 +7298,7 @@ ${amount} para ${merchant} - ${date}`,
                 disclaimer: 'Los agentes de IA pueden cometer errores.',
                 agentCreatedTitle: '¡RuleBot se ha añadido a tu espacio de trabajo!',
                 agentCreatedDescription: (agentsRoute: string) =>
-                    `Para aplicar tus reglas de agente, hemos creado un agente para ti y lo hemos añadido como administrador de tu espacio de trabajo.<br><br>Edita los datos de tu agente en <a href="${agentsRoute}">Cuenta &gt; Agentes</a>.`,
+                    `Para aplicar tus reglas de agente, hemos creado un agente para ti y lo hemos añadido como administrador a tu espacio de trabajo.<br><br>Edita los detalles de tu agente en <a href="${agentsRoute}">Cuenta &gt; Agentes</a>.`,
             },
         },
         emptyDomain: {
diff --git a/src/languages/fr.ts b/src/languages/fr.ts
index c986383b271..bcb4ec7ea29 100644
--- a/src/languages/fr.ts
+++ b/src/languages/fr.ts
@@ -1,6 +1,7 @@
 /**
  *   _____                      __         __
  *  / ___/__ ___  ___ _______ _/ /____ ___/ /
+ * / (_ / -_) _ \/ -_) __/ _ \`/ __/ -_) _  /
  * \___/\__/_//_/\__/_/  \_,_/\__/\__/\_,_/
  *
  * This file was automatically generated. Please consider these alternatives before manually editing it:
@@ -862,7 +863,7 @@ const translations: TranslationDeepObject<typeof en> = {
         beginningOfChatHistory: (users: string) => `Cette discussion est avec ${users}.`,
         beginningOfChatHistoryPolicyExpenseChat: (workspaceName: string, submitterDisplayName: string) =>
             `C’est ici que <strong>${submitterDisplayName}</strong> soumettra des dépenses à <strong>${workspaceName}</strong>. Utilisez simplement le bouton +.`,
-        beginningOfChatHistoryPolicyExpenseChatTrack: 'C\u2019est ici que vous suivrez vos dépenses',
+        beginningOfChatHistoryPolicyExpenseChatTrack: 'C’est ici que vous suivrez vos dépenses',
         beginningOfChatHistorySelfDM: 'Ceci est votre espace personnel. Utilisez-le pour vos notes, tâches, brouillons et rappels.',
         beginningOfChatHistorySystemDM: 'Bienvenue ! Procédons à la configuration.',
         chatWithAccountManager: 'Discutez avec votre gestionnaire de compte ici',
@@ -7427,9 +7428,9 @@ Ajoutez davantage de règles de dépenses pour protéger la trésorerie de l’e
                 describeRuleTitle: 'Décrivez votre règle',
                 describeRuleSubtitle: 'Décrivez votre règle et Concierge la créera',
                 disclaimer: 'Les agents IA peuvent faire des erreurs.',
-                agentCreatedTitle: 'RuleBot a été ajouté à votre espace de travail !',
+                agentCreatedTitle: 'RuleBot a été ajouté à votre espace de travail !',
                 agentCreatedDescription: (agentsRoute: string) =>
-                    `Pour appliquer vos règles d’agent, nous avons créé un agent pour vous et l’avons ajouté comme administrateur de votre espace de travail.<br><br>Modifiez les détails de votre agent dans <a href="${agentsRoute}">Compte &gt; Agents</a>.`,
+                    `Pour appliquer vos règles d’agent, nous avons créé un agent pour vous et l’avons ajouté en tant qu’administrateur à votre espace de travail.<br><br>Modifiez les détails de votre agent dans <a href="${agentsRoute}">Compte &gt; Agents</a>.`,
             },
         },
         planTypePage: {
diff --git a/src/languages/it.ts b/src/languages/it.ts
index 68881b24ca0..2adab7eb90c 100644
--- a/src/languages/it.ts
+++ b/src/languages/it.ts
@@ -7387,7 +7387,7 @@ Aggiungi altre regole di spesa per proteggere il flusso di cassa aziendale.`,
                 disclaimer: 'Gli agenti IA possono commettere errori.',
                 agentCreatedTitle: 'RuleBot è stato aggiunto al tuo spazio di lavoro!',
                 agentCreatedDescription: (agentsRoute: string) =>
-                    `Per applicare le tue regole dell’agente, abbiamo creato un agente per te e lo abbiamo aggiunto come amministratore del tuo spazio di lavoro.<br><br>Modifica i dettagli del tuo agente in <a href="${agentsRoute}">Account &gt; Agenti</a>.`,
+                    `Per applicare le regole del tuo agente, abbiamo creato un agente per te e l'abbiamo aggiunto come amministratore al tuo spazio di lavoro.<br><br>Modifica i dettagli del tuo agente in <a href="${agentsRoute}">Account &gt; Agenti</a>.`,
             },
         },
         planTypePage: {
diff --git a/src/languages/ja.ts b/src/languages/ja.ts
index 6d9ab199b95..89313e11f10 100644
--- a/src/languages/ja.ts
+++ b/src/languages/ja.ts
@@ -7303,9 +7303,9 @@ ${reportName}
                 describeRuleTitle: 'ルールの内容を記入してください',
                 describeRuleSubtitle: 'ルールの内容を入力すると、Concierge が自動作成します',
                 disclaimer: 'AI エージェントは間違える場合があります。',
-                agentCreatedTitle: 'RuleBot がワークスペースに追加されました!',
+                agentCreatedTitle: 'RuleBot がワークスペースに追加されました。',
                 agentCreatedDescription: (agentsRoute: string) =>
-                    `エージェント ルールを適用するために、エージェントを作成し、ワークスペースの管理者として追加しました。<br><br>エージェントの詳細は <a href="${agentsRoute}">「アカウント」&gt;「エージェント」</a> で編集できます。`,
+                    `エージェントルールを適用するために、お客様のエージェントを作成し、ワークスペースの管理者として追加しました。<br><br><a href="${agentsRoute}">アカウント &gt; エージェント</a> でエージェントの詳細を編集できます。`,
             },
         },
         planTypePage: {
diff --git a/src/languages/nl.ts b/src/languages/nl.ts
index da54d8adbc1..d18720fd29e 100644
--- a/src/languages/nl.ts
+++ b/src/languages/nl.ts
@@ -7362,7 +7362,7 @@ er bestedingsregels toe om de kasstroom van het bedrijf te beschermen.`,
                 disclaimer: 'AI-agents kunnen fouten maken.',
                 agentCreatedTitle: 'RuleBot is toegevoegd aan je werkruimte!',
                 agentCreatedDescription: (agentsRoute: string) =>
-                    `Om je agentregels af te dwingen, hebben we een agent voor je gemaakt en deze als beheerder aan je werkruimte toegevoegd.<br><br>Bewerk de gegevens van je agent in <a href="${agentsRoute}">Account &gt; Agents</a>.`,
+                    `Om je agentregels te handhaven, hebben we een agent voor je aangemaakt en deze als beheerder aan je werkruimte toegevoegd.<br><br>Bewerk de gegevens van je agent in <a href="${agentsRoute}">Account &gt; Agents</a>.`,
             },
         },
         planTypePage: {
diff --git a/src/languages/pl.ts b/src/languages/pl.ts
index 24db6808d8a..5dd94b4aafc 100644
--- a/src/languages/pl.ts
+++ b/src/languages/pl.ts
@@ -7353,9 +7353,9 @@ Dodaj więcej zasad wydatków, żeby chronić płynność finansową firmy.`,
                 describeRuleTitle: 'Opisz swoją regułę',
                 describeRuleSubtitle: 'Opisz swoją regułę, a Concierge ją utworzy',
                 disclaimer: 'Agenci AI mogą popełniać błędy.',
-                agentCreatedTitle: 'RuleBot został dodany do Twojego obszaru roboczego!',
+                agentCreatedTitle: 'RuleBot został dodany do twojego workspace’a!',
                 agentCreatedDescription: (agentsRoute: string) =>
-                    `Aby egzekwować Twoje reguły agenta, utworzyliśmy dla Ciebie agenta i dodaliśmy go jako administratora do Twojego obszaru roboczego.<br><br>Edytuj dane swojego agenta w sekcji <a href="${agentsRoute}">Konto &gt; Agenci</a>.`,
+                    `Aby wymusić przestrzeganie zasad twojego agenta, utworzyliśmy dla ciebie agenta i dodaliśmy go jako administratora w twoim obszarze roboczym.<br><br>Edytuj szczegóły swojego agenta w <a href="${agentsRoute}">Konto &gt; Agenci</a>.`,
             },
         },
         planTypePage: {
diff --git a/src/languages/pt-BR.ts b/src/languages/pt-BR.ts
index 4ad6872cb84..a71e1fc9d8c 100644
--- a/src/languages/pt-BR.ts
+++ b/src/languages/pt-BR.ts
@@ -7359,9 +7359,9 @@ Adicione mais regras de gasto para proteger o fluxo de caixa da empresa.`,
                 describeRuleTitle: 'Descreva sua regra',
                 describeRuleSubtitle: 'Descreva sua regra e a Concierge vai criá-la',
                 disclaimer: 'Os agentes de IA podem cometer erros.',
-                agentCreatedTitle: 'O RuleBot foi adicionado ao seu espaço de trabalho!',
+                agentCreatedTitle: 'RuleBot foi adicionado ao seu workspace!',
                 agentCreatedDescription: (agentsRoute: string) =>
-                    `Para aplicar suas regras de agente, criamos um agente para você e o adicionamos como administrador do seu espaço de trabalho.<br><br>Edite os detalhes do seu agente em <a href="${agentsRoute}">Conta &gt; Agentes</a>.`,
+                    `Para aplicar suas regras de agente, criamos um agente para você e o adicionamos como administrador ao seu workspace.<br><br>Edite os detalhes do seu agente em <a href="${agentsRoute}">Conta &gt; Agentes</a>.`,
             },
         },
         planTypePage: {
diff --git a/src/languages/zh-hans.ts b/src/languages/zh-hans.ts
index b5b2daa3c55..2e75880df53 100644
--- a/src/languages/zh-hans.ts
+++ b/src/languages/zh-hans.ts
@@ -7171,9 +7171,9 @@ ${reportName}
                 describeRuleTitle: '描述你的规则',
                 describeRuleSubtitle: '描述你的规则,我们会由 Concierge 为你创建',
                 disclaimer: 'AI 智能体可能会犯错。',
-                agentCreatedTitle: 'RuleBot 已添加到你的工作区!',
+                agentCreatedTitle: 'RuleBot 已添加到你的工作区!',
                 agentCreatedDescription: (agentsRoute: string) =>
-                    `为了执行你的代理规则,我们为你创建了一个代理,并将其添加为你工作区的管理员。<br><br>你可以在 <a href="${agentsRoute}">“账户”&gt;“代理”</a> 中编辑代理的详细信息。`,
+                    `为便于执行你的代理规则,我们已为你创建了一个代理,并将其作为管理员添加到你的工作区。<br><br>你可以在<a href="${agentsRoute}">账户 &gt; 代理</a>中编辑你的代理详情。`,
             },
         },
         planTypePage: {

Note

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

View workflow run

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@NicolasBonet NicolasBonet requested a review from a team as a code owner June 12, 2026 21:36
@melvin-bot

melvin-bot Bot commented Jun 12, 2026

Copy link
Copy Markdown

@aimane-chnaif @NicolasBonet One of you needs to 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 June 12, 2026 21:36

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

Copy link
Copy Markdown

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: a526c145bc

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/pages/workspace/rules/AgentRules/AddAgentRulePage.tsx Outdated
@github-actions

Copy link
Copy Markdown
Contributor

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

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants