Skip to content

feat(messaging): action messages history & SMS composer [WIP] - #1900

Open
nmajor25 wants to merge 28 commits into
developfrom
messaging-v1
Open

nmajor25 wants to merge 28 commits into
developfrom
messaging-v1

Conversation

@nmajor25

@nmajor25 nmajor25 commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Messaging v1, only active when the org has messaging_enabled (and the workspace hasn't turned it off).

  • Message actions (options.embed: compose) show the patient's texts above Activity.
  • Paper-plane button on the action header and worklist/workflow/flow cards jumps to the texts.
  • Composer on message actions and the Interactions page sends SMS to the patient's mobile number

Screengrabs:

Screenshot 2026-11-18 at 2 46 31 PM Screenshot 2026-11-18 at 2 46 45 PM

To do still:

  • Make sure changes match design & claude prototype
  • Handle opted-out & do not contact state in the composer
  • Message history UI loading states
  • Code cleanup where applicable
  • Full code coverage

When the organization has messaging_enabled and the workspace hasn't turned it off, a message action (options.embed: compose) shows the patient's SMS history above Activity. Texts are grouped by day, newest at the bottom, with a button to load earlier texts. Upcoming scheduled texts from other actions are hidden. Activity on message actions leaves out SMS.

No live updates yet (websockets are a follow-up).
On message actions with Messaging on, a paper-plane button next to the action name focuses the Messages section. The same button on worklist, workflow and flow cards opens the action at its Messages section, like the attachment and comment buttons. Icon only; no count yet.
A message action shows a New Message composer under its texts, addressed to the patient's mobile number (the first phone labeled mobile). Send posts an outbound SMS interaction linked to the action. The card appears right away as "Sending…", then shows the sent time; if the request fails it stays as "Not sent" with "Message could not be sent." The composer is hidden when the patient has no mobile number, and a failed phone lookup still shows the history.
When Messaging is on and the patient has a mobile number, the Interactions page shows the New Message composer under the timeline. Texts sent there have no action. The card shows "Sending…", then the sent time, or "Not sent" with "Message could not be sent." If the timeline isn't on the newest texts or Messages is filtered out, sending turns Messages back on and loads the newest texts first; if that load fails, the text stays in the composer and isn't sent.

The shared interaction card gains the send states, and unsaved cards are never treated as selected.
@nmajor25 nmajor25 added the Don't Merge Don't even think about it. label Nov 17, 2026
@coderabbitai

coderabbitai Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

Important

  • Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 7a43b615-3067-4a9c-ba0f-71068ffd9d58
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@nmajor25 nmajor25 added WIP Work in progress and removed Don't Merge Don't even think about it. labels Nov 17, 2026

@cubic-dev-ai cubic-dev-ai 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.

All reported issues were addressed across 37 files

Shadow auto-approve: would not auto-approve because issues were found.
Tip: Get a Slack DM when cubic finishes reviewing your PRs. Connect Slack

View guided diff | Turn on auto-fix | Re-trigger cubic

Comment thread src/scss/domain/action-card.scss Resolved
@cypress

cypress Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

RoundingWell Care Ops Frontend    Run #9396

Run Properties:  status check failed Failed #9396  •  git commit 21ed29e747: feat(messaging): show the Messages button on Schedule list actions
Project RoundingWell Care Ops Frontend
Branch Review messaging-v1
Run status status check failed Failed #9396
Run duration 02m 24s
Commit git commit 21ed29e747: feat(messaging): show the Messages button on Schedule list actions
Committer nmajor25
View all properties for this run ↗︎

Test results
Tests that failed  Failures 1
Tests that were flaky  Flaky 0
Tests that did not run due to a developer annotating a test with .skip  Pending 0
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 397
View all changes introduced in this branch ↗︎

Tests for review

Failed  src/js/services/modal/modal.e2e.cy.js • 1 failed test • care-ops-e2e

View Output

Test Artifacts
Modal Service > Displaying Test Replay Screenshots

@coveralls

coveralls commented Nov 18, 2026 •

Copy link
Copy Markdown

Coverage Report for CI Build 9

Coverage decreased (-0.02%) to 99.983%

Details

  • Coverage decreased (-0.02%) from the base build.
  • Patch coverage: 262 of 262 lines across 19 files are fully covered (100%).
  • No coverage regressions found.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 8292
Covered Lines: 8292
Line Coverage: 100.0%
Relevant Branches: 3287
Covered Branches: 3285
Branch Coverage: 99.94%
Branches in Coverage %: Yes
Coverage Strength: 499.64 hits per line

💛 - Coveralls

@cubic-dev-ai cubic-dev-ai 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.

1 issue found across 7 files (changes from recent commits).

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="src/js/apps/patients/patient/interactions/interactions.e2e.cy.js">

<violation number="1" location="src/js/apps/patients/patient/interactions/interactions.e2e.cy.js:4966">
P2: This test releases the held filter response only after observing the POST, so it still passes if sending does not wait for the pending filter load. Assert `@routePostInteraction.all` has length 0 before releasing the filter, then wait for the POST afterward.</violation>
</file>

Shadow auto-approve: would not auto-approve because issues were found.

View guided diff | Turn on auto-fix | Re-trigger cubic

@cubic-dev-ai cubic-dev-ai 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.

All reported issues were addressed across 10 files (changes from recent commits).

Shadow auto-approve: would not auto-approve because issues were found.
Tip: Review your code locally with the cubic CLI to iterate faster.

View guided diff | Turn on auto-fix | Re-trigger cubic

Cards from another action link with the action name and an arrow, like
the prototype. View on Interactions is removed from the cards.
A text that is still sending fades in on the message action and the
Interactions page, unless reduced motion is on. Message history now
updates in place so earlier cards keep their views instead of being
rebuilt on every send.
Shows the title, "All messages with" the patient, the date of the top
day, and View on Interactions, which opens this action's newest sent or
received text on the Interactions page.
Texts over 900 characters are clamped to four lines with Show more,
using the same rule as long call notes on the Interactions page.
The header and day divider pills open the same jump menu as the
Interactions page, loading older texts as needed. The date control
moves to shared/interactions with its own styles. Older loads disable
Show earlier messages and keep texts sent while they run.

@cubic-dev-ai cubic-dev-ai 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.

All reported issues were addressed across 16 files (changes from recent commits).

Shadow auto-approve: would not auto-approve because issues were found.

View guided diff | Turn on auto-fix | Re-trigger cubic

Remove the fade-in class when its animation ends so later renders of
the card can't replay it.
@nmajor25 nmajor25 added the Don't Merge Don't even think about it. label Nov 18, 2026

@cubic-dev-ai cubic-dev-ai 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.

0 issues found across 11 files (changes from recent commits).

Shadow auto-approve: would require human review. Adds a feature-flagged SMS messaging history and composer to action pages and Interactions, with paper-plane entry points. Declined: WIP/Don't Merge and new outbound SMS with unresolved dismissed findings around consent and UI correctness.

View guided diff | Turn on auto-fix | Re-trigger cubic

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Keep an unsent text for the browser session:

  • If you type a text and leave the page, the text is still there when you come back.
  • Each patient has its own saved text, and the action page and the Interactions page keep theirs separately.
    • The text is saved in session storage under messaging-composer:["<clinicianId>_<workspaceId>","<patientId>","<actionId>"]. On Interactions, actionId is null.
  • Sending a text clears it, and closing the browser tab clears it too.
  • If a text fails to send, it shows as failed in the conversation and isn't kept in the box. If Interactions can't load the latest texts before sending, the text goes back into the box and stays saved.

if (!contains(this.window.models, model)) return;

this.showModels(this.window.models);
},

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Summary of the websocket messages being handled:

Message What we do
ResourceCreated (text only) Load the newest 25 texts and add any new ones. If a load is already running or a text is sending, wait and load once after
InteractionCompleted Move the text to its sent time. Ignore it if we haven't loaded that text yet (a new reply also sends this)
InteractionScheduled Move the text to its new time
MetadataUpdated Update the card (delivery failure, or its action link). The text may also show or hide, since another action's scheduled texts stay hidden
InteractionCancelled Update the card to show "Cancelled". Another action's scheduled text is hidden until it's cancelled, then it shows
ResourceDeleted Remove the card, and keep the text hidden even if a load that's already running returns it (also for a text not shown yet)

@cubic-dev-ai cubic-dev-ai 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.

1 issue found across 3 files (changes from recent commits).

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="src/js/apps/patients/patient/action/messages/messages_app.js">

<violation number="1" location="src/js/apps/patients/patient/action/messages/messages_app.js:56">
P2: This subscription starts only after the initial window and phone requests finish, so an SMS arriving during startup can be missed permanently. Subscribe before starting those requests (and retain the existing teardown) so startup events are reconciled.</violation>
</file>

Shadow auto-approve: would not auto-approve because issues were found.

View guided diff | Turn on auto-fix | Re-trigger cubic

@cubic-dev-ai cubic-dev-ai 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.

All reported issues were addressed across 7 files (changes from recent commits).

Shadow auto-approve: would not auto-approve because issues were found.

View guided diff | Turn on auto-fix | Re-trigger cubic

@cubic-dev-ai cubic-dev-ai 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.

0 issues found across 1 file (changes from recent commits).

Shadow auto-approve: would not auto-approve. Auto-approval blocked by 1 unresolved issue from previous reviews.

View guided diff | Turn on auto-fix | Re-trigger cubic

Message history, the paper-plane icon and hiding texts from Activity now follow the program action's `message` tag instead of `options.embed: compose`, and show even when messaging is off. The composer still needs `messaging_enabled` and a mobile phone.
…ile phone

With messaging on and no mobile phone, the composer shows disabled on the action page and Interactions: the reason replaces the placeholder, the To line is hidden, and a saved draft stays in session storage until a mobile phone is added. When phones fail to load there's still no composer.
The history fixtures started at midnight UTC, so the newest one showed Jul 18 instead of Jul 19 west of UTC and the date test only passed on CI. Start them at noon UTC.

@cubic-dev-ai cubic-dev-ai 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.

0 issues found across 10 files (changes from recent commits).

Shadow auto-approve: would not auto-approve. Auto-approval blocked by 1 unresolved issue from previous reviews.

View guided diff | Turn on auto-fix | Re-trigger cubic

@nmajor25
nmajor25 requested a review from paulfalgout November 20, 2026 20:55
Drop ComposerView.restore and InteractionsPageView.restoreComposer; the Interactions app sets the draft body itself. Use getAction() in isShownInHistory to match the rest of Messages.

@cubic-dev-ai cubic-dev-ai 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.

0 issues found across 4 files (changes from recent commits).

Shadow auto-approve: would require human review. Adds feature-flagged SMS history/composer to action pages, Interactions, and workflow/flow cards. Declined: WIP/Don't Merge, new outbound SMS with consent/opt-out unfinished, and unresolved dismissed findings still need human sign-off.

View guided diff | Turn on auto-fix | Re-trigger cubic

- Inline single-use helpers in messages_views and messages_app
- Build group keys once per day list and compare neighbors with isEqual
- Rename shadowed `window` locals to initial/older/newest
- Put multi-entry objects on one entry per line
- Remove inline comments
- Check Messages button navigation and focus in workflow, flow and worklist specs
- Check untagged actions have no Messages button on each page and the action title
- Move the action title button check into the message history test
- Show the paper-plane button on actions tagged message, matching the Worklist
- Open the action at its Messages section when clicked
- Keep the button from shrinking next to long action names

@cubic-dev-ai cubic-dev-ai 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.

All reported issues were addressed across 10 files (changes from recent commits).

Shadow auto-approve: would not auto-approve because issues were found.

View guided diff | Turn on auto-fix | Re-trigger cubic

This branch has not been deployed

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

Labels

Don't Merge Don't even think about it. WIP Work in progress

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants