Skip to content

fix: bot user presence goes offline when updating a private app#40888

Open
abhinavkrin wants to merge 5 commits into
developfrom
fix/bot-presence-offline-on-private-app-update
Open

fix: bot user presence goes offline when updating a private app#40888
abhinavkrin wants to merge 5 commits into
developfrom
fix/bot-presence-offline-on-private-app-update

Conversation

@abhinavkrin

@abhinavkrin abhinavkrin commented Jun 11, 2026

Copy link
Copy Markdown
Member

Proposed changes (including videos or screenshots)

During a private app update, AppManager.update() calls disable() before loading the new version. This disable was non-silent, causing it to invoke doAppStatusChangedupdateStatusByAppId, which set the bot user's presence to Offline. The subsequent re-enable path (updateAndStartupLocal) already passed silenceStatus = true, so the bridge was never called again to restore the presence to Online.

The fix passes silent = true to the disable() call inside update(), so the activation bridge is never triggered during the transient teardown step. The bot's presence is never touched during an update.

Issue(s)

Steps to test or reproduce

  1. Install a private app that has a bot user
  2. Confirm the bot user presence is Online
  3. Upload a new version of the same private app
  4. Verify the bot user presence remains Online after the update completes

Further comments

SUP-1054

Summary by CodeRabbit

  • Bug Fixes
    • Fixed an issue where an app bot user's presence status was incorrectly displayed as Offline after updating an app.

Signed-off-by: Abhinav Kumar <abhinav@avitechlab.com>
Signed-off-by: Abhinav Kumar <abhinav@avitechlab.com>
@dionisio-bot

dionisio-bot Bot commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Looks like this PR is not ready to merge, because of the following issues:

  • This PR is missing the 'stat: QA assured' label

Please fix the issues and try again

If you have any trouble, please check the PR guidelines

@changeset-bot

changeset-bot Bot commented Jun 11, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 96aea1c

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

This PR includes changesets to release 1 package
Name Type
@rocket.chat/apps 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

coderabbitai Bot commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: f54acd39-6ff5-4c58-ad0e-e8555057674e

📥 Commits

Reviewing files that changed from the base of the PR and between e0ad353 and 96aea1c.

⛔ Files ignored due to path filters (1)
  • apps/meteor/tests/data/apps/app-packages/app-update-test_0.0.1.zip is excluded by !**/*.zip
📒 Files selected for processing (2)
  • apps/meteor/tests/data/apps/app-packages/index.ts
  • apps/meteor/tests/end-to-end/apps/apps-update.ts
📜 Recent review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
  • GitHub Check: cubic · AI code reviewer
  • GitHub Check: 📦 Build Packages
  • GitHub Check: Hacktron Security Check
  • GitHub Check: CodeQL-Build
  • GitHub Check: CodeQL-Build
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{ts,tsx,js}

📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)

**/*.{ts,tsx,js}: Write concise, technical TypeScript/JavaScript with accurate typing in Playwright tests
Avoid code comments in the implementation

Files:

  • apps/meteor/tests/data/apps/app-packages/index.ts
  • apps/meteor/tests/end-to-end/apps/apps-update.ts
🧠 Learnings (5)
📚 Learning: 2026-02-26T19:25:44.063Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 38778
File: packages/ui-voip/src/providers/useMediaSession.ts:192-192
Timestamp: 2026-02-26T19:25:44.063Z
Learning: In the Rocket.Chat repository, do not reference Biome lint rules in code review feedback. Biome is not used even if biome.json exists; only reference Biome rules if there is explicit, project-wide usage documented. For TypeScript files, review lint implications without Biome guidance unless the project enables Biome rules.

Applied to files:

  • apps/meteor/tests/data/apps/app-packages/index.ts
  • apps/meteor/tests/end-to-end/apps/apps-update.ts
📚 Learning: 2026-02-26T19:25:44.063Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 38778
File: packages/ui-voip/src/providers/useMediaSession.ts:192-192
Timestamp: 2026-02-26T19:25:44.063Z
Learning: In this repository (RocketChat/Rocket.Chat), Biome lint rules are not used even if a biome.json exists. When reviewing TypeScript files (e.g., packages/ui-voip/src/providers/useMediaSession.ts), ensure lint suggestions do not reference Biome-specific rules. Rely on general ESLint/TypeScript lint rules and project conventions instead.

Applied to files:

  • apps/meteor/tests/data/apps/app-packages/index.ts
  • apps/meteor/tests/end-to-end/apps/apps-update.ts
📚 Learning: 2026-05-06T12:21:44.083Z
Learnt from: juliajforesti
Repo: RocketChat/Rocket.Chat PR: 40256
File: apps/meteor/client/components/CreateDiscussion/CreateDiscussion.tsx:121-149
Timestamp: 2026-05-06T12:21:44.083Z
Learning: Field wrappers in rocket.chat/fuselage-forms (Field, FieldLabel, FieldRow, FieldError, FieldHint) auto-create htmlFor/id associations, aria-describedby, and role="alert" for errors. Do not manually set htmlFor, id, aria-describedby, or role attributes when using these wrappers. This automatic wiring does not apply to plain rocket.chat/fuselage components, which require explicit ID wiring per the accessibility docs. In code reviews, prefer using fuselage-forms wrappers for form fields and verify there is no unnecessary manual ID/aria wiring in files that use these wrappers. If a component uses plain fuselage components, ensure proper id wiring as per docs.

Applied to files:

  • apps/meteor/tests/data/apps/app-packages/index.ts
  • apps/meteor/tests/end-to-end/apps/apps-update.ts
📚 Learning: 2026-02-04T12:08:56.950Z
Learnt from: d-gubert
Repo: RocketChat/Rocket.Chat PR: 38374
File: apps/meteor/tests/end-to-end/apps/app-logs-nested-requests.ts:26-37
Timestamp: 2026-02-04T12:08:56.950Z
Learning: In the E2E tests under apps/meteor/tests/end-to-end/apps, prefer using a fixed sleep (e.g., 1s) instead of implementing polling or retry logic when waiting for asynchronous operations to complete. Tests should fail deterministically if the expected result isn't available after the sleep.

Applied to files:

  • apps/meteor/tests/end-to-end/apps/apps-update.ts
📚 Learning: 2026-03-16T11:50:11.087Z
Learnt from: ricardogarim
Repo: RocketChat/Rocket.Chat PR: 39657
File: apps/meteor/tests/end-to-end/apps/app-resolve-visitor.ts:18-21
Timestamp: 2026-03-16T11:50:11.087Z
Learning: In end-to-end tests under apps/meteor/tests/end-to-end/apps, there is an established pattern: call createAgent() and makeAgentAvailable() immediately after updateSetting('Livechat_enabled', true) with no intermediate delay. Do not flag this sequence as a race condition or require a sleep/delay. This pattern is used across 10+ tests in the codebase.

Applied to files:

  • apps/meteor/tests/end-to-end/apps/apps-update.ts
🔇 Additional comments (2)
apps/meteor/tests/data/apps/app-packages/index.ts (1)

13-14: LGTM!

apps/meteor/tests/end-to-end/apps/apps-update.ts (1)

1-42: LGTM!


Walkthrough

AppManager.update now calls this.disable with explicit AppStatus.DISABLED and silent=true during the pre-update disabling step. A new E2E test suite installs a test app package, verifies the app bot user is online, performs an update, and asserts the status remains online. A patch changeset entry records the fix.

Changes

App Presence After Update Fix

Layer / File(s) Summary
Silent disable with explicit status during app update
packages/apps/src/server/AppManager.ts, .changeset/itchy-years-learn.md
AppManager.update passes AppStatus.DISABLED and silent=true to this.disable instead of calling it with defaults; changeset records this as a patch fix for app bot presence.
E2E test: app update preserves user presence
apps/meteor/tests/data/apps/app-packages/index.ts, apps/meteor/tests/end-to-end/apps/apps-update.ts
Exports appUpdateTest fixture path and adds a Mocha suite that installs the test app, asserts the app user is online, triggers an update via POST, and re-asserts online status (EE-only).

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 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 describes the main fix: ensuring bot user presence remains online during private app updates by passing silent flag to disable().
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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

Warning

Review ran into problems

🔥 Problems

Errors were encountered while retrieving linked issues.

Errors (1)
  • SUP-1054: Request failed with status code 401

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.

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No issues found across 2 files

Re-trigger cubic

@codecov

codecov Bot commented Jun 11, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 70.13%. Comparing base (6bd9182) to head (96aea1c).
⚠️ Report is 12 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop   #40888      +/-   ##
===========================================
+ Coverage    69.94%   70.13%   +0.19%     
===========================================
  Files         3353     3355       +2     
  Lines       128812   129244     +432     
  Branches     22274    22403     +129     
===========================================
+ Hits         90092    90648     +556     
+ Misses       35431    35300     -131     
- Partials      3289     3296       +7     
Flag Coverage Δ
unit 70.09% <ø> (+0.26%) ⬆️

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.

julio-rocketchat and others added 2 commits June 11, 2026 15:29
Signed-off-by: Abhinav Kumar <abhinav@avitechlab.com>
@abhinavkrin abhinavkrin requested a review from a team as a code owner June 12, 2026 08:08
before((done) => getCredentials(done));

before(async () => {
await cleanupApps();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

curious: instead of cleaning, can we check if the app is installed to avoid re-installing? 👀

@@ -0,0 +1,5 @@
---
'@rocket.chat/apps': patch

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

should we include the @rocket.chat/meteor too?

@nazabucciarelli nazabucciarelli added this to the 8.6.0 milestone Jun 12, 2026
@nazabucciarelli

Copy link
Copy Markdown
Contributor

just as a side suggestion, wouldn't it be better to create a more generic suite named apps-update.ts (as we already have installation.ts and apps-uninstall.ts) just to follow the same pattern and add this new test case there? I think it would be better since the issue is intrinsically related to app update, and we can also use it in the future for adding further test cases there.

@d-gubert d-gubert left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Hey, have you tried this with multi instance? I think making the update silent will have a problematic effect in such setups.

I'll do some testing and check back here.

Signed-off-by: Abhinav Kumar <abhinav@avitechlab.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.

5 participants