Skip to content

[Due for payment 2026-09-25] Render the Concierge system message for an automatic distance rate change #100556

Closed

Description

@neil-marcellini

(Neil's AI agent)

Part of the frontend tracking issue, which has the full plan and the rate-selection rules.

What

Register and render the new Concierge system message that explains an automatic distance rate change.

This ships before Auth starts creating the action. Unrecognized action names are filtered out entirely by shouldReportActionBeVisible against a supportedActionTypes allowlist, so a build that predates this PR hides the message entirely and nothing Auth puts on the action changes that.

  • Add the action type to CONST.REPORT.ACTIONS.TYPE (which puts it in the allowlist) and an OriginalMessage variant in src/types/onyx/OriginalMessage.ts.
  • Handle it in ActionContentRouter next to CONCIERGE_AUTO_MATCH_VENDOR.
  • Add the two copy variants to en.ts / es.ts:
    • Direct workspace change: rate updated to $0.67 / mi for the new workspace - Hal's Burgers
    • Report moved to another workspace: rate updated to $0.67 / mi for the new report's workspace - Hal's Burgers

The originalMessage carries the new rate value, currency, unit, the destination workspace name, and whether the change was direct or via a report move. Auth writes its own English version of this copy for the LHN last-message preview, so the two need to stay in sync.

Dependencies

Not blocked, but the exact action type string has to be agreed with the Auth side up front so both register the same value.

Issue OwnerCurrent Issue Owner: @dmkt9

Activity

  1. added
    InternalRequires API changes or must be handled by Expensify staff
    on Sep 7, 2026
  2. melvin-bot commented on Sep 8, 2026

    @melvin-bot

    @neil-marcellini — to hire @dmkt9 on Upwork, add the External label so a job is created and the offer is sent automatically.

  3. dmkt9 commented on Sep 8, 2026

    @dmkt9
    Contributor

    @MelvinBot create a proposal for this requirement

  4. MelvinBot commented on Sep 8, 2026

    @MelvinBot
    Contributor

    Proposal

    What is the root cause of that problem?

    This is new work rather than a regression, but there is a concrete blocker worth naming: the app has no CONCIERGE_AUTO_SELECT_DISTANCE_RATE-style action name.

    supportedActionTypes is derived from CONST.REPORT.ACTIONS.TYPE at src/libs/ReportActionsUtils.ts:1230, and shouldReportActionBeVisible drops anything not in that set. So until the constant exists, the action is filtered out before rendering and nothing Auth puts on it matters. Registering the type is what unblocks the deploy ordering; the renderer and copy are what make it readable.

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

    1. Register the action type — src/CONST/index.ts:1713

    Add CONCIERGE_AUTO_SELECT_DISTANCE_RATE: 'CONCIERGEAUTOSELECTDISTANCERATE' next to CONCIERGE_AUTO_MATCH_VENDOR. That alone puts it in the allowlist. The string has to be byte-identical to Auth's — agree it before either side merges.

    2. Add the OriginalMessage variant — src/types/onyx/OriginalMessage.ts:1093 and the map entry at line 1801

    Fields: rate (integer in the CUSTOM_UNIT_RATE_BASE_OFFSET scale, so 67 renders as $0.67), currency, unit (Unit, so mi/km), policyName, and the trigger. Use a string union for the trigger — changeType: 'workspaceChanged' | 'reportMoved' — not a boolean. Auth may add a third trigger later, and a boolean forces a schema break when it does.

    3. New renderer — src/pages/inbox/report/actionContents/ConciergeAutoSelectDistanceRateContent.tsx

    Format the rate with the existing getFormattedRateValue passing useShortFormUnit: true — that already produces $0.67 / mi, handles the currency-symbol fallback, and localizes digits. Don't hand-roll the string.

    Str.htmlEncode the workspace name before interpolating, for the same reason vendorName is encoded at ConciergeAutoMatchVendorContent.tsx:30 — workspace names are user-controlled and can contain markup.

    Render it as a muted system message (ReportActionItemBasicMessage wrapping RenderHTML with <comment><muted-text>), matching the MOVED and TRAVEL_UPDATE branches. Not ReportActionItemMessageWithExplain: the vendor message uses that because it carries LLM reasoning behind an "Explain" link, and this rate choice is deterministic.

    4. Route it — add the branch immediately after the CONCIERGE_AUTO_MATCH_VENDOR branch at ActionContentRouter.tsx:273.

    5. Copy — en.ts only, not es.ts

    One correction to the issue body here. Don't hand-write Spanish. All 11 locale files are typed against en and are machine-generated — es.ts carries the "automatically generated" header and generateTranslations.yml fills every locale on the PR. Add the two keys next to conciergeAutoMatchedVendor, types in src/languages/params.ts, plus a context annotation so "rate" isn't translated as a price or a fee.

    Note the apostrophe: report’s uses U+2019, matching the rest of en.ts.

    Tests: unit tests that shouldReportActionBeVisible now returns true for the new type, plus a render test per changeType asserting the formatted rate and an HTML-injecting workspace name coming out escaped.

    Open questions to settle with Auth before merging
    • Exact action-name string. Blocking for both sides.
    • Rate scale. Confirm Auth sends rate in the CUSTOM_UNIT_RATE_BASE_OFFSET (×100) scale the app already uses at CONST.POLICY.CUSTOM_UNIT_RATE_BASE_OFFSET, not as a decimal.
    • Leading lowercase. rate updated to … reads as if an actor name is prepended. The sibling Concierge message is a full sentence (Concierge matched this expense to …). Rendered as a muted system line with no prefix, rate updated to … starts mid-sentence. Worth confirming the intended rendering before the string is frozen — Auth mirrors it for the LHN preview, so changing it later means changing it twice.
    Scope question: localized LHN preview

    The issue notes Auth writes its own English copy for the last-message preview. That English string is what non-English users will see in the LHN, because ReportAlternateTextUtils only localizes previews for action types it explicitly branches on. Adding a branch there — the same shape as DYNAMIC_EXTERNAL_WORKFLOW_ROUTED — is a few lines and reuses the same translation keys.

    I'd fold it into F1 rather than leave a known English-only string in the LHN, but it is genuinely additive to what the issue asks for, so flagging rather than assuming.

    What alternative solutions did you explore? (Optional)

    One translation key with an inline ternary instead of two. Rejected: for the new workspace and for the new report’s workspace diverge structurally across languages, and a ternary inside the template hides the second variant from the translation pipeline's context annotations.

    Reusing MODIFIED_EXPENSE for the rate change rather than a new action type. Rejected: it renders as a user-attributed field edit, and the requirement is a Concierge system message explaining an automatic action. It would also give Auth no clean place to signal reportMoved versus workspaceChanged.

    Deriving the rate from the transaction at render time instead of reading it off originalMessage. Rejected: the message must describe the rate at the moment of the change. Later edits to the transaction or the workspace rate table would silently rewrite the history entry.


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


    view run · view recording

  5. dmkt9 commented on Sep 9, 2026

    @dmkt9
    Contributor

    Auth writes its own English version of this copy for the LHN last-message preview, so the two need to stay in sync.

    @neil-marcellini I'm not sure I'm following this. I think we should build the LHN last-message preview from the translations, right?

  6. neil-marcellini commented on Sep 9, 2026

    @neil-marcellini
    ContributorAuthor

    Yeah probably, or let's follow whatever the current pattern is.

  7. dmkt9 commented on Sep 10, 2026

    @dmkt9
    Contributor

    Thanks. @MelvinBot update your proposal to use the current codebase pattern for the LHN last-message preview.

  8. MelvinBot commented on Sep 10, 2026

    @MelvinBot
    Contributor

    Proposal (updated)

    Short answer to dmkt9: yes, the LHN preview should be built from translations. The established pattern is one shared message helper in ReportActionsUtils.ts that every surface calls — the in-report render, the LHN preview, and copy-to-clipboard. Auth's English string then only survives as the fallback for clients that don't know the action type.

    This replaces my earlier renderer plan (a ConciergeAutoMatchVendorContent-style component that builds the string inline with useLocalize). That shape is exactly what leaves English in the LHN — CONCIERGE_AUTO_MATCH_VENDOR has no branch in ReportAlternateTextUtils, so its preview falls through to report.lastMessageText today.

    What is the root cause of that problem?

    New work, with two concrete blockers:

    1. supportedActionTypes is derived from CONST.REPORT.ACTIONS.TYPE at ReportActionsUtils.ts:1230 and shouldReportActionBeVisible drops anything outside it. Until the constant exists the action never renders.
    2. getLastMessageTextForReport and getReportAlternateText build the LHN preview from an explicit per-action-type branch. With no branch, the preview falls back to report.lastMessageText — Auth's English copy, for every locale.

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

    1. Register the action type — src/CONST/index.ts:1714

    Add CONCIERGE_AUTO_SELECT_DISTANCE_RATE: 'CONCIERGEAUTOSELECTDISTANCERATE' next to CONCIERGE_AUTO_MATCH_VENDOR. The string must be byte-identical to Auth's — agree it before either side merges.

    2. Add the OriginalMessage variant — next to OriginalMessageConciergeAutoMatchVendor, plus the map entry at line 1611

    Fields: rate (integer, CUSTOM_UNIT_RATE_BASE_OFFSET ×100 scale — 67 → $0.67), currency, unit, policyName, and changeType: 'workspaceChanged' | 'reportMoved'. A string union rather than a boolean, so a third trigger later isn't a schema break.

    3. One shared message helper — new getConciergeAutoSelectDistanceRateMessage(translate, action) in src/libs/ReportActionsUtils.ts

    This is the pattern: getTravelUpdateMessage, getDynamicExternalWorkflowRoutedMessage, and — closest analogue, since it also formats a custom-unit rate — getWorkspaceCustomUnitRateUpdatedMessage.

    Format the rate with convertAmountToDisplayString(rate, currency), as that helper does at line 3373 — not getFormattedRateValue, which I recommended before. It requires toLocaleDigit and getCurrencySymbol from LocaleContext, which getLastMessageTextForReport has no access to; threading them in means changing that signature and every caller. convertAmountToDisplayString reads the locale from IntlStore itself and applies the same ÷100 and 2–4 decimal rules as getUnitRateValue, so $0.67 is identical either way.

    Still Str.htmlEncode the workspace name inside the helper — workspace names are user-controlled, same reason vendorName is encoded at ConciergeAutoMatchVendorContent.tsx:30.

    4. Call that one helper from every surface — this is the part that fixes the LHN

    Surface Where Model to copy
    LHN preview ReportAlternateTextUtils.ts:758 in getLastMessageTextForReport DYNAMIC_EXTERNAL_WORKFLOW_ROUTED
    LHN preview (chat rooms / policy expense chats / threads) ReportAlternateTextUtils.ts:1487 in getReportAlternateText TRAVEL_UPDATE
    In-report render ActionContentRouter.tsx:355 TRAVEL_UPDATE
    Message fragments ReportActionsUtils.ts:2496 in getReportActionMessageFragments TRAVEL_UPDATE
    Copy to clipboard ContextMenuActions.tsx:1362 TRAVEL_UPDATE
    Thread title (if the action can be threaded) ReportNameUtils.ts:873 TRAVEL_UPDATE

    Both LHN branches are needed: getLastMessageTextForReport covers expense reports and the default path, while getReportAlternateText's inner chain covers chat rooms, policy expense chats, and threads. TRAVEL_UPDATE is wired into both for that reason.

    Render it as a muted system line — ReportActionItemBasicMessage wrapping RenderHTML with <comment><muted-text>, exactly like line 358 — so no new component file is needed. Not ReportActionItemMessageWithExplain: the vendor message uses that because it carries LLM reasoning behind an "Explain" link, and this rate choice is deterministic.

    5. Copy — en.ts only, not es.ts

    Add the two keys next to conciergeAutoMatchedVendor plus the param types in src/languages/params.ts. All other locales are machine-generated — es.ts carries the "automatically generated" header and generateTranslations.yml fills them on the PR. Add a context annotation so "rate" isn't translated as a price or a fee. Note report’s uses U+2019, matching the rest of en.ts.

    Tests: shouldReportActionBeVisible returns true for the new type; a render test per changeType asserting the formatted rate and an escaped HTML-injecting workspace name; and an LHN case in ReportAlternateTextUtilsTest.ts plus ReportAlternateTextParityTest.ts, which already guards that the two preview paths agree.

    What this means for the Auth side

    Auth should still write its English lastMessageText — it stays the fallback for clients that predate this PR, and for anything outside NewDot. It just stops being what NewDot displays in the LHN, so the two no longer have to stay word-for-word in sync. That removes the sync burden the issue body calls out.

    Open questions to settle with Auth before merging
    • Exact action-name string. Blocking for both sides.
    • Rate scale. Confirm Auth sends rate in the CUSTOM_UNIT_RATE_BASE_OFFSET (×100) scale, not as a decimal.
    • Leading lowercase. rate updated to … reads as if an actor name is prepended. Rendered as a muted system line with no prefix it starts mid-sentence, unlike the sibling Concierge matched this expense to …. Worth confirming before the string is frozen.

    What alternative solutions did you explore? (Optional)

    Build the string inline in a new content component (my earlier plan, and what ConciergeAutoMatchVendorContent does). Rejected: it can't be reached from ReportAlternateTextUtils, so the LHN keeps showing Auth's English.

    One translation key with an inline ternary instead of two. Rejected: for the new workspace and for the new report’s workspace diverge structurally across languages, and a ternary hides the second variant from the translation pipeline's context annotations.

    Reusing MODIFIED_EXPENSE. Rejected: it renders as a user-attributed field edit, and gives Auth no clean place to signal reportMoved versus workspaceChanged.

    Deriving the rate from the transaction at render time. Rejected: the message must describe the rate at the moment of the change; later edits would silently rewrite history.


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


    view run · view recording

  9. dmkt9 commented on Sep 10, 2026

    @dmkt9
    Contributor

    @MelvinBot implement this

  10. MelvinBot commented on Sep 10, 2026

    @MelvinBot
    Contributor

    🤖 Draft PR created: #100781

    Please mark it as "Ready for review" when it is ready for review.

    What it does

    • Registers CONCIERGE_AUTO_SELECT_DISTANCE_RATE: 'CONCIERGEAUTOSELECTDISTANCERATE' so shouldReportActionBeVisible stops filtering the action out, plus the OriginalMessage variant (rate, currency, unit, policyName, and a changeType string union).
    • Adds one shared helper, getConciergeAutoSelectDistanceRateMessage, in ReportActionsUtils.ts, and calls it from all six surfaces: the report body, the message fragments, both LHN preview paths (getLastMessageTextForReport and getReportAlternateText), copy to clipboard, and the thread title. That is the part that answers the question on this issue — the LHN preview is now built from the translations, and Auth's English lastMessageText is only a fallback for clients that don't know the action type.
    • Adds the two copy variants to en.ts only. The other 10 locales are machine-generated and Polyglot Parrot fills them on the PR.

    Three things need a decision before merge

    1. The action name string must match Auth's byte for byte. The PR uses CONCIERGEAUTOSELECTDISTANCERATE.
    2. The rate scale. The PR assumes rate arrives in the CUSTOM_UNIT_RATE_BASE_OFFSET (×100) scale, so 67 renders as $0.67.
    3. The copy starts lowercase (rate updated to $0.67 / mi for the new workspace - Hal's Burgers), as the issue specifies. Rendered as a muted system line with no actor prefix it reads as if it starts mid-sentence, unlike the sibling Concierge matched this expense to …. Worth settling now, since Auth mirrors the string.

    Testing

    7 new unit tests, all passing — both changeType variants, an HTML-injecting workspace name coming out escaped, the fallback when the payload is incomplete, action visibility, and an LHN preview case proving the preview comes from the translation and not from the backend text. Lint, spelling, and the React Compiler compliance check are clean; 765 tests pass across every suite covering the files touched.

    Two caveats, both in the PR body: npm run typecheck reports the two new keys as missing in the 10 generated locale files until Polyglot Parrot commits, and the browser smoke test was inconclusive because the dev session signed itself out mid-run (the reload did confirm the bundle compiles and renders).


    view run · no recording available

  11. added
    ReviewingHas a PR in review
    and removed on Sep 10, 2026
  12. 12 remaining items

  13. dmkt9 commented on Sep 25, 2026

    @dmkt9
    Contributor

    Hi @neil-marcellini, we haven't processed the payment yet

  14. dmkt9 commented on Oct 20, 2026

    @dmkt9
    Contributor

    I'm reopening this issue because the payment hasn't been processed yet

  15. reopened this on Oct 20, 2026
  16. added
    Awaiting PaymentAuto-added when associated PR is deployed to production
    on Oct 20, 2026
  17. melvin-bot commented on Oct 20, 2026

    @melvin-bot

    Triggered auto assignment to @mallenexpensify (Awaiting Payment)

  18. mallenexpensify commented on Oct 20, 2026

    @mallenexpensify
    Contributor

    Payment Summary

    Contributor+: @dmkt9 paid $250 via Upwork

  19. dmkt9 commented on Oct 21, 2026

    @dmkt9
    Contributor

    27. ### Payment Summary
    Contributor+: @dmkt9 due $250 via NewDot

    @mallenexpensify I'm still recieving the payment via Upwork

  20. mallenexpensify commented on Oct 21, 2026

    @mallenexpensify
    Contributor

    @dmkt9 can you please accept the job below? Please reply here and tag me once you have.
    https://www.upwork.com/jobs/~022112978312927738852

  21. dmkt9 commented on Oct 22, 2026

    @dmkt9
    Contributor

    @dmkt9 can you please accept the job below? Please reply here and tag me once you have.
    upwork.com/jobs/~022112978312927738852

    @mallenexpensify Thanks. I've accepted the offer

  22. mallenexpensify commented on Oct 22, 2026

    @mallenexpensify
    Contributor

    @dmkt9 paid, summary updated above. Thx.

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 productionInternalRequires API changes or must be handled by Expensify staffReviewingHas a PR in reviewWeeklyKSv2

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions