Skip to content

Take the user into the Concierge thread after asking a question - #97816

Draft
rushatgabhane wants to merge 1 commit into
Expensify:mainfrom
rushatgabhane:concierge-thread-navigation
Draft

Take the user into the Concierge thread after asking a question#97816
rushatgabhane wants to merge 1 commit into
Expensify:mainfrom
rushatgabhane:concierge-thread-navigation

Conversation

@rushatgabhane

@rushatgabhane rushatgabhane commented Aug 4, 2026

Copy link
Copy Markdown
Member

Explanation of Change

Front-end side of Concierge answering each question in its own thread, gated by the conciergeRespondInThread beta. ConciergeDraftProvider and AgentZeroStatusProvider both gate on reportID === conciergeReportID, which a thread fails, so streaming would have silently stopped working there; both now also match a report whose parentReportID is the Concierge DM.

addActions also follows the user into the thread after they ask. Write commands resolve as soon as they are queued and never carry the server's response, so the thread ID arrives as childReportID on the user's own comment a moment later and the navigation waits for that, giving up after 15 seconds or if the user has navigated away.

Requires https://github.com/Expensify/Web-Expensify/pull/55108; until that ships childReportID never appears and the navigation is inert, so this is safe to merge first.

Fixed Issues

$ #94503
PROPOSAL:

Tests

  1. Add your account to the conciergeRespondInThread beta and ask Concierge a question in your Concierge DM.
  2. Verify you are taken into a thread showing the thinking indicator and then the streamed reply.
  3. Open a non-Concierge chat, reply in a thread, and verify nothing about that flow changed.
  • Verify that no errors appear in the JS console

Offline tests

  1. Go offline and send Concierge a question.
  2. Verify the message queues in the DM and you are not navigated anywhere, since no thread exists yet.
  3. Go back online and verify the message sends and the reply arrives in a thread without pulling you out of whatever you are looking at.

QA Steps

  1. Add a test account to the conciergeRespondInThread beta and ask Concierge a question in its DM.
  2. Verify you land in a thread showing the thinking indicator and then the reply.
  3. Verify an account not on the beta still gets the reply in the DM and is not navigated anywhere.
  • 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 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 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)
  • 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)
  • 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.
  • 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.

@rushatgabhane
rushatgabhane requested review from a team as code owners August 4, 2026 16:55
@melvin-bot
melvin-bot Bot requested review from heyjennahay and removed request for a team August 4, 2026 16:55
@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

This PR adds a new Onyx.connectWithoutView call, so I've requested a review from the Onyx performance reviewers (@tgolen, @mountiny, @luacmartins) — a review from any one of them is enough. Please add a link in your PR description to the Slack discussion where the @frontend-performance team approved using connectWithoutView here.

@melvin-bot
melvin-bot Bot requested a review from marcaaron August 4, 2026 16:55
@melvin-bot

melvin-bot Bot commented Aug 4, 2026

Copy link
Copy Markdown

@marcaaron 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 removed the request for review from a team August 4, 2026 16:55
@rushatgabhane
rushatgabhane marked this pull request as draft August 4, 2026 17:03
@rushatgabhane

Copy link
Copy Markdown
Member Author

sorry for the ping, this is a WIP

@codecov

codecov Bot commented Aug 4, 2026

Copy link
Copy Markdown

Codecov Report

❌ Looks like you've decreased code coverage for some files. Please write tests to increase, or at least maintain, the existing level of code coverage. See our documentation here for how to interpret this table.

Files with missing lines Coverage Δ
src/CONST/index.ts 94.81% <ø> (ø)
src/pages/inbox/AgentZeroStatusContext.tsx 93.44% <100.00%> (ø)
src/pages/inbox/ConciergeDraftContext.tsx 94.44% <100.00%> (+0.15%) ⬆️
src/selectors/Report.ts 67.92% <100.00%> (+1.25%) ⬆️
src/libs/actions/Report/index.ts 71.96% <55.55%> (-0.15%) ⬇️
... and 71 files with indirect coverage changes

@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: cdfa5751a8

ℹ️ 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".

}
},
});
timeoutID = setTimeout(() => Onyx.disconnect(connectionID), CONCIERGE_THREAD_NAVIGATION_TIMEOUT_MS);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Keep the watcher alive for queued offline comments

When a Concierge comment is sent offline or remains queued for more than 15 seconds, this timeout disconnects before the request reaches the server. If the user is still in the Concierge chat when connectivity returns, the eventual childReportID update is therefore missed and the user is not taken into the newly created thread. Tie cleanup to request completion/failure or network state rather than elapsed wall-clock time.

Useful? React with 👍 / 👎.

Comment on lines +873 to +875
// The user may have moved on while the thread was being opened; only follow the reply if they
// are still sitting in the chat they asked from.
if (Navigation.getTopmostReportId() !== reportID) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Check the actually focused route before navigating

When the user opens an RHP or another surface while the Concierge DM remains in the central pane, this guard still passes because getTopmostReportId() only reads the central-pane report, as documented in Navigation.ts. The delayed callback then changes the report behind the surface even though the user has moved on; compare the focused/active route captured when the question was sent instead.

Useful? React with 👍 / 👎.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant