Skip to content

Conversation

@d-gubert
Copy link
Member

@d-gubert d-gubert commented Jan 19, 2026

Proposed changes (including videos or screenshots)

Fixes an issue where the slashcommand list may remain stale during a rolling restart in multi instances environments (microservices or HA).

This affects especially multi instances environments because the web client might start a websocket connection to one instance and try to fetch the list from another instance where apps are not loaded yet. This causes a problem because the server that has the websocket connection will not emit an apps/command.added event that prompts the client to make a new request to get new slashcommands.

One situation that I couldn't cover is: if the slash command list is refreshed while the user has the popup box open over the composer, then the items rendered will only be updated if the user interacts with the composer (a couple of keystrokes, sending a message, changing rooms, page reload)

Issue(s)

ARCH-1921

Steps to test or reproduce

Further comments

Summary by CodeRabbit

  • Bug Fixes
    • Fixed an issue where web clients could retain a stale slash command list during rolling workspace updates. Enhanced application loading state management to ensure slash commands are correctly refreshed when applications finish loading, improving reliability during workspace transitions.

✏️ Tip: You can customize this high-level summary in your review settings.

@changeset-bot
Copy link

changeset-bot bot commented Jan 19, 2026

🦋 Changeset detected

Latest commit: ac11d41

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 40 packages
Name Type
@rocket.chat/rest-typings Patch
@rocket.chat/meteor Patch
@rocket.chat/api-client Patch
@rocket.chat/core-services Patch
@rocket.chat/ddp-client Patch
@rocket.chat/http-router Patch
@rocket.chat/models Patch
@rocket.chat/ui-contexts Patch
@rocket.chat/web-ui-registration Patch
@rocket.chat/account-service Patch
@rocket.chat/authorization-service Patch
@rocket.chat/ddp-streamer Patch
@rocket.chat/federation-matrix Patch
@rocket.chat/omnichannel-services Patch
@rocket.chat/presence Patch
rocketchat-services Patch
@rocket.chat/omnichannel-transcript Patch
@rocket.chat/presence-service Patch
@rocket.chat/queue-worker Patch
@rocket.chat/abac Patch
@rocket.chat/network-broker Patch
@rocket.chat/omni-core-ee Patch
@rocket.chat/livechat Patch
@rocket.chat/mock-providers Patch
@rocket.chat/cron Patch
@rocket.chat/instance-status Patch
@rocket.chat/omni-core Patch
@rocket.chat/ui-client Patch
@rocket.chat/media-calls Patch
@rocket.chat/uikit-playground Patch
@rocket.chat/fuselage-ui-kit Patch
@rocket.chat/gazzodown Patch
@rocket.chat/ui-avatar Patch
@rocket.chat/ui-video-conf Patch
@rocket.chat/ui-voip Patch
@rocket.chat/core-typings Patch
@rocket.chat/apps Patch
@rocket.chat/model-typings Patch
@rocket.chat/license Patch
@rocket.chat/pdf-worker Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 19, 2026

Walkthrough

The PR addresses a race condition where clients receive incomplete slash command lists during rolling workspace updates. It adds an appsLoaded flag to the commands.list endpoint that returns HTTP 202 when apps are still loading, prompting clients to retry via exponential backoff until apps are fully initialized.

Changes

Cohort / File(s) Summary
Changeset Documentation
\.changeset/green-dragons-boil\.md
Documents a patch fix across two packages addressing the stale slash command list issue during workspace updates.
Server API
apps/meteor/app/api/server/v1/commands\.ts
Adds early-return logic when Apps.self is not loaded, returning HTTP 202 with appsLoaded: false and empty commands list. Marks appsLoaded: true when apps are fully loaded in standard success responses.
Type Definitions
packages/rest-typings/src/v1/commands\.ts
Extends the commands.list endpoint response payload with a new appsLoaded: boolean field to indicate app loading state.
Client Hook & Tests
apps/meteor/client/hooks/useAppSlashCommands\.ts,
apps/meteor/client/hooks/useAppSlashCommands\.spec\.tsx
Enables retry logic with randomized backoff in the useQuery hook; throws error when appsLoaded is false to trigger retry behavior. Test suite updated to use centralized query key accessor and validates handling of both loaded and unloaded app states, including non-command event filtering.

Sequence Diagram

sequenceDiagram
    participant Client as Client Hook
    participant API as Commands.list API
    participant Apps as Apps System
    
    rect rgba(100, 150, 200, 0.5)
    Note over Client,Apps: Initial Request (Apps Still Loading)
    Client->>API: GET /v1/commands.list
    API->>Apps: Check if loaded
    Apps-->>API: Not loaded
    API-->>Client: HTTP 202, appsLoaded: false, empty list
    end
    
    rect rgba(150, 150, 100, 0.5)
    Note over Client,Apps: Retry with Exponential Backoff
    Client->>Client: Throw error to trigger retry
    Client->>Client: Wait (randomized backoff)
    end
    
    rect rgba(100, 200, 150, 0.5)
    Note over Client,Apps: Retry Request (Apps Loaded)
    Client->>API: GET /v1/commands.list (retry)
    API->>Apps: Check if loaded
    Apps-->>API: Loaded
    API-->>Client: HTTP 200, appsLoaded: true, commands list
    Client->>Client: Process complete commands
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested labels

stat: ready to merge, stat: QA assured

Suggested reviewers

  • ggazzo
  • tassoevan

Poem

🐰 Apps were loading, clients didn't wait,
Stale commands came in—too late, too late!
Now with retries and a helpful flag,
Fresh slash commands, no more lag! ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the primary change: fixing an issue where the slash command list remains incomplete during startup due to apps not finishing loading.
Linked Issues check ✅ Passed The pull request fully implements the objective from ARCH-1921: the server now returns HTTP 202 with appsLoaded: false when apps are not ready, and clients retry accordingly.
Out of Scope Changes check ✅ Passed All changes directly address the linked issue and PR objectives. Modifications include endpoint behavior, client retry logic, type definitions, and tests—all scoped to slash command list loading.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/slashcommand-list-not-ready

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

Comment @coderabbitai help to get the list of available commands and usage tips.

@dionisio-bot
Copy link
Contributor

dionisio-bot bot commented Jan 19, 2026

Looks like this PR is ready to merge! 🎉
If you have any trouble, please check the PR guidelines

@github-actions
Copy link
Contributor

github-actions bot commented Jan 19, 2026

📦 Docker Image Size Report

➡️ Changes

Service Current Baseline Change Percent
sum of all images 0B 0B 0B
account-service 0B 0B 0B
authorization-service 0B 0B 0B
ddp-streamer-service 0B 0B 0B
omnichannel-transcript-service 0B 0B 0B
presence-service 0B 0B 0B
queue-worker-service 0B 0B 0B
rocketchat 0B 0B 0B

📊 Historical Trend

---
config:
  theme: "dark"
  xyChart:
    width: 900
    height: 400
---
xychart
  title "Image Size Evolution by Service (Last 30 Days + This PR)"
  x-axis ["11/18 22:53", "11/19 23:02", "11/21 16:49", "11/24 17:34", "11/27 22:32", "11/28 19:05", "12/01 23:01", "12/02 21:57", "12/03 21:00", "12/04 18:17", "12/05 21:56", "12/08 20:15", "12/09 22:17", "12/10 23:26", "12/11 21:56", "12/12 22:45", "12/13 01:34", "12/15 22:31", "12/16 22:18", "12/17 21:04", "12/18 23:12", "12/19 23:27", "12/20 21:03", "12/22 18:54", "12/23 16:16", "12/24 19:38", "12/25 17:51", "12/26 13:18", "12/29 19:01", "12/30 20:52", "01/20 16:07 (PR)"]
  y-axis "Size (GB)" 0 --> 0.5
  line "account-service" [0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.00]
  line "authorization-service" [0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.00]
  line "ddp-streamer-service" [0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.00]
  line "omnichannel-transcript-service" [0.14, 0.14, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.00]
  line "presence-service" [0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.00]
  line "queue-worker-service" [0.14, 0.14, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.00]
  line "rocketchat" [0.35, 0.35, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.00]
Loading

Statistics (last 30 days):

  • 📊 Average: 1.5GiB
  • ⬇️ Minimum: 1.4GiB
  • ⬆️ Maximum: 1.6GiB
  • 🎯 Current PR: 0B
ℹ️ About this report

This report compares Docker image sizes from this build against the develop baseline.

  • Tag: pr-38267
  • Baseline: develop
  • Timestamp: 2026-01-20 16:07:39 UTC
  • Historical data points: 30

Updated: Tue, 20 Jan 2026 16:07:39 GMT

@codecov
Copy link

codecov bot commented Jan 19, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 70.73%. Comparing base (a28bc73) to head (ac11d41).
⚠️ Report is 9 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop   #38267      +/-   ##
===========================================
+ Coverage    70.71%   70.73%   +0.02%     
===========================================
  Files         3142     3142              
  Lines       108925   108932       +7     
  Branches     19577    19612      +35     
===========================================
+ Hits         77022    77054      +32     
+ Misses       29902    29879      -23     
+ Partials      2001     1999       -2     
Flag Coverage Δ
e2e 60.33% <25.00%> (+0.03%) ⬆️
e2e-api 49.12% <ø> (+1.05%) ⬆️
unit 71.80% <100.00%> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@d-gubert d-gubert force-pushed the feat/slashcommand-list-not-ready branch from 2efc62a to 685851b Compare January 19, 2026 23:49
@d-gubert d-gubert force-pushed the feat/slashcommand-list-not-ready branch from 5a9a3ab to ac11d41 Compare January 20, 2026 15:50
@d-gubert
Copy link
Member Author

@coderabbitai review

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 20, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@d-gubert d-gubert marked this pull request as ready for review January 20, 2026 16:52
@d-gubert d-gubert requested review from a team as code owners January 20, 2026 16:53
@d-gubert d-gubert added this to the 8.1.0 milestone Jan 20, 2026
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

No issues found across 5 files

@ggazzo ggazzo added the stat: QA assured Means it has been tested and approved by a company insider label Jan 21, 2026
@ggazzo ggazzo merged commit 88da141 into develop Jan 21, 2026
78 of 81 checks passed
@dionisio-bot dionisio-bot bot added the stat: ready to merge PR tested and approved waiting for merge label Jan 21, 2026
@ggazzo ggazzo deleted the feat/slashcommand-list-not-ready branch January 21, 2026 14:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

stat: QA assured Means it has been tested and approved by a company insider stat: ready to merge PR tested and approved waiting for merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants