Skip to content

Unify bot and HE support into a single Get help conversations flow#22946

Draft
adalpari wants to merge 20 commits into
trunkfrom
update/wordpress-rs-combined-conversations-support
Draft

Unify bot and HE support into a single Get help conversations flow#22946
adalpari wants to merge 20 commits into
trunkfrom
update/wordpress-rs-combined-conversations-support

Conversation

@adalpari

@adalpari adalpari commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

Description

This PR consolidates the experimental "Ask the Bots" (support.aibot) and "Ask the Happiness Engineers" (support.he) features into a single unified support conversations experience, backed by the new combined-conversations endpoints in wordpress-rs.

What changed

  • New support.unified package: UnifiedSupportActivity, UnifiedSupportViewModel, and UnifiedSupportRepository drive a single list + detail flow for all support conversations, using the unifiedConversations() and supportBots() rs APIs (list, detail, reply with attachments / encrypted app log IDs, new bot chat creation).
  • Type-branched detail UX: bot conversations render as a chat (welcome header, message bubbles, typing indicator, inline input bar — matching the old Ask the Bots UX, with bot entries branded as "Oddie bot"), while HE conversations keep the ticket-style layout (status badge, title card, reply bottom sheet with attachments and app logs — matching the old Ask the HE screen).
  • Single entry point: the two support menu items are replaced by one "Get help" entry; AIBotSupportActivity and HESupportActivity are removed along with their repositories, view models, and screens (~6.9k lines deleted). Shared pieces (attachment previews, status badge, ticket content view, temp attachment utils) moved from support.he to support.unified.
  • wordpress-rs bump: alpha-2026-04-201288-85a8554, with mechanical adoption of the new WpService/SiteInfo constructor and UserCapabilitiesMap in WpServiceProvider and SampleUsers.
  • Review fixes (last commit): attachment size meter recalculates on removal, conversation list API errors surface as the error state instead of an empty list, bot chat input survives configuration changes, and scroll-to-bottom derives its index from data instead of stale lazy list layout info.

Notes for reviewers

  • The rs dependency is pinned to a per-PR build (1288-85a8554); it should move to a tagged release before merge.
  • Test coverage for UnifiedSupportViewModel (optimistic send/rollback, attachments) is planned as a follow-up.

Testing instructions

Requires the Jetpack app (jetpackDebug) and a logged-in WordPress.com account.

Unified conversations list:

  1. Go to Me → Help & Support (the new "Get help" entry replaces "Ask the Bots" and "Ask the Happiness Engineers")
  2. Tap Get help
  • Verify existing bot and HE conversations appear in a single list, bot entries badged "Oddie bot", HE entries showing their status
  1. Pull to refresh
  • Verify the list reloads

New bot conversation:

  1. From the conversations list, tap the + button
  2. Type a message and send it
  • Verify your message appears immediately, a typing indicator shows, and the bot reply arrives
  1. Rotate the device with text typed in the input bar
  • Verify the typed text is preserved

HE conversation reply:

  1. Open an HE conversation that accepts replies
  2. Tap Reply, write a message, attach an image, and enable "Include app logs"
  3. Send the reply
  • Verify the reply appears in the conversation with its attachment
  1. In the reply sheet, add attachments near the 20MB limit, then remove one
  • Verify the size meter updates after removal and previously rejected files can be re-added

Error states:

  1. Open the conversations list with airplane mode enabled
  • Verify the offline view is shown (not an empty list)
  1. Open a closed HE conversation
  • Verify the closed banner is shown instead of the reply button

🤖 Generated with Claude Code

adalpari and others added 14 commits May 28, 2026 13:04
Adopts the new WpService(SiteInfo, delegate, cache) constructor in
place of the removed WpService.wordpressCom / WpService.selfHosted
factories, and wraps UserWithEditContext.extraCapabilities in
UserCapabilitiesMap to match the updated type.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Wires a new parallel entry point on the Support screen that drives
list/detail/reply through the new wordpress-rs unifiedConversations()
endpoint, merging HE tickets and AI bot chats into a single chat-style
view branching UI on UnifiedMessage.authorRole. Reply UX is an inline
input bar gated on UnifiedConversationSummary.canAcceptReply, and a
successful reply replaces local state with the server response per
the new API contract. The existing HE and AI Bot flows are left
unchanged so they can still create new tickets/chats.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
In the unified support detail screen, choose the reply affordance based on
the conversation's status:
- Bot conversations (status == "bot") keep the always-on inline chat input.
- HE conversations that can accept a reply show a Reply button that opens a
  modal reply sheet reusing the HE TicketMainContentView form.
- HE conversations that cannot accept a reply show a closed banner.

The unified reply API only accepts a message string, so the reply sheet
greys out the screenshots and app-logs controls. To support this without
changing existing HE call sites, TicketMainContentView gains optional
attachmentsEnabled/appLogsEnabled params that default to its enabled flag.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Replicate the bot send/receive UX from the AI Bot support screen in the
unified detail screen, for bot conversations only (status == "bot"):
- Show an animated "bot is typing" indicator while a reply is in flight.
- Disable the send button while sending or loading, keeping the input
  field editable (ChatInputBar now takes canSendMessage).
- Auto-scroll to the bottom when the bot starts typing.

HE conversations are unaffected.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Make the unified conversations list match the Ask the Happiness Engineers
screen and support creating new conversations:
- List items now show a status badge, title, timestamp, and description.
  HE conversations use their ticket status; bot conversations show an
  "Assistant" chip.
- Show a "+" action and an empty-state Create button (the shared list
  screen renders these when a create callback is provided).
- Creating a new conversation starts a bot chat: the first message is
  created via the AI bot endpoint (createBotConversation) and mapped into
  a UnifiedConversation, mirroring the Ask the Bots flow.
- Centralize the "bot" status as UnifiedConversation.STATUS_BOT/isBot.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
For non-bot conversations, the unified detail screen now mirrors the
Ask the Happiness Engineers screen instead of the chat-bubble layout:
- Status badge + "Last updated" header and a title card (empty top bar).
- Full-width message items with an author + timestamp header.
- Attachments rendered as a thumbnail grid (auth-header image loading,
  video first-frame with a play overlay, icon for other files) that open:
  image -> in-app fullscreen zoom preview, video -> in-app player,
  other -> system DownloadManager.

Bot conversations keep their chat-bubble UI and typing indicator.

Reuses the HE fullscreen preview/player composables, VideoDownloadState,
ConversationStatusBadge, and AttachmentType. Adds video download + auth
header to the unified ViewModel, injects ReaderFileDownloadManager in the
Activity, and derives an attachment type on UnifiedAttachment.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Adapts repository tests to the WpRequestResult.UnknownError statusCode
type change (UShort -> UInt).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Wires attachment uploads into the unified conversation reply endpoint,
which now accepts multipart attachments like HE replies. The reply
bottom sheet gets the same screenshot picker and app logs switch as the
HE reply sheet, with the form state held in the ViewModel so drafts
survive configuration changes and failed sends.

Extracts the attachment size validation from HESupportViewModel into a
shared AttachmentStateValidator used by both flows, and removes the
now-unused attachmentsEnabled/appLogsEnabled flags from
TicketMainContentView.

Like HE replies, the app logs switch is UI-only until the RS layer
supports encrypted log ids for replies.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Bumps wordpress-rs to 1379-919351b, which adds encryptedLogIds to
ReplyToUnifiedConversationParams. The Include app logs switch in the
unified reply form now encrypts and uploads the app logs and sends the
resulting UUIDs with the reply, matching the HE new-ticket flow.

Extracts the log upload logic from HESupportViewModel into a shared
EncryptedAppLogsUploader used by both flows.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
New bot conversations in the unified screen now show the Ask the Bots
welcome header (reused from AIBotConversationDetailScreen), and the
first bot reply no longer drops the optimistic user question - the
create endpoint only returns the bot messages, so local messages are
kept like the Ask the Bots flow does.

Bot conversations are labeled Oddie bot in the list pill and above bot
message bubbles, with the pill using the same soft green as the user
chat bubble.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Removes the old Ask the Bots (support/aibot) and Ask the Happiness
Engineers (support/he) screens, superseded by the unified conversations
section, now titled "Get help". HE ticket creation is removed: bot
conversations get escalated to HE server-side and then show up as HE
conversations in the combined list.

- Moves the shared models, utils, and UI components from the he/aibot
  packages into support/unified (attachment state/validation, encrypted
  logs uploader, temp attachments, fullscreen attachment previews,
  status badge, ticket content view, relative time formatting).
- Merges bot conversation creation into UnifiedSupportRepository,
  mapping the bot endpoint response directly to UnifiedConversation and
  dropping the BotConversation/BotMessage models.
- Trims the main Support screen to a single Get help option and updates
  its strings, removing the now-unused activity registrations and
  ai_bot_/he_support_ strings.
- Replaces the deleted tests with UnifiedSupportRepositoryTest and
  AttachmentStateValidatorTest, and updates SupportViewModelTest.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Removes leftovers flagged in review: the dead NavigateToNewConversation
navigation path, the unused nullable create-conversation callback in the
shared list components, the duplicate video cache cleanup, and unread
model fields (UnifiedMessage.rawText, UnifiedAttachment.size).

Simplifies the detail screen by passing the authorization header as a
plain string instead of threading a getter lambda through the composable
layers, deduplicates the reply sheet dismiss logic, and reuses the
shared back/send strings and the Uri.fileSize() extension instead of
local duplicates.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Consolidated combined-conversations build; no API adaptations needed.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- Recalculate the attachment total size when removing an attachment so
  the size meter stays accurate
- Surface conversation list API errors as the Error state instead of
  rendering an empty list
- Preserve the bot chat input across configuration changes
- Derive the scroll-to-bottom index from the conversation data instead
  of potentially stale lazy list layout info

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@dangermattic

dangermattic commented Jun 5, 2026

Copy link
Copy Markdown
Collaborator
1 Error
🚫 This PR includes a PR version of wordpress-rs (1288-85a8554663835627ec1980dabd91166ce71bf270). Please merge the corresponding wordpress-rs PR and update to a trunk version before merging.
2 Warnings
⚠️ View files have been modified, but no screenshot or video is included in the pull request. Consider adding some for clarity.
⚠️ This PR is larger than 300 lines of changes. Please consider splitting it into smaller PRs for easier and faster reviews.
1 Message
📖 This PR is still a Draft: some checks will be skipped.

Generated by 🚫 Danger

@wpmobilebot

wpmobilebot commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

App Icon📲 You can test the changes from this Pull Request in WordPress Android by scanning the QR code below to install the corresponding build.

App NameWordPress Android
Build TypeDebug
Versionpr22946-fe454c4
Build Number1493
Application IDorg.wordpress.android.prealpha
Commitfe454c4
Installation URL63uavjerh9gro
Automatticians: You can use our internal self-serve MC tool to give yourself access to those builds if needed.

@wpmobilebot

wpmobilebot commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

App Icon📲 You can test the changes from this Pull Request in Jetpack Android by scanning the QR code below to install the corresponding build.

App NameJetpack Android
Build TypeDebug
Versionpr22946-fe454c4
Build Number1493
Application IDcom.jetpack.android.prealpha
Commitfe454c4
Installation URL4mbolcrsu9fmo
Automatticians: You can use our internal self-serve MC tool to give yourself access to those builds if needed.

@wpmobilebot

wpmobilebot commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

🤖 Build Failure Analysis

This build has failures. Claude has analyzed them - check the build annotations for details.

…combined-conversations-support

# Conflicts:
#	WordPress/src/main/java/org/wordpress/android/ui/postsrs/data/WpServiceProvider.kt
#	WordPress/src/test/java/org/wordpress/android/support/aibot/repository/AIBotSupportRepositoryTest.kt
#	WordPress/src/test/java/org/wordpress/android/support/he/repository/HESupportRepositoryTest.kt
#	gradle/libs.versions.toml
@wpmobilebot

wpmobilebot commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

Project manifest changes for WordPress

The following changes in the WordPress's merged AndroidManifest.xml file were detected (build variant: jetpackRelease):

--- ./build/reports/diff_manifest/WordPress/jetpackRelease/base_manifest.txt	2026-06-08 10:57:15.524394374 +0000
+++ ./build/reports/diff_manifest/WordPress/jetpackRelease/head_manifest.txt	2026-06-08 10:57:20.444419740 +0000
@@ -729,11 +729,6 @@
             android:label="@string/subscribers"
             android:theme="@style/WordPress.NoActionBar" />
         <activity
-            android:name="org.wordpress.android.support.aibot.ui.AIBotSupportActivity"
-            android:label="@string/ai_bot_conversations_title"
-            android:theme="@style/WordPress.NoActionBar"
-            android:windowSoftInputMode="adjustResize" />
-        <activity
             android:name="org.wordpress.android.support.main.ui.SupportActivity"
             android:label="@string/support_screen_title"
             android:theme="@style/WordPress.NoActionBar" />
@@ -742,8 +737,8 @@
             android:label="@string/support_screen_application_logs_title"
             android:theme="@style/WordPress.NoActionBar" />
         <activity
-            android:name="org.wordpress.android.support.he.ui.HESupportActivity"
-            android:label="@string/support_screen_title"
+            android:name="org.wordpress.android.support.unified.ui.UnifiedSupportActivity"
+            android:label="@string/unified_support_conversations_title"
             android:theme="@style/WordPress.NoActionBar"
             android:windowSoftInputMode="adjustResize" /> <!-- Reader Activities -->
         <activity

Go to https://buildkite.com/automattic/wordpress-android/builds/26752/canvas?sid=019ea6d8-62c7-4014-9c5e-cacd900f8bb9, click on the Artifacts tab and audit the files.

@wpmobilebot

wpmobilebot commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

Project manifest changes for WordPress

The following changes in the WordPress's merged AndroidManifest.xml file were detected (build variant: wordpressRelease):

--- ./build/reports/diff_manifest/WordPress/wordpressRelease/base_manifest.txt	2026-06-08 10:55:33.498021006 +0000
+++ ./build/reports/diff_manifest/WordPress/wordpressRelease/head_manifest.txt	2026-06-08 10:55:38.288062811 +0000
@@ -541,11 +541,6 @@
             android:label="@string/subscribers"
             android:theme="@style/WordPress.NoActionBar" />
         <activity
-            android:name="org.wordpress.android.support.aibot.ui.AIBotSupportActivity"
-            android:label="@string/ai_bot_conversations_title"
-            android:theme="@style/WordPress.NoActionBar"
-            android:windowSoftInputMode="adjustResize" />
-        <activity
             android:name="org.wordpress.android.support.main.ui.SupportActivity"
             android:label="@string/support_screen_title"
             android:theme="@style/WordPress.NoActionBar" />
@@ -554,8 +549,8 @@
             android:label="@string/support_screen_application_logs_title"
             android:theme="@style/WordPress.NoActionBar" />
         <activity
-            android:name="org.wordpress.android.support.he.ui.HESupportActivity"
-            android:label="@string/support_screen_title"
+            android:name="org.wordpress.android.support.unified.ui.UnifiedSupportActivity"
+            android:label="@string/unified_support_conversations_title"
             android:theme="@style/WordPress.NoActionBar"
             android:windowSoftInputMode="adjustResize" /> <!-- Deep Linking Activity -->
         <activity

Go to https://buildkite.com/automattic/wordpress-android/builds/26752/canvas?sid=019ea6d8-62c5-447b-bf8a-03bfc7e029ec, click on the Artifacts tab and audit the files.

@wpmobilebot

Copy link
Copy Markdown
Contributor

Project dependencies changes

list
! Upgraded Dependencies
rs.wordpress.api:android:1288-85a8554663835627ec1980dabd91166ce71bf270, (changed from 0.4.0)
rs.wordpress.api:kotlin:1288-85a8554663835627ec1980dabd91166ce71bf270, (changed from 0.4.0)
tree
 +--- project :libs:fluxc
-|    \--- rs.wordpress.api:android:0.4.0
-|         +--- com.squareup.okhttp3:okhttp:5.3.2 (*)
-|         +--- com.squareup.okhttp3:okhttp-tls:5.3.2
-|         |    +--- com.squareup.okhttp3:okhttp:5.3.2 (*)
-|         |    +--- com.squareup.okio:okio:3.16.4 (*)
-|         |    \--- org.jetbrains.kotlin:kotlin-stdlib:2.2.21 -> 2.3.21 (*)
-|         +--- net.java.dev.jna:jna:5.18.1
-|         +--- rs.wordpress.api:kotlin:0.4.0
-|         |    +--- com.squareup.okhttp3:okhttp:5.3.2 (*)
-|         |    +--- com.squareup.okhttp3:okhttp-tls:5.3.2 (*)
-|         |    +--- org.jetbrains.kotlinx:kotlinx-coroutines-core:1.10.2 -> 1.11.0 (*)
-|         |    \--- org.jetbrains.kotlin:kotlin-stdlib:2.1.21 -> 2.3.21 (*)
-|         \--- org.jetbrains.kotlin:kotlin-stdlib:2.1.21 -> 2.3.21 (*)
+|    \--- rs.wordpress.api:android:1288-85a8554663835627ec1980dabd91166ce71bf270
+|         +--- com.squareup.okhttp3:okhttp:5.3.2 (*)
+|         +--- com.squareup.okhttp3:okhttp-tls:5.3.2
+|         |    +--- com.squareup.okhttp3:okhttp:5.3.2 (*)
+|         |    +--- com.squareup.okio:okio:3.16.4 (*)
+|         |    \--- org.jetbrains.kotlin:kotlin-stdlib:2.2.21 -> 2.3.21 (*)
+|         +--- net.java.dev.jna:jna:5.18.1
+|         +--- rs.wordpress.api:kotlin:1288-85a8554663835627ec1980dabd91166ce71bf270
+|         |    +--- com.squareup.okhttp3:okhttp:5.3.2 (*)
+|         |    +--- com.squareup.okhttp3:okhttp-tls:5.3.2 (*)
+|         |    +--- org.jetbrains.kotlinx:kotlinx-coroutines-core:1.10.2 -> 1.11.0 (*)
+|         |    \--- org.jetbrains.kotlin:kotlin-stdlib:2.1.21 -> 2.3.21 (*)
+|         \--- org.jetbrains.kotlin:kotlin-stdlib:2.1.21 -> 2.3.21 (*)
-\--- rs.wordpress.api:android:0.4.0 (*)
+\--- rs.wordpress.api:android:1288-85a8554663835627ec1980dabd91166ce71bf270 (*)

adalpari and others added 5 commits June 5, 2026 15:00
- Extract the bottom bar and attachment preview overlay into their own
  composables so UnifiedConversationDetailScreen stays under the
  cyclomatic complexity threshold
- Remove stale translations of the support strings deleted by the
  consolidation, fixing the ExtraTranslation lint errors

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Covers repository initialization, reply sending (success, failure
rollback, offline, app logs, attachments and temp file cleanup), new
bot conversation creation, reply form state, video downloads with
caching, and encrypted log uploads.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…evalidation

- Derive scroll-to-bottom from layoutInfo.totalItemsCount via snapshotFlow
  instead of hardcoded header/typing/spacer counts
- Set _isSendingReply synchronously before launching to close the concurrent
  send race
- Use ConcurrentHashMap for the video cache (accessed from IO coroutines and
  onCleared)
- Revalidate rejected attachments in a single pass so the form state is
  published only once
- Document the intentionally-empty bot top-bar title

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Fixes the AutoboxingStateCreation lint warning in TypingDot.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants