Skip to content

[$175] Expense - The DELEGATESUBMIT system message appears only after reopening the expense details #98705

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.4.54-1
Reproducible in staging?: Yes
Reproducible in production?: Yes
If this was caught during regression testing, add the test name, ID and link from BrowserStack: #96766
Email or phone of affected tester (no customers): n/a
Issue reported by: Applause Internal Team
Bug source: Pull Request QA execution
Device used: Mac 26.5.1 Safari, iPhone 13 iOS 26.5
App Component: Money Requests

Action Performed:

  1. Go to https://staging.new.expensify.com
  2. As an admin, invite Approver A and a Submitter to the workspace
  3. Set up a workflow where Report Approver A has a Vacation Delegate B who is not a member of the report's policy.
  4. As a Submitter, open the expense details
  5. Submit an expense to the workspace chat

Expected Result:

The DELEGATESUBMIT system message should appear in the expense details conversation history after submitting an expense

Actual Result:

The DELEGATESUBMIT system message appears only after reopening the expense details page

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Bug7234014_1786755249741.Recording__2720.mp4

View all open jobs on GitHub

Applause Internal Information
Exported by: Julia Ponikarchuk
Bug ID: 7234014

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

Activity

  1. applause-bot commented on Aug 15, 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/15d612baebe1f5ffc2aa03fc50b98c16bada0dfc55184b2ac0a572a63c318971

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

    @MelvinBot
    Contributor

    Issue Analysis

    Root Cause: The DELEGATESUBMIT system message is generated server-side, and it is not returned to the submitting client in the submit response (nor pushed live). It only reaches the client on the next OpenReport — which is exactly what happens when you close and reopen the expense details. This is a backend/internal issue, not an App bug.

    Confidence: High (frontend traced end-to-end; the missing piece is confirmed by the App having no way to produce this action itself).

    Where the fix belongs: Outside the Expensify/App repo. The command that processes the submit and creates the DELEGATESUBMIT action needs to return that report action in its response (or broadcast it to the submitting client) so it appears immediately — the same way the optimistic SUBMITTED message already does. This requires changes in an internal repository, so it should be escalated to an internal engineer with access. No App-side change is recommended.

    Investigation details (App-side evidence)

    The App side is working as designed — the delay is purely a data-arrival problem:

    1. The App never builds DELEGATESUBMIT optimistically. Submitting an expense only builds an optimistic SUBMITTED action (buildOptimisticSubmittedReportAction in ReportWorkflow.ts:1335, request sent at ReportWorkflow.ts:1589). A grep of src/libs/actions/ for ACTION_DELEGATE_SUBMIT returns nothing — the action type is referenced only in render/read code.

    2. The action's data is server-only. Its originalManager / delegate / isOnPolicy fields (OriginalMessage.ts:1653) have no client-side source; getDelegateSubmitMessage (ReportActionsUtils.ts:4582) only reads them.

    3. The report list is reactive — proven by the optimistic SUBMITTED message appearing instantly. If the DELEGATESUBMIT action were in Onyx, it would render live too. So this is not an App reactivity/render bug.

    4. Reopening re-fetches actions. Mounting the report calls openReport (ReportFetchHandler.tsx:202), which pulls the full/fresh set of report actions from the server — which by then include the DELEGATESUBMIT action. This is the "only after reopening" behavior.

    Note: PR #96766 (merged 2026-08-13) only fixed the rendering/styling of this action as a muted system message — it never touched when the action arrives, consistent with the root cause above.

    To confirm on the backend: for a submit where the approver has an off-policy vacation delegate, verify the submit command's response onyxData does not contain the DELEGATESUBMIT report action, while the subsequent OpenReport response does.

    Possibly related: #98045 and #96454 also involve vacation-delegate system messages, though they describe wording/styling rather than this appearance-timing issue.


    Next Steps for Contributor+ team: This is a backend/internal issue — the fix is outside the App repo, so it needs an internal engineer to update the submit command to return (or broadcast) the DELEGATESUBMIT action so it appears immediately. Reply with @MelvinBot <your feedback> to refine this analysis.

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

    @melvin-bot

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

  6. melvin-bot commented on Aug 15, 2026

    @melvin-bot
  7. marufsharifi commented on Aug 17, 2026

    @marufsharifi

    reproduced, reviewing the proposal

  8. marufsharifi commented on Aug 18, 2026

    @marufsharifi

    Reviewed and reproduced. The DELEGATESUBMIT system message is generated server-side and is not included in the submit command's response — it only reaches the client on the next OpenReport, which is why it appears only after reopening. Confirmed on the App side: there's no optimistic builder for this action (grep ACTION_DELEGATE_SUBMIT src/libs/actions/ is empty), the required fields (originalManager/delegate/isOnPolicy) have no client-side source, and the action type is in supportedActionTypes — so if it were returned in the response it would render live like the optimistic SUBMITTED message does. This needs a backend change so the submit command returns the DELEGATESUBMIT action; no App-side fix is appropriate.

    repro.mp4
  9. marufsharifi commented on Aug 18, 2026

    @marufsharifi

    Based on my investigation above, it looks like we need some help from the backend team.

    🎀 👀 🎀 C+ reviewed

  10. melvin-bot commented on Aug 18, 2026

    @melvin-bot

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

  11. stitesExpensify commented on Aug 18, 2026

    @stitesExpensify
    Contributor

    @marufsharifi just added you to a backend PR

  12. stitesExpensify commented on Aug 18, 2026

    @stitesExpensify
    Contributor

    JK, sorry I thought you were also a backend contributor. I put up a PR and add an internal reviewer

  13. 33 remaining items

  14. stitesExpensify commented on Nov 10, 2026

    @stitesExpensify
    Contributor

    Written by Claude on behalf of @stitesExpensify.

    @marufsharifi I dug into this and the backend is sending the action now, the App is hiding it.

    What's happening

    1. Since Auth #23799, the SubmitReport response includes the DELEGATESUBMIT action (it's the earlier reportActions_<reportID> entry in onyxData, not the one with SUBMITTED).
    2. That live copy has message: [{html: "", text: "", type: "COMMENT"}], because Auth has no message builder for this action. The OpenReport copy has the rendered text fragments from Web-Expensify instead.
    3. In App, hasDeletedMessage treats message[0].html === '' as a legacy deleted comment, so isDeletedAction returns true and shouldReportActionBeVisible hides it. After OpenReport merges the text fragments, it becomes visible.

    Proposed fix (App)
    Add ACTION_DELEGATE_SUBMIT to the "empty message by design" exemptions in isDeletedAction in src/libs/ReportActionsUtils.ts, same as REASSIGN_APPROVER and friends. App already renders this action from originalMessage via getDelegateSubmitMessage, so message isn't needed. Fixing it in Auth instead isn't a great fit because the text is viewer-dependent (you / your / their) and live updates send one payload to every participant.

    This should be a small App-only PR plus a unit test, so it can go to a contributor.

  15. marufsharifi commented on Nov 11, 2026

    @marufsharifi
  16. MelvinBot commented on Nov 11, 2026

    @MelvinBot
    Contributor

    🤖 Web test steps verification results: ⚠️ partial

    Web verification was blocked because the scenario requires multiple identities, but only one authenticated session was available. Rendering remains unverified.

    Step Status
    Invite approver and submitterBlocked by the multi-identity setup requirement.
    ⚠️
    Configure an off-workspace vacation delegateRequires access to the approver identity.
    ⚠️
    Submit an expense as the submitterBlocked by the preceding setup.
    ⚠️
    Verify the message appears without reopeningImmediate rendering remains unverified.
    ⚠️

    Implemented in draft PR: Show delegate submit system messages without reopening expense details, assigned to marufsharifi.

    All 562 targeted tests, lint, typecheck, spelling, and Storybook smoke checks passed. Full Jest timed out; formatting verification was unavailable. Details are recorded in the PR.


    view run

  17. added
    ExternalAdded to denote the issue can be worked on by a contributor
    and removed
    ExternalAdded to denote the issue can be worked on by a contributor
    on Nov 13, 2026
  18. melvin-bot commented on Nov 13, 2026

    @melvin-bot

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

  19. changed the title [-]Expense - The DELEGATESUBMIT system message appears only after reopening the expense details[/-] [+][$175] Expense - The DELEGATESUBMIT system message appears only after reopening the expense details[/+] on Nov 13, 2026
  20. mallenexpensify commented on Nov 13, 2026

    @mallenexpensify
    Contributor

    Claude posting on behalf of Matt:

    @Pujan92 please take over as C+.

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.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributorReviewingHas a PR in review

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions