Skip to content

[$175] – PR 103367 – Concierge – Custom Agent Replies When @Concierge Is Mentioned #104425

Open

Description

@applause-bot

If you haven’t already, check out our contributing guidelines for onboarding. To join our Slack channel, fill out this form.


Version Number: v9.5.14-0
Reproducible in staging?: Yes
Reproducible in production?: Yes
If this was caught during regression testing, add the test name, ID and link from BrowserStack: #103367
Email or phone of affected tester (no customers): sintayewhaylu01@gmail.com
Issue reported by: Applause Internal Team
Bug source: Pull Request QA execution
Device used: Windows 10 /Chrome
App Component: Other

Action Performed:

  1. Navigate to staging.new.expensify.com.
  2. Go to Account → Agents → New Agent → Build Custom Agent.
  3. Open an expense report containing two or more expenses
  4. Send the following message in the report's comments: @concierge what is this report's total?

Expected Result:

Only Concierge's reply should be displayed.

Actual Result:

Both Concierge's reply and the custom agent's reply are displayed.

Workaround:

Unknown

Platforms:

  • Android: App
  • Android: mWeb Chrome
  • iOS: App
  • iOS: mWeb Safari
  • iOS: mWeb Chrome
  • Windows: Chrome
  • MacOS: Chrome Safari

Screenshots/Videos

Bug7290529_1792436069049.bandicam_2026-10-19_21-42-38-451.mp4

View all open jobs on GitHub

Applause Internal Information
Exported by: Svetlana Lazutkina
Bug ID: 7290529

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

Activity

  1. applause-bot commented on Oct 19, 2026

    @applause-bot
    Author

    While Applause doesn't embed attachments for this bug, here are the links for quick view:
    https://platform.applause.com/services/links/v1/external/9a0e45c13c343fbf265ed30462ba1709926dde1356398e3babf46388f57b8488

  2. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on Oct 19, 2026
  3. MelvinBot commented on Oct 19, 2026

    @MelvinBot
    Contributor

    Issue Analysis

    Root Cause: This appears to be a backend/internal issue. A separate internal investigation is needed.

    The App never tells the server which agent should reply. The server reads the comment and decides that on its own. PR 103367 did not cause the extra reply. It only adds the 👍/👎 prompt, which makes the agent's reply easier to notice.

    Recommended Fix: The fix is outside the App repo. Please escalate to an internal engineer who can change how the backend picks which agents reply.

    Investigation details
    • AddComment sends only the report ID, the comment HTML and Concierge-specific fields. It sends no mentioned accounts and no agent IDs: src/libs/API/parameters/AddCommentOrAttachmentParams.ts:3-21. The @Concierge mention exists only inside the comment HTML.
    • PR 103367's getFeedbackPromptActionIDs only chooses which comments get the feedback prompt. The PR doesn't change any visibility or filtering logic, so the agent's reply would have shown before the PR too, just without the prompt. The report says the bug also reproduces in production.
    • Possible confounder: steps 5-6 of PR 103367's test plan have the tester @-mention the agent in the same expense report. If the agent was mentioned there earlier, it may have joined the report and now replies to every comment. Please check the video to confirm whether the agent was mentioned before.
    • I could not test this on web. Reproducing it needs backend agent replies, and I couldn't read the backend code.

    Next Steps: Reply with @MelvinBot <your feedback> to refine this analysis.


    view run

  4. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on Oct 19, 2026
  5. melvin-bot commented on Oct 19, 2026

    @melvin-bot

    Triggered auto assignment to Contributor-plus team member for initial proposal review - @eVoloshchak (External)

  6. changed the title [-]– PR 103367 – Concierge – Custom Agent Replies When @Concierge Is Mentioned[/-] [+][$175] – PR 103367 – Concierge – Custom Agent Replies When @Concierge Is Mentioned[/+] on Oct 19, 2026
  7. melvin-bot commented on Oct 19, 2026

    @melvin-bot
  8. camesenin commented on Oct 19, 2026

    @camesenin

    Proposal

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

    When sending a message mentioning @Concierge (e.g. @Concierge what is this report's total?) in an expense report where a custom agent previously participated, both Concierge and the custom agent post a reply, instead of only Concierge.

    What is the root cause of that problem?

    This is a server-side / backend agent dispatching issue, coupled with how PR #103367 surfaced agent visibility:

    1. When a user sends a message in useComposerSubmit.ts, addComment calls API.write(SIDE_EFFECT_REQUEST_COMMANDS.ADD_COMMENT, ...) with parameters defined in src/libs/API/parameters/AddCommentOrAttachmentParams.ts:3-21.
    2. The client application passes only the raw message/HTML (reportComment) without resolving or restricting dispatch to specific agent participants. The backend parses mentions and triggers background Webhook / LLM processing jobs (ProcessAgentZeroRequest).
    3. On the backend, when a custom agent has joined a report (either via previous @mention or invite during PR [Payment due @ikevin127] Show the 👍/👎 feedback prompt under custom agent replies #103367 test steps), the backend agent dispatcher evaluates messages posted in that report and mistakenly dispatches incoming messages to all active report agents even when an explicit @Concierge mention specifies Concierge as the sole target.
    4. Furthermore, PR [Payment due @ikevin127] Show the 👍/👎 feedback prompt under custom agent replies #103367 introduced getFeedbackPromptActionIDs in src/libs/ReportActionsUtils.ts:1831 which computes feedback prompts for [CONST.ACCOUNT_ID.CONCIERGE, ...customAgentAccountIDs]. While PR [Payment due @ikevin127] Show the 👍/👎 feedback prompt under custom agent replies #103367 made custom agent responses prominent by adding feedback prompts beneath them, it revealed that the backend does not enforce mutual exclusion or target filtering when a specific agent (@concierge) is explicitly targeted.

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

    Backend Change (Primary Fix):

    In Auth/Web-Expensify agent dispatcher (ProcessAgentZeroRequest):

    • When a comment contains an explicit mention targeting @Concierge (or another specific agent by accountID), suppress automated trigger events for any other custom agents registered as participants in that report, unless they are also explicitly mentioned in the comment text.

    Frontend Client Safeguard (If resolved client-side via parameters or action filtering):

    If Expensify prefers client-side mention hints to avoid unnecessary webhook dispatches:

    1. In src/libs/ReportUtils.ts / src/pages/inbox/report/ReportActionCompose/useComposerSubmit.ts:
      Parse mention tags in the comment. If @Concierge or a specific agent mention is detected, populate a target dispatch hint parameter (e.g., targetedAgentAccountIDs: [CONST.ACCOUNT_ID.CONCIERGE]) in AddCommentOrAttachmentParams.
    2. This ensures the backend dispatcher knows immediately whether the query is strictly directed to Concierge or intended for multiple agents.

    What alternative solutions did you explore? (Optional)

    Client-side filtering of optimistic or incoming actions: rejected because both responses are genuine backend actions created in the DB and suppressing one on the client would cause synchronization mismatches across devices.

    Contributor details
    Your Expensify account email: camesenin@gmail.com
    Upwork Profile Link: https://www.upwork.com/freelancers/~0170d6b02e9440e604

  9. melvin-bot commented on Oct 19, 2026

    @melvin-bot

    ✅ Contributor details stored successfully. Thank you for contributing to Expensify!

  10. sijo0218 commented on Oct 20, 2026

    @sijo0218

    Contributor details
    Your Expensify account email: sijo0218@gmail.com
    Upwork Profile Link: https://www.upwork.com/freelancers/~011091133bbb09cd1c

    Proposal

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

    When sending a message explicitly mentioning @Concierge (e.g., @Concierge what is this report's total?) in an expense report after creating a custom agent via Account → Agents → New Agent → Build Custom Agent, both Concierge and the custom agent post separate replies, instead of only Concierge responding.

    What is the root cause of that problem?

    This is a server-side agent dispatching & mention targeting issue in the AgentZero processing pipeline:

    1. In the client, addComment (src/libs/actions/Report.ts) invokes API.write(SIDE_EFFECT_REQUEST_COMMANDS.ADD_COMMENT, ...) passing AddCommentOrAttachmentParams (src/libs/API/parameters/AddCommentOrAttachmentParams.ts). The client sends the comment HTML in reportComment without filtering or dictating which agent backend worker should process the prompt.
    2. On the backend (Expensify/Auth and Web-Expensify), when a user creates a custom agent, the agent is registered with agent capabilities for the user's active reports/workspaces.
    3. When a comment is added to an expense report, the server evaluates whether AgentZero / LLM processing should be triggered. However, the dispatcher triggers all eligible agent listeners (both Concierge and custom agents associated with the workspace/report) instead of evaluating the explicit mention tags in the comment to restrict execution exclusively to the tagged agent (@Concierge).
    4. Why was this caught in PR [Payment due @ikevin127] Show the 👍/👎 feedback prompt under custom agent replies #103367 QA?
      PR [Payment due @ikevin127] Show the 👍/👎 feedback prompt under custom agent replies #103367 introduced inline 👍/👎 feedback prompts for custom agents (getFeedbackPromptActionIDs in src/libs/ReportActionsUtils.ts:1831). Step 5-6 of PR [Payment due @ikevin127] Show the 👍/👎 feedback prompt under custom agent replies #103367's QA test plan instructed testers to create and interact with a custom agent in the report. Once the custom agent was active, subsequent @Concierge queries triggered both listeners, and the new feedback prompt on the custom agent made the double-reply immediately obvious.

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

    1. Server-Side / Backend Fix (Authoritative Resolution):

    In Expensify/Auth / AgentZero dispatcher (ProcessAgentZeroRequest / shouldRunAgent):

    • Parse explicit mention tags within the comment HTML:
      • If the comment contains an explicit mention targeting @Concierge (accountID: CONST.ACCOUNT_ID.CONCIERGE), only invoke Concierge processing; do not trigger custom agent runners unless that custom agent is also explicitly @-mentioned.
      • If a specific custom agent is mentioned by name, only invoke that specific custom agent.
      • If no specific agent is mentioned (or if both are mentioned), follow standard multi-agent dispatch rules.

    2. Client-Side Consideration (If Expensify prefers a client-side intent hint):

    If Expensify prefers that the client specifies target agent scope directly to avoid backend mention re-parsing:

    • In src/libs/API/parameters/AddCommentOrAttachmentParams.ts:
      Add an optional parameter targetedAgentAccountIDs?: number[].
    • In src/pages/inbox/report/ReportActionCompose/useComposerSubmit.ts / Report.ts:addComment:
      Extract mentioned account IDs from the composer comment. If an agent (such as Concierge or custom agent) is explicitly targeted, pass its accountID in targetedAgentAccountIDs.
    • The backend can then respect targetedAgentAccountIDs to dispatch only to the requested agent.

    What alternative solutions did you explore? (Optional)

    • Client-side suppression/filtering of received report actions:
      Rejecting or hiding the custom agent action on the client when incoming via Onyx/Pusher is strongly discouraged because the custom agent response is a persistent database record created by the backend. Suppressing it on one client would cause message count and thread inconsistencies across platforms and webhooks. The dispatch must be gated at the source.
  11. melvin-bot commented on Oct 20, 2026

    @melvin-bot

    ✅ Contributor details stored successfully. Thank you for contributing to Expensify!

  12. melvin-bot commented on Oct 23, 2026

    @melvin-bot

    @eVoloshchak Whoops! This issue is 2 days overdue. Let's get this updated quick!

  13. eVoloshchak commented on Oct 26, 2026

    @eVoloshchak
    Contributor

    The fix is outside the App repo. Please escalate to an internal engineer who can change how the backend picks which agents reply.

    Agree. @MelvinBot, please make this Internal

  14. eVoloshchak commented on Oct 26, 2026

    @eVoloshchak
    Contributor

    This needs to be internal
    🎀👀🎀 C+ reviewed!

  15. melvin-bot commented on Oct 26, 2026

    @melvin-bot

    Triggered auto assignment to @blimpich, see https://stackoverflow.com/c/expensify/questions/7972 for more details.

  16. added
    InternalRequires API changes or must be handled by Expensify staff
    and removed
    ExternalAdded to denote the issue can be worked on by a contributor
    on Oct 26, 2026
  17. MelvinBot commented on Oct 26, 2026

    @MelvinBot
    Contributor

    Done. I removed the External label and added Internal.

    The fix needs a backend change to how agents are picked to reply, so an internal engineer needs to take it. blimpich is already assigned.


    view run

  18. blimpich commented on Oct 26, 2026

    @blimpich
    Contributor
  19. self-assigned this
    on Oct 27, 2026
  20. hungvu193 commented on Oct 27, 2026

    @hungvu193
    Contributor

    Working on BE PR

  21. hungvu193 commented on Oct 27, 2026

    @hungvu193
    Contributor

    It's now ready for review @blimpich 🙇

  22. blimpich commented on Oct 27, 2026

    @blimpich
    Contributor

    Merged backend PR, should get deployed today or tomorrow

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

Metadata

Metadata

Labels

BugSomething is broken. Auto assigns a BugZero manager.DailyKSv2InternalRequires API changes or must be handled by Expensify staff

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions