Skip to content

[Due for payment 2026-06-23] [$250] Add confirmation modal after creating your first AI rule (when an agent is created) #93448

Closed

Description

@MelvinBot

Problem

When a user creates their first AI rule, RuleBot silently creates an agent and adds it as an admin to their workspace. There's no clear explanation of what just happened, which is confusing.

Solution

Show a confirmation modal after a user creates their first AI rule (i.e., when an agent is created on their behalf) with the following content:

RuleBot has been added to your workspace

To enforce your agent rules, we've created an agent for you and added it as an admin to your workspace.

Edit your agent's details in Account > Agents

( Got it )

Context

This came out of feedback that the experience of creating a first AI rule doesn't explain that an agent is being created and added as a workspace admin. A modal makes this transparent.

Slack thread: https://expensify.slack.com/archives/C090U774ZH7/p1781267199740459

Issue OwnerCurrent Issue Owner: @mallenexpensify
Upwork Automation - Do Not Edit

Activity

  1. puneetlath commented on Jun 12, 2026

    @puneetlath
    Contributor

    Mockup from @shawnborton

    Image
  2. puneetlath commented on Jun 12, 2026

    @puneetlath
    Contributor

    @MelvinBot investigate this.

  3. MelvinBot commented on Jun 12, 2026

    @MelvinBot
    ContributorAuthor

    Proposal

    Please re-state the problem that we are trying to solve in this issue.

    When a user adds their first AI rule, the backend silently creates a "RuleBot" agent and adds it as an admin to the workspace. Nothing in the UI explains this, so the side effect is confusing. We want a one-time confirmation modal explaining what happened.

    What is the root cause of that problem?

    This is a missing-UX gap, not a bug. The agent is created server-side as a side effect of the ADD_POLICY_AI_RULE command — the frontend saveRule handler just fires the action and immediately navigates back, with no acknowledgement that an agent was created:

    Code references

    What changes do you think we should make in order to solve the problem?

    This is frontend-only in Expensify/App — no backend change needed, since the agent is already created server-side and we only need to surface a message.

    1. In AddAIRulePage.tsx, detect whether this is the first rule before submitting, using the same isEmptyObject check the section already uses (AIRulesSection.tsx:34-35):
      const policy = usePolicy(policyID);
      const [showAgentCreatedModal, setShowAgentCreatedModal] = useState(false);
      
      const saveRule = (values) => {
          const isFirstRule = isEmptyObject(policy?.rules?.aiRules);
          addPolicyAIRule(policyID, rand64(), values[INPUT_IDS.PROMPT]);
          if (isFirstRule) {
              setShowAgentCreatedModal(true); // navigate back on confirm
          } else {
              Navigation.goBack();
          }
      };
    2. Render a ConfirmModal with a single "Got it" action (shouldShowCancelButton={false}) that calls Navigation.goBack() on confirm/close. Title: "RuleBot has been added to your workspace"; prompt: the body copy from the mockup; confirm text: "Got it".
    3. Add the new strings to the workspace.rules.aiRules block in en.ts:7505-7517 and translate across the other src/languages/*.ts files.
    Design considerations
    • "First rule" detection: checking isEmptyObject(policy?.rules?.aiRules) at submit time is reliable because the optimistic update for the new rule hasn't been applied yet when saveRule runs. Alternatively !policy?.ruleBotAccountID could be used, but ruleBotAccountID is only set after the server responds, so it's not safe for the optimistic flow.
    • Offline: the modal is purely informational and triggers optimistically, so it works offline. The agent is still created server-side once the queued request flushes.
    • Edge case: if a user deletes all rules and adds another, aiRules would be empty again and the modal would re-show. Confirm with design whether that's acceptable, or gate on ruleBotAccountID already existing to make it strictly once-per-workspace.

    What alternative solutions did you explore?

    Showing the modal on PolicyRulesPage/AIRulesSection after navigating back (e.g., watching ruleBotAccountID transition from unset → set). This is more "correct" (fires only when the agent truly exists) but adds cross-page state and a watcher; the in-page approach is simpler and matches the mockup's flow.


    Next Steps for Contributor+ team:
    To accept: @MelvinBot implement [this](https://github.com/Expensify/App/issues/93448) to create a draft PR.
    To refine: @MelvinBot <your feedback>
    To reject: Explain why you are rejecting Melvin's proposal.

  4. NicolasBonet commented on Jun 12, 2026

    @NicolasBonet
    Contributor

    @MelvinBot let's implement this

  5. MelvinBot commented on Jun 12, 2026

    @MelvinBot
    ContributorAuthor

    🤖 Draft PR created: #93466
    Please mark it as "Ready for review" when it is ready for review.

  6. changed the title [-]Add confirmation modal after creating your first AI rule (when an agent is created)[/-] [+][$250] Add confirmation modal after creating your first AI rule (when an agent is created)[/+] on Jun 15, 2026
  7. 27 remaining items

  8. mallenexpensify commented on Jun 26, 2026

    @mallenexpensify
    Contributor

    @MelvinBot payment is due on this issue. Review the above regressions/deploy blockers related to the PR for this issue to determine how much is due. Return a bulleted list of offending PRs and mention if their associated/linked GH issue was paid. Payment details are in https://github.com/Expensify/App/blob/main/contributingGuides/CONTRIBUTING.md. include proposed payment details in the below format

    Payment Summary

    Contributor: @user paid $250 via Upwork
    Contributor+: @user due $250 via NewDot

  9. mallenexpensify commented on Jun 26, 2026

    @mallenexpensify
    Contributor

    @aimane-chnaif once Melv is finished above, please comment on DBs. From the C+ doc

    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.

  10. MelvinBot commented on Jun 26, 2026

    @MelvinBot
    ContributorAuthor

    Reviewed the deploy blockers linked to PR #93466 (the PR for this issue) against the regression policy — a 50% penalty per regression applies to the Contributor and Contributor+.

    Offending PR: #93466 (this issue's PR). Three deploy blockers were auto-linked to it; only one is a true regression caused by it:

    Net: 1 regression → Contributor+ payment reduced by 50%.

    Payment Summary

    Contributor: NicolasBonet — no payment (internal Expensify engineer; PR was MelvinBot-authored)
    Contributor+: @aimane-chnaif due $125 via Upwork ($250 base − 50% regression penalty for #93618)

    One decision left for you, mallenexpensify: QichenZhu did the initial review and requested changes before aimane-chnaif took over and approved. The handoff was to expedite the merge before NicolasBonet went OOO (confirmed here). Only one C+ is normally paid per issue, so whether QichenZhu gets a separate/split review payment is your call — the summary above assumes the single C+ of record (aimane-chnaif).

  11. aimane-chnaif commented on Jun 26, 2026

    @aimane-chnaif
    Contributor

    I'd say #93618 is a follow-up of new feature, not regression which broke production behavior.
    Reasoning: #93618 (comment)
    Also assigned engineer suspected if it's an issue.

    The rest 2 are unrelated as Melvin said.

    And the follow-up PR was also reviewed by me and there's no extra payment as I suggested.

  12. mallenexpensify commented on Jun 26, 2026

    @mallenexpensify
    Contributor

    @aimane-chnaif this one feels on the line cuz Shawn posted here

    Yeah, I had commented in the other PR that I thought that after you make the rule, the RHP should be closed in the background while the new agent modal is shown. So I do think this is a bug. If you navigate to Account > Agents from the modal, and then go back, you should just go back and see your newly created rule at the bottom of the Rules page - not the edit RHP.

    I'm going to let it slide cuz of what you posted here before a C+ was assigned and you fixed the bug.

    I am not sure why this is bug. This is native behavior of browser history.
    I also tested this browser back button flow during PR review but not reported.

  13. mallenexpensify commented on Jun 26, 2026

    @mallenexpensify
    Contributor

    Payment Summary

    Contributor+: @QichenZhu due $125 via NewDot
    Contributor+: @aimane-chnaif due $250 via NewDot

    $75 because tests weren't completed @QichenZhu (and that's a lot of the value in reviews).

  14. QichenZhu commented on Jun 26, 2026

    @QichenZhu
    Contributor

    $75 because tests weren't completed @QichenZhu (and that's a lot of the value in reviews).

    @mallenexpensify would you let it slide for me as well? We have a rule that even a PR review where testing isn't involved is worth $125, and I actually tested the PR and filled 3/4 of the checklist, just didn't finish it at the time because it didn't pass my testing.

  15. mallenexpensify commented on Jun 27, 2026

    @mallenexpensify
    Contributor

    @QichenZhu the difference is, when a PR is paid $125 cuz testing isn't needed, every other part of the process is completed. For your instance, tests weren't completed and the PR wouldn't have be merge-able had another C+ not stepped in (who we ended up paying the full price to)

  16. QichenZhu commented on Jun 29, 2026

    @QichenZhu
    Contributor

    @mallenexpensify thanks for clarifying!

    For your instance, tests weren't completed and the PR wouldn't have be merge-able had another C+ not stepped in (who we ended up paying the full price to)

    It was just because the PR was ready for retesting during my night off. I would have picked it up the next day otherwise.

    the difference is, when a PR is paid $125 cuz testing isn't needed, every other part of the process is completed.

    I completed the impactful part, and the other parts wouldn't have changed the outcome.

    What I did

    • Testing is a lot of the value as you noted, and I did it on two platforms and attached screenshots.
    • My feedback was adopted.

    All the changes in the PR happened during this phase.

    What I didn't get to

    • Retest after my comments were addressed
    • Complete remaining 1/4 of the checklist
    • Echo the design concern that QA later logged as a deploy blocker

    I'd argue I should get the full payment here.

  17. mallenexpensify commented on Jun 30, 2026

    @mallenexpensify
    Contributor

    @QichenZhu bumped price to $125, mainly cuz testing was completed, just not full testing. thx for the breakdown.

  18. QichenZhu commented on Jul 3, 2026

    @QichenZhu
    Contributor

    Glad we found a middle ground!

  19. trjExpensify commented on Jul 6, 2026

    @trjExpensify
    Contributor

    approved $125 for @QichenZhu

  20. garrettmknight commented on Jul 19, 2026

    @garrettmknight
    Contributor

    $250 apprvoed for @aimane-chnaif

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

Metadata

Metadata

Labels

Awaiting PaymentAuto-added when associated PR is deployed to productionDailyKSv2

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions