Skip to content

feat: implement async task routing layer for OpenClaw Rocket.Chat integration#39831

Open
PrinceGautam2106 wants to merge 1 commit into
RocketChat:developfrom
PrinceGautam2106:rockt3
Open

feat: implement async task routing layer for OpenClaw Rocket.Chat integration#39831
PrinceGautam2106 wants to merge 1 commit into
RocketChat:developfrom
PrinceGautam2106:rockt3

Conversation

@PrinceGautam2106
Copy link
Copy Markdown

@PrinceGautam2106 PrinceGautam2106 commented Mar 24, 2026

Adds an async task routing layer to bridge OpenClaw agents with the Rocket.Chat messaging interface. The routing layer handles message ingestion from Rocket.Chat webhooks, queues tasks asynchronously, and dispatches them to the appropriate OpenClaw agent based on channel/room context.
Key changes:

  • Introduced AsyncTaskRouter struct responsible for receiving incoming webhook payloads and routing them to registered OpenClaw agents
  • Added a task queue backed by tokio::mpsc channels to decouple message ingestion from agent processing
  • Implemented retry logic with exponential backoff for failed agent dispatches
  • Added channel-to-agent mapping config (router_config.toml) to define routing rules per Rocket.Chat room/channel
  • Exposed a /webhook/rocketchat HTTP endpoint via axum to receive events

Proposed changes

  • Clone the branch and run cargo build — should compile with no errors or warnings
  • Copy router_config.example.toml to router_config.toml and fill in your Rocket.Chat webhook token and agent mappings
  • Start the server: cargo run -- bin mofa-rocketchat
  • Send a POST request to http://localhost:8080/webhook/rocketchat with a sample Rocket.Chat webhook payload
  • Verify the task appears in agent logs and a reply is sent back to the originating room
Screen.Recording.2026-03-09.215814.mp4

Summary by CodeRabbit

  • Bug Fixes

    • Refined account deletion workflow with clearer, in-form error messaging when invalid passwords are provided
    • Improved password field validation with better error display and enhanced accessibility features during account management operations
  • New Features

    • Added OpenClaw async task routing and queuing support for omnichannel integrations

@PrinceGautam2106 PrinceGautam2106 requested review from a team as code owners March 24, 2026 06:56
@dionisio-bot
Copy link
Copy Markdown
Contributor

dionisio-bot Bot commented Mar 24, 2026

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

  • This PR has conflicts, please resolve them before merging
  • This PR is missing the 'stat: QA assured' label
  • This PR is not mergeable
  • This PR is missing the required milestone or project

Please fix the issues and try again

If you have any trouble, please check the PR guidelines

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Mar 24, 2026

⚠️ No Changeset found

Latest commit: af8be9a

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Mar 24, 2026

Walkthrough

This PR refactors the account deletion UI to use react-hook-form with improved error handling in ActionConfirmModal, updates related page objects and tests to use a new DeleteAccountModal fragment, and adds OpenClaw async task support to omnichannel integration services with route validation and task queueing.

Changes

Cohort / File(s) Summary
Account Deletion UI Refactoring
apps/meteor/client/views/account/profile/AccountProfilePage.tsx, apps/meteor/client/views/account/profile/ActionConfirmModal.tsx
AccountProfilePage now clears the modal before logout on successful account deletion and re-throws invalid-password errors; ActionConfirmModal refactored to use react-hook-form with field-level error display for invalid passwords and improved accessibility attributes (aria-invalid, aria-required, aria-describedby).
Account Deletion Page Objects
apps/meteor/tests/e2e/page-objects/account-profile.ts, apps/meteor/tests/e2e/page-objects/fragments/modals/delete-account-modal.ts, apps/meteor/tests/e2e/page-objects/fragments/modals/index.ts
Introduced new DeleteAccountModal fragment with password input, error message, and delete/cancel button locators; AccountProfile refactored to compose this fragment, removing inline dialog locators.
Account Deletion Tests
apps/meteor/tests/e2e/delete-account.spec.ts
Updated test interactions to use new deleteAccountModal abstraction; centralized settings toggling via setSettingValueById API; revised teardown to sequentially delete users and reset permissions.
OpenClaw Async Task Integration
apps/meteor/server/services/omnichannel-integrations/service.ts, packages/core-services/src/types/IOmnichannelIntegrationService.ts
Added queueAsyncTask and routeAsyncTask methods to OmnichannelIntegrationService with route validation for OpenClaw provider; new OpenClawAsyncTask type with provider, route, payload, and optional queue fields.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Suggested labels

type: feature

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The PR title clearly summarizes the main changes: implementing an async task routing layer for OpenClaw integration, which aligns with the core functionality additions across multiple files.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

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


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.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Mar 24, 2026

⚠️ This pull request might be slop. It has been flagged by CodeRabbit slop detection.

@coderabbitai coderabbitai Bot added the type: feature Pull requests that introduces new feature label Mar 24, 2026
Copy link
Copy Markdown
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.

1 issue found across 8 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="apps/meteor/tests/e2e/delete-account.spec.ts">

<violation number="1" location="apps/meteor/tests/e2e/delete-account.spec.ts:31">
P2: `afterAll` no longer deletes `userToDelete`, so failed runs can leak the fixed test user and make future runs flaky.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

Comment on lines +31 to +32
await userWithInvalidPassword.delete();
await userWithoutPermissions.delete();
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot Mar 24, 2026

Choose a reason for hiding this comment

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

P2: afterAll no longer deletes userToDelete, so failed runs can leak the fixed test user and make future runs flaky.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At apps/meteor/tests/e2e/delete-account.spec.ts, line 31:

<comment>`afterAll` no longer deletes `userToDelete`, so failed runs can leak the fixed test user and make future runs flaky.</comment>

<file context>
@@ -27,12 +27,9 @@ test.describe('Delete Own Account', () => {
-			userWithoutPermissions.delete(),
-		]);
+		expect((await setSettingValueById(api, 'Accounts_AllowDeleteOwnAccount', false)).status()).toBe(200);
+		await userWithInvalidPassword.delete();
+		await userWithoutPermissions.delete();
 	});
</file context>
Suggested change
await userWithInvalidPassword.delete();
await userWithoutPermissions.delete();
await userToDelete.delete();
await userWithInvalidPassword.delete();
await userWithoutPermissions.delete();
Fix with Cubic

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (4)
apps/meteor/tests/e2e/page-objects/fragments/modals/delete-account-modal.ts (1)

33-35: Prefer semantic locator over locator() for alert role.

Per coding guidelines, avoid page.locator() and prefer semantic locators. Use getByRole('alert') instead:

Proposed fix
 get inputErrorMessage(): Locator {
-  return this.root.locator('[role="alert"]', { hasText: 'Invalid password' });
+  return this.root.getByRole('alert', { name: /Invalid password/i });
 }

As per coding guidelines: "Avoid using page.locator() in Playwright tests - always prefer semantic locators such as page.getByRole(), page.getByLabel(), page.getByText(), or page.getByTitle()"

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@apps/meteor/tests/e2e/page-objects/fragments/modals/delete-account-modal.ts`
around lines 33 - 35, The getter inputErrorMessage currently uses
this.root.locator('[role="alert"]', { hasText: 'Invalid password' }); replace it
with the semantic Playwright locator API by using this.root.getByRole('alert', {
name: 'Invalid password' }) (or the appropriate accessible name if different) in
the inputErrorMessage getter; update the import/context if needed to use
getByRole and remove the locator() usage to follow the test guideline preferring
semantic locators.
apps/meteor/tests/e2e/delete-account.spec.ts (1)

93-97: Inconsistent setting update pattern.

The outer beforeAll/afterAll use setSettingValueById(api, ...), but the nested describe uses a direct api.post('/settings/...'). Consider using the same utility for consistency:

Proposed fix
 test.describe('Delete Own Account - Permission Disabled', () => {
   test.beforeAll(async ({ api }) => {
-    const response = await api.post('/settings/Accounts_AllowDeleteOwnAccount', { value: false });
-    expect(response.status()).toBe(200);
+    expect((await setSettingValueById(api, 'Accounts_AllowDeleteOwnAccount', false)).status()).toBe(200);
   });
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@apps/meteor/tests/e2e/delete-account.spec.ts` around lines 93 - 97, The
nested test.describe 'Delete Own Account - Permission Disabled' uses a direct
api.post('/settings/Accounts_AllowDeleteOwnAccount', ...) inside its
test.beforeAll; replace that direct call with the shared helper
setSettingValueById(api, 'Accounts_AllowDeleteOwnAccount', false) (and mirror in
its afterAll if present) so the suite uses the same setting-update utility as
the outer beforeAll/afterAll; update any assertions to expect the helper's
returned/observable result the same way other tests do.
apps/meteor/server/services/omnichannel-integrations/service.ts (2)

49-57: Consider importing OpenClawAsyncTask type for consistency.

The method uses an inline type definition that mirrors OpenClawAsyncTask. Importing the type from the interface file would ensure consistency and simplify maintenance.

Proposed fix
-import type { IOmnichannelIntegrationService } from '@rocket.chat/core-services';
+import type { IOmnichannelIntegrationService, OpenClawAsyncTask } from '@rocket.chat/core-services';
-	async queueAsyncTask(task: {
-		provider: 'openclaw';
-		route: string;
-		payload: Record<string, unknown>;
-		queue?: 'work' | 'workComplete';
-	}): Promise<void> {
+	async queueAsyncTask(task: OpenClawAsyncTask): Promise<void> {

Apply similar change to routeAsyncTask parameter type.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@apps/meteor/server/services/omnichannel-integrations/service.ts` around lines
49 - 57, Replace the inline task type with the shared OpenClawAsyncTask type:
import OpenClawAsyncTask from the interface file and change the parameter type
for queueAsyncTask (and similarly for routeAsyncTask) to use OpenClawAsyncTask
instead of the inline object literal; keep the existing
validateOpenClawTaskRoute(task.route) and QueueWorker.queueWork(...) calls
unchanged.

45-48: Consider removing JSDoc comments.

As per coding guidelines for **/*.{ts,tsx,js} files: "Avoid code comments in the implementation."

Proposed fix
-	/**
-	 * Queue OpenClaw work and return immediately.
-	 * Actual routing is performed by `routeAsyncTask` through queue-worker.
-	 */
 	async queueAsyncTask(task: {
-	/**
-	 * Dispatch a queued OpenClaw task to the configured integration action.
-	 */
 	async routeAsyncTask({

Also applies to: 59-61

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@apps/meteor/server/services/omnichannel-integrations/service.ts` around lines
45 - 48, Remove the JSDoc comment blocks that describe "Queue OpenClaw work and
return immediately..." and the similar block at 59-61; delete these /** ... */
blocks that sit above the function that enqueues work (the comment referencing
`routeAsyncTask`/queue-worker) rather than changing behavior, leaving the
function and its call to routeAsyncTask intact; ensure no other implementation
comment blocks remain in this file per the coding guideline.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@apps/meteor/client/views/account/profile/ActionConfirmModal.tsx`:
- Around line 28-36: handleSave currently swallows all errors except
'error-invalid-password'; update the catch in handleSave so that after checking
error.errorType === 'error-invalid-password' and calling setError('credential',
{ message: t('Invalid_password') }) you either re-throw the error (throw error)
so upstream can handle it or set a generic field/toast error (e.g.,
setError('credential', { message: t('Something_went_wrong') }) or trigger a
toast) for any other error returned by onConfirm; ensure you reference the same
functions/values (handleSave, onConfirm, setError, t) when making the change.

In `@apps/meteor/server/services/omnichannel-integrations/service.ts`:
- Around line 70-72: The direct api.call in routeAsyncTask (inside the method
using validateOpenClawTaskRoute) will throw if an openclaw.* service isn't
registered; update routeAsyncTask to catch the broker "service not found" error
and handle it by retrying via the QueueWorker path or enqueueing the task
instead of letting the error bubble. Specifically, wrap the api.call(task.route,
[task.payload]) in a try/catch, detect the broker/service-not-found error (same
check used by QueueWorker's api.call retry logic), and on that case forward the
task to the queue/retry mechanism (or re-use QueueWorker's call) so unregistered
openclaw.* routes are handled safely; keep validateOpenClawTaskRoute as-is to
ensure route format.

---

Nitpick comments:
In `@apps/meteor/server/services/omnichannel-integrations/service.ts`:
- Around line 49-57: Replace the inline task type with the shared
OpenClawAsyncTask type: import OpenClawAsyncTask from the interface file and
change the parameter type for queueAsyncTask (and similarly for routeAsyncTask)
to use OpenClawAsyncTask instead of the inline object literal; keep the existing
validateOpenClawTaskRoute(task.route) and QueueWorker.queueWork(...) calls
unchanged.
- Around line 45-48: Remove the JSDoc comment blocks that describe "Queue
OpenClaw work and return immediately..." and the similar block at 59-61; delete
these /** ... */ blocks that sit above the function that enqueues work (the
comment referencing `routeAsyncTask`/queue-worker) rather than changing
behavior, leaving the function and its call to routeAsyncTask intact; ensure no
other implementation comment blocks remain in this file per the coding
guideline.

In `@apps/meteor/tests/e2e/delete-account.spec.ts`:
- Around line 93-97: The nested test.describe 'Delete Own Account - Permission
Disabled' uses a direct api.post('/settings/Accounts_AllowDeleteOwnAccount',
...) inside its test.beforeAll; replace that direct call with the shared helper
setSettingValueById(api, 'Accounts_AllowDeleteOwnAccount', false) (and mirror in
its afterAll if present) so the suite uses the same setting-update utility as
the outer beforeAll/afterAll; update any assertions to expect the helper's
returned/observable result the same way other tests do.

In `@apps/meteor/tests/e2e/page-objects/fragments/modals/delete-account-modal.ts`:
- Around line 33-35: The getter inputErrorMessage currently uses
this.root.locator('[role="alert"]', { hasText: 'Invalid password' }); replace it
with the semantic Playwright locator API by using this.root.getByRole('alert', {
name: 'Invalid password' }) (or the appropriate accessible name if different) in
the inputErrorMessage getter; update the import/context if needed to use
getByRole and remove the locator() usage to follow the test guideline preferring
semantic locators.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 8f03e59b-acfa-4c44-b608-7eb159a86aa2

📥 Commits

Reviewing files that changed from the base of the PR and between 1dbfce4 and af8be9a.

📒 Files selected for processing (8)
  • apps/meteor/client/views/account/profile/AccountProfilePage.tsx
  • apps/meteor/client/views/account/profile/ActionConfirmModal.tsx
  • apps/meteor/server/services/omnichannel-integrations/service.ts
  • apps/meteor/tests/e2e/delete-account.spec.ts
  • apps/meteor/tests/e2e/page-objects/account-profile.ts
  • apps/meteor/tests/e2e/page-objects/fragments/modals/delete-account-modal.ts
  • apps/meteor/tests/e2e/page-objects/fragments/modals/index.ts
  • packages/core-services/src/types/IOmnichannelIntegrationService.ts
📜 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). (1)
  • GitHub Check: cubic · AI code reviewer
🧰 Additional context used
📓 Path-based instructions (5)
**/*.{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/e2e/page-objects/fragments/modals/index.ts
  • apps/meteor/client/views/account/profile/AccountProfilePage.tsx
  • packages/core-services/src/types/IOmnichannelIntegrationService.ts
  • apps/meteor/tests/e2e/page-objects/fragments/modals/delete-account-modal.ts
  • apps/meteor/server/services/omnichannel-integrations/service.ts
  • apps/meteor/client/views/account/profile/ActionConfirmModal.tsx
  • apps/meteor/tests/e2e/delete-account.spec.ts
  • apps/meteor/tests/e2e/page-objects/account-profile.ts
apps/meteor/tests/e2e/page-objects/**/*.ts

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

Utilize existing page objects pattern from apps/meteor/tests/e2e/page-objects/

Files:

  • apps/meteor/tests/e2e/page-objects/fragments/modals/index.ts
  • apps/meteor/tests/e2e/page-objects/fragments/modals/delete-account-modal.ts
  • apps/meteor/tests/e2e/page-objects/account-profile.ts
apps/meteor/tests/e2e/**/*.{ts,spec.ts}

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

apps/meteor/tests/e2e/**/*.{ts,spec.ts}: Store commonly used locators in variables/constants for reuse
Follow Page Object Model pattern consistently in Playwright tests

Files:

  • apps/meteor/tests/e2e/page-objects/fragments/modals/index.ts
  • apps/meteor/tests/e2e/page-objects/fragments/modals/delete-account-modal.ts
  • apps/meteor/tests/e2e/delete-account.spec.ts
  • apps/meteor/tests/e2e/page-objects/account-profile.ts
**/*.spec.ts

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

**/*.spec.ts: Use descriptive test names that clearly communicate expected behavior in Playwright tests
Use .spec.ts extension for test files (e.g., login.spec.ts)

Files:

  • apps/meteor/tests/e2e/delete-account.spec.ts
apps/meteor/tests/e2e/**/*.spec.ts

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

apps/meteor/tests/e2e/**/*.spec.ts: All test files must be created in apps/meteor/tests/e2e/ directory
Avoid using page.locator() in Playwright tests - always prefer semantic locators such as page.getByRole(), page.getByLabel(), page.getByText(), or page.getByTitle()
Use test.beforeAll() and test.afterAll() for setup/teardown in Playwright tests
Use test.step() for complex test scenarios to improve organization in Playwright tests
Group related tests in the same file
Utilize Playwright fixtures (test, page, expect) for consistency in test files
Prefer web-first assertions (toBeVisible, toHaveText, etc.) in Playwright tests
Use expect matchers for assertions (toEqual, toContain, toBeTruthy, toHaveLength, etc.) instead of assert statements in Playwright tests
Use page.waitFor() with specific conditions instead of hardcoded timeouts in Playwright tests
Implement proper wait strategies for dynamic content in Playwright tests
Maintain test isolation between test cases in Playwright tests
Ensure clean state for each test execution in Playwright tests
Ensure tests run reliably in parallel without shared state conflicts

Files:

  • apps/meteor/tests/e2e/delete-account.spec.ts
🧠 Learnings (31)
📓 Common learnings
Learnt from: smirk-dev
Repo: RocketChat/Rocket.Chat PR: 39625
File: apps/meteor/app/api/server/v1/push.ts:85-97
Timestamp: 2026-03-14T14:58:58.834Z
Learning: In RocketChat/Rocket.Chat, the `push.token` POST/DELETE endpoints in `apps/meteor/app/api/server/v1/push.ts` were already migrated to the chained router API pattern on `develop` prior to PR `#39625`. `cleanTokenResult` (which strips `authToken` and returns `PushTokenResult`) and `isPushTokenPOSTProps`/`isPushTokenDELETEProps` validators already exist on `develop`. PR `#39625` only migrates `push.get` and `push.info` to the chained pattern. Do not flag `cleanTokenResult` or `PushTokenResult` as newly introduced behavior-breaking changes when reviewing this PR.
Learnt from: ggazzo
Repo: RocketChat/Rocket.Chat PR: 35995
File: apps/meteor/app/api/server/v1/rooms.ts:1107-1112
Timestamp: 2026-02-23T17:53:18.785Z
Learning: In Rocket.Chat PR reviews, maintain strict scope boundaries—when a PR is focused on a specific endpoint (e.g., rooms.favorite), avoid reviewing or suggesting changes to other endpoints that were incidentally refactored (e.g., rooms.invite) unless explicitly requested by maintainers.
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/page-objects/**/*.ts : Utilize existing page objects pattern from `apps/meteor/tests/e2e/page-objects/`

Applied to files:

  • apps/meteor/tests/e2e/page-objects/fragments/modals/index.ts
  • apps/meteor/tests/e2e/page-objects/fragments/modals/delete-account-modal.ts
  • apps/meteor/tests/e2e/delete-account.spec.ts
  • apps/meteor/tests/e2e/page-objects/account-profile.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.{ts,spec.ts} : Follow Page Object Model pattern consistently in Playwright tests

Applied to files:

  • apps/meteor/tests/e2e/page-objects/fragments/modals/index.ts
  • apps/meteor/tests/e2e/page-objects/fragments/modals/delete-account-modal.ts
  • apps/meteor/tests/e2e/delete-account.spec.ts
  • apps/meteor/tests/e2e/page-objects/account-profile.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Utilize Playwright fixtures (`test`, `page`, `expect`) for consistency in test files

Applied to files:

  • apps/meteor/tests/e2e/page-objects/fragments/modals/index.ts
  • apps/meteor/tests/e2e/page-objects/fragments/modals/delete-account-modal.ts
  • apps/meteor/tests/e2e/delete-account.spec.ts
  • apps/meteor/tests/e2e/page-objects/account-profile.ts
📚 Learning: 2025-12-16T17:29:40.430Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 37834
File: apps/meteor/tests/e2e/page-objects/fragments/admin-flextab-emoji.ts:12-22
Timestamp: 2025-12-16T17:29:40.430Z
Learning: In all page-object files under apps/meteor/tests/e2e/page-objects/, import expect from ../../utils/test (Playwright's async expect) instead of from Jest. Jest's expect is synchronous and incompatible with web-first assertions like toBeVisible, which can cause TypeScript errors.

Applied to files:

  • apps/meteor/tests/e2e/page-objects/fragments/modals/index.ts
  • apps/meteor/tests/e2e/page-objects/fragments/modals/delete-account-modal.ts
  • apps/meteor/tests/e2e/page-objects/account-profile.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.{ts,spec.ts} : Store commonly used locators in variables/constants for reuse

Applied to files:

  • apps/meteor/tests/e2e/page-objects/fragments/modals/index.ts
  • apps/meteor/tests/e2e/page-objects/fragments/modals/delete-account-modal.ts
  • apps/meteor/tests/e2e/delete-account.spec.ts
  • apps/meteor/tests/e2e/page-objects/account-profile.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Ensure tests run reliably in parallel without shared state conflicts

Applied to files:

  • apps/meteor/tests/e2e/page-objects/fragments/modals/index.ts
  • apps/meteor/tests/e2e/delete-account.spec.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Group related tests in the same file

Applied to files:

  • apps/meteor/tests/e2e/page-objects/fragments/modals/index.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Ensure clean state for each test execution in Playwright tests

Applied to files:

  • apps/meteor/tests/e2e/page-objects/fragments/modals/index.ts
  • apps/meteor/tests/e2e/page-objects/fragments/modals/delete-account-modal.ts
  • apps/meteor/tests/e2e/delete-account.spec.ts
  • apps/meteor/tests/e2e/page-objects/account-profile.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Use `expect` matchers for assertions (`toEqual`, `toContain`, `toBeTruthy`, `toHaveLength`, etc.) instead of `assert` statements in Playwright tests

Applied to files:

  • apps/meteor/tests/e2e/page-objects/fragments/modals/index.ts
  • apps/meteor/tests/e2e/page-objects/fragments/modals/delete-account-modal.ts
  • apps/meteor/tests/e2e/delete-account.spec.ts
  • apps/meteor/tests/e2e/page-objects/account-profile.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Prefer web-first assertions (`toBeVisible`, `toHaveText`, etc.) in Playwright tests

Applied to files:

  • apps/meteor/tests/e2e/page-objects/fragments/modals/index.ts
  • apps/meteor/tests/e2e/page-objects/fragments/modals/delete-account-modal.ts
  • apps/meteor/tests/e2e/page-objects/account-profile.ts
📚 Learning: 2026-02-24T19:39:42.247Z
Learnt from: juliajforesti
Repo: RocketChat/Rocket.Chat PR: 38493
File: apps/meteor/tests/e2e/page-objects/fragments/message.ts:7-7
Timestamp: 2026-02-24T19:39:42.247Z
Learning: In RocketChat e2e tests, avoid using data-qa attributes to locate elements. Prefer semantic locators such as getByRole, getByLabel, getByText, getByTitle and ARIA-based selectors. Apply this rule to all TypeScript files under apps/meteor/tests/e2e to improve test reliability, accessibility, and maintainability.

Applied to files:

  • apps/meteor/tests/e2e/page-objects/fragments/modals/index.ts
  • apps/meteor/tests/e2e/page-objects/fragments/modals/delete-account-modal.ts
  • apps/meteor/tests/e2e/delete-account.spec.ts
  • apps/meteor/tests/e2e/page-objects/account-profile.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 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/e2e/page-objects/fragments/modals/index.ts
  • packages/core-services/src/types/IOmnichannelIntegrationService.ts
  • apps/meteor/tests/e2e/page-objects/fragments/modals/delete-account-modal.ts
  • apps/meteor/server/services/omnichannel-integrations/service.ts
  • apps/meteor/tests/e2e/delete-account.spec.ts
  • apps/meteor/tests/e2e/page-objects/account-profile.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/e2e/page-objects/fragments/modals/index.ts
  • packages/core-services/src/types/IOmnichannelIntegrationService.ts
  • apps/meteor/tests/e2e/page-objects/fragments/modals/delete-account-modal.ts
  • apps/meteor/server/services/omnichannel-integrations/service.ts
  • apps/meteor/tests/e2e/delete-account.spec.ts
  • apps/meteor/tests/e2e/page-objects/account-profile.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Avoid using `page.locator()` in Playwright tests - always prefer semantic locators such as `page.getByRole()`, `page.getByLabel()`, `page.getByText()`, or `page.getByTitle()`

Applied to files:

  • apps/meteor/tests/e2e/page-objects/fragments/modals/delete-account-modal.ts
  • apps/meteor/tests/e2e/page-objects/account-profile.ts
📚 Learning: 2026-02-24T19:36:55.089Z
Learnt from: juliajforesti
Repo: RocketChat/Rocket.Chat PR: 38493
File: apps/meteor/tests/e2e/page-objects/fragments/home-content.ts:60-82
Timestamp: 2026-02-24T19:36:55.089Z
Learning: In RocketChat/Rocket.Chat e2e tests (apps/meteor/tests/e2e/page-objects/fragments/home-content.ts), thread message preview listitems do not have aria-roledescription="message", so lastThreadMessagePreview locator cannot be scoped to messageListItems (which filters for aria-roledescription="message"). It should remain scoped to page.getByRole('listitem') or mainMessageList.getByRole('listitem').

Applied to files:

  • apps/meteor/tests/e2e/page-objects/fragments/modals/delete-account-modal.ts
  • apps/meteor/tests/e2e/page-objects/account-profile.ts
📚 Learning: 2026-02-24T19:09:09.561Z
Learnt from: ahmed-n-abdeltwab
Repo: RocketChat/Rocket.Chat PR: 38974
File: apps/meteor/app/api/server/v1/im.ts:220-221
Timestamp: 2026-02-24T19:09:09.561Z
Learning: In RocketChat/Rocket.Chat OpenAPI migration PRs for apps/meteor/app/api/server/v1 endpoints, maintainers prefer to avoid any logic changes; style-only cleanups (like removing inline comments) may be deferred to follow-ups to keep scope tight.

Applied to files:

  • apps/meteor/server/services/omnichannel-integrations/service.ts
📚 Learning: 2026-03-14T14:58:58.834Z
Learnt from: smirk-dev
Repo: RocketChat/Rocket.Chat PR: 39625
File: apps/meteor/app/api/server/v1/push.ts:85-97
Timestamp: 2026-03-14T14:58:58.834Z
Learning: In RocketChat/Rocket.Chat, the `push.token` POST/DELETE endpoints in `apps/meteor/app/api/server/v1/push.ts` were already migrated to the chained router API pattern on `develop` prior to PR `#39625`. `cleanTokenResult` (which strips `authToken` and returns `PushTokenResult`) and `isPushTokenPOSTProps`/`isPushTokenDELETEProps` validators already exist on `develop`. PR `#39625` only migrates `push.get` and `push.info` to the chained pattern. Do not flag `cleanTokenResult` or `PushTokenResult` as newly introduced behavior-breaking changes when reviewing this PR.

Applied to files:

  • apps/meteor/server/services/omnichannel-integrations/service.ts
📚 Learning: 2026-03-12T10:26:26.697Z
Learnt from: ahmed-n-abdeltwab
Repo: RocketChat/Rocket.Chat PR: 39340
File: apps/meteor/app/api/server/v1/im.ts:1349-1398
Timestamp: 2026-03-12T10:26:26.697Z
Learning: In `apps/meteor/app/api/server/v1/im.ts` (PR `#39340`), the `DmEndpoints` type intentionally includes temporary stub entries for `/v1/im.kick`, `/v1/dm.kick`, `/v1/im.leave`, and `/v1/dm.leave` (using `DmKickProps` and `DmLeaveProps`) even though no route handlers exist for them yet. These stubs were added to preserve type compatibility after removing the original `DmLeaveProps` and related files. They are planned for cleanup in a follow-up PR. Do not flag these as missing implementations when reviewing this file until the follow-up is merged.

Applied to files:

  • apps/meteor/server/services/omnichannel-integrations/service.ts
📚 Learning: 2026-02-25T20:10:16.987Z
Learnt from: ahmed-n-abdeltwab
Repo: RocketChat/Rocket.Chat PR: 38913
File: packages/ddp-client/src/legacy/types/SDKLegacy.ts:34-34
Timestamp: 2026-02-25T20:10:16.987Z
Learning: In the RocketChat/Rocket.Chat monorepo, packages/ddp-client and apps/meteor do not use TypeScript project references. Module augmentations in apps/meteor (e.g., declare module 'rocket.chat/rest-typings') are not visible when compiling packages/ddp-client in isolation, which is why legacy SDK methods that depend on OperationResult types for OpenAPI-migrated endpoints must remain commented out.

Applied to files:

  • apps/meteor/server/services/omnichannel-integrations/service.ts
📚 Learning: 2026-03-03T11:11:48.541Z
Learnt from: ahmed-n-abdeltwab
Repo: RocketChat/Rocket.Chat PR: 39230
File: apps/meteor/app/api/server/v1/chat.ts:214-222
Timestamp: 2026-03-03T11:11:48.541Z
Learning: In apps/meteor/server/lib/moderation/reportMessage.ts, the reportMessage function validates that description is not empty or whitespace-only with `if (!description.trim())`. When migrating the chat.reportMessage endpoint to OpenAPI, adding minLength validation to the schema preserves this existing behavior.

Applied to files:

  • apps/meteor/server/services/omnichannel-integrations/service.ts
📚 Learning: 2026-03-16T23:33:15.721Z
Learnt from: amitb0ra
Repo: RocketChat/Rocket.Chat PR: 39676
File: apps/meteor/app/api/server/v1/users.ts:862-869
Timestamp: 2026-03-16T23:33:15.721Z
Learning: In RocketChat/Rocket.Chat OpenAPI migration PRs (e.g., PR `#39676` for users.register in apps/meteor/app/api/server/v1/users.ts), calls to `this.parseJsonQuery()` inside migrated handlers are intentionally preserved without adding a corresponding `query` AJV schema to the route options. Adding query-param schemas for the `fields`/`sort`/`query` parameters consumed by `parseJsonQuery()` is a separate cross-cutting concern shared by many endpoints (e.g., users.create, users.update, users.list) and is explicitly out of scope for individual endpoint migration PRs. Do not flag the absence of a `query` schema for `parseJsonQuery()` usage as a violation of OpenAPI/AJV contract during migration reviews.

Applied to files:

  • apps/meteor/server/services/omnichannel-integrations/service.ts
📚 Learning: 2026-03-18T16:08:17.800Z
Learnt from: juliajforesti
Repo: RocketChat/Rocket.Chat PR: 39590
File: apps/meteor/client/views/omnichannel/contactInfo/EditContactInfo.tsx:97-99
Timestamp: 2026-03-18T16:08:17.800Z
Learning: In `apps/meteor/client/views/omnichannel/contactInfo/EditContactInfo.tsx`, `reValidateMode: 'onBlur'` is intentionally used (not 'onChange') because the `validateEmailFormat` and `validatePhone` functions are async and call the `checkExistenceEndpoint` API to check for duplicates. Using 'onChange' would trigger excessive network requests on every keystroke. The combination of `mode: 'onSubmit'` with `reValidateMode: 'onBlur'` is a deliberate design decision to minimize API calls while still providing revalidation feedback.

Applied to files:

  • apps/meteor/client/views/account/profile/ActionConfirmModal.tsx
📚 Learning: 2026-03-04T14:16:49.202Z
Learnt from: tassoevan
Repo: RocketChat/Rocket.Chat PR: 39304
File: packages/ui-contexts/src/ActionManagerContext.ts:26-26
Timestamp: 2026-03-04T14:16:49.202Z
Learning: In `packages/ui-contexts/src/ActionManagerContext.ts` (TypeScript, RocketChat/Rocket.Chat), the `disposeView` method in `IActionManager` uses an intentionally explicit union `UiKit.ModalView['id'] | UiKit.BannerView['viewId'] | UiKit.ContextualBarView['id']` to document which view types are accepted, even though all constituents resolve to the same primitive. The inline `// eslint-disable-next-line typescript-eslint/no-duplicate-type-constituents` comment is intentional and should not be flagged or removed.

Applied to files:

  • apps/meteor/client/views/account/profile/ActionConfirmModal.tsx
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Maintain test isolation between test cases in Playwright tests

Applied to files:

  • apps/meteor/tests/e2e/delete-account.spec.ts
  • apps/meteor/tests/e2e/page-objects/account-profile.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Use `test.beforeAll()` and `test.afterAll()` for setup/teardown in Playwright tests

Applied to files:

  • apps/meteor/tests/e2e/delete-account.spec.ts
📚 Learning: 2026-03-02T16:31:41.304Z
Learnt from: KevLehman
Repo: RocketChat/Rocket.Chat PR: 39250
File: apps/meteor/tests/end-to-end/api/livechat/07-queue.ts:1084-1094
Timestamp: 2026-03-02T16:31:41.304Z
Learning: In E2E API tests at apps/meteor/tests/end-to-end/api/livechat/, using sleep(1000) after updateSetting() or updateEESetting() calls in test setup hooks is acceptable and intentional to allow omnichannel settings to propagate their side effects.

Applied to files:

  • apps/meteor/tests/e2e/delete-account.spec.ts
📚 Learning: 2026-03-16T11:57:17.987Z
Learnt from: ricardogarim
Repo: RocketChat/Rocket.Chat PR: 39657
File: apps/meteor/tests/end-to-end/apps/app-resolve-visitor.ts:43-45
Timestamp: 2026-03-16T11:57:17.987Z
Learning: In `apps/meteor/tests/end-to-end/apps/app-resolve-visitor.ts`, `externalIds` lookups are namespaced per `app.id`. Because `cleanupApps()` is called before each test run and a fresh app is installed (giving a new unique `app.id`), fixed `userId` strings like `'nonexistent-id'` in null-path tests are safe and cannot collide with stale visitor records from previous runs. Do not flag these as needing unique/random values.

Applied to files:

  • apps/meteor/tests/e2e/delete-account.spec.ts
📚 Learning: 2025-12-16T17:29:45.163Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 37834
File: apps/meteor/tests/e2e/page-objects/fragments/admin-flextab-emoji.ts:12-22
Timestamp: 2025-12-16T17:29:45.163Z
Learning: In page object files under `apps/meteor/tests/e2e/page-objects/`, always import `expect` from `../../utils/test` (Playwright's async expect), not from Jest. Jest's `expect` has a synchronous signature and will cause TypeScript errors when used with web-first assertions like `toBeVisible()`.

Applied to files:

  • apps/meteor/tests/e2e/delete-account.spec.ts
📚 Learning: 2026-02-24T19:22:48.358Z
Learnt from: juliajforesti
Repo: RocketChat/Rocket.Chat PR: 38493
File: apps/meteor/tests/e2e/omnichannel/omnichannel-send-pdf-transcript.spec.ts:66-67
Timestamp: 2026-02-24T19:22:48.358Z
Learning: In Playwright end-to-end tests (e.g., under apps/meteor/tests/e2e/...), prefer locating elements by translated text (getByText) and ARIA roles (getByRole) over data-qa attributes. If translation values change, update the corresponding test locators accordingly. Never use data-qa locators. This guideline applies to all Playwright e2e test specs in the repository and helps keep tests robust to UI text changes and accessible semantics.

Applied to files:

  • apps/meteor/tests/e2e/delete-account.spec.ts
📚 Learning: 2026-03-06T18:10:15.268Z
Learnt from: tassoevan
Repo: RocketChat/Rocket.Chat PR: 39397
File: packages/gazzodown/src/code/CodeBlock.spec.tsx:47-68
Timestamp: 2026-03-06T18:10:15.268Z
Learning: In tests (especially those using testing-library/dom/jsdom) for Rocket.Chat components, the HTML <code> element has an implicit ARIA role of 'code'. Therefore, screen.getByRole('code') or screen.findByRole('code') will locate <code> elements even without a role attribute. Do not flag findByRole('code') as invalid in reviews; prefer using the implicit role instead of adding role="code" unless necessary for accessibility.

Applied to files:

  • apps/meteor/tests/e2e/delete-account.spec.ts
🔇 Additional comments (12)
apps/meteor/client/views/account/profile/ActionConfirmModal.tsx (1)

46-85: Well-structured form with proper accessibility.

The use of Controller with react-hook-form, proper aria attributes (aria-invalid, aria-describedby, aria-required), and the FieldError with role="alert" provides good accessibility. The htmlFor linkage to credentialFieldId is correct.

apps/meteor/tests/e2e/page-objects/fragments/modals/delete-account-modal.ts (1)

5-23: Good use of Page Object Model pattern with semantic locators.

The modal fragment correctly extends Modal, uses getByRole for buttons and dialog, and provides a clean confirmDelete API with optional dismissal wait.

apps/meteor/tests/e2e/page-objects/fragments/modals/index.ts (1)

5-5: LGTM!

The barrel export is correctly added and maintains alphabetical ordering with the existing exports.

apps/meteor/client/views/account/profile/AccountProfilePage.tsx (1)

94-116: Clean error propagation pattern for field-level validation.

The refactoring correctly:

  1. Moves setModal(null) before logout() to ensure proper cleanup
  2. Re-throws error-invalid-password so ActionConfirmModal can catch it and display the field-level error via setError('credential', ...)
  3. Maintains existing handling for user-last-owner and generic errors
apps/meteor/tests/e2e/page-objects/account-profile.ts (2)

4-12: Good Page Object composition pattern.

The DeleteAccountModal fragment is properly composed into AccountProfile, following the Page Object Model pattern. This delegates modal-specific interactions to a dedicated fragment, improving maintainability and reusability.


118-121: Correct use of semantic locator for delete button.

The btnDeleteMyAccount getter uses getByRole('button', ...) which aligns with the coding guidelines for Playwright tests.

apps/meteor/tests/e2e/delete-account.spec.ts (2)

35-63: Well-structured test with proper use of Page Object Model.

The test correctly:

  • Uses test.step() for organization
  • Leverages the deleteAccountModal abstraction for all modal interactions
  • Uses web-first assertions (toBeVisible, toHaveValue)
  • Maintains proper test isolation with dedicated userWithInvalidPassword

65-91: LGTM - clean deletion flow test.

The test properly verifies the successful account deletion flow and correctly calls userToDelete.markAsDeleted() to prevent cleanup errors.

packages/core-services/src/types/IOmnichannelIntegrationService.ts (2)

3-8: LGTM on type definition.

The OpenClawAsyncTask type is well-structured with appropriate fields for async task routing.


14-15: LGTM on interface method signatures.

The new methods are properly typed and align with the implementation.

apps/meteor/server/services/omnichannel-integrations/service.ts (2)

1-1: LGTM on imports.

The new imports for QueueWorker and api are correctly added to support the async task routing functionality.


12-18: LGTM on route validation.

The prefix validation ensures only openclaw. routes are accepted, providing basic input validation.

Comment on lines +28 to +36
const handleSave = async ({ credential }: { credential: string }) => {
try {
await onConfirm(credential);
} catch (error: any) {
if (error.errorType === 'error-invalid-password') {
setError('credential', { message: t('Invalid_password') });
}
onConfirm(inputText);
onCancel();
},
[inputText, onConfirm, onCancel, t],
);
}
};
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.

⚠️ Potential issue | 🟡 Minor

Non-password errors are silently swallowed.

The catch block only handles error-invalid-password. Any other error type thrown by onConfirm is caught but not surfaced to the user—no toast, no field error, no re-throw.

Consider re-throwing unknown errors or displaying a generic error message:

Proposed fix
 const handleSave = async ({ credential }: { credential: string }) => {
   try {
     await onConfirm(credential);
   } catch (error: any) {
     if (error.errorType === 'error-invalid-password') {
       setError('credential', { message: t('Invalid_password') });
+      return;
     }
+    throw error;
   }
 };
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const handleSave = async ({ credential }: { credential: string }) => {
try {
await onConfirm(credential);
} catch (error: any) {
if (error.errorType === 'error-invalid-password') {
setError('credential', { message: t('Invalid_password') });
}
onConfirm(inputText);
onCancel();
},
[inputText, onConfirm, onCancel, t],
);
}
};
const handleSave = async ({ credential }: { credential: string }) => {
try {
await onConfirm(credential);
} catch (error: any) {
if (error.errorType === 'error-invalid-password') {
setError('credential', { message: t('Invalid_password') });
return;
}
throw error;
}
};
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@apps/meteor/client/views/account/profile/ActionConfirmModal.tsx` around lines
28 - 36, handleSave currently swallows all errors except
'error-invalid-password'; update the catch in handleSave so that after checking
error.errorType === 'error-invalid-password' and calling setError('credential',
{ message: t('Invalid_password') }) you either re-throw the error (throw error)
so upstream can handle it or set a generic field/toast error (e.g.,
setError('credential', { message: t('Something_went_wrong') }) or trigger a
toast) for any other error returned by onConfirm; ensure you reference the same
functions/values (handleSave, onConfirm, setError, t) when making the change.

Comment on lines +70 to +72
}): Promise<void> {
this.validateOpenClawTaskRoute(task.route);
await api.call(task.route, [task.payload]);
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.

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Search for any service registrations or method handlers with 'openclaw' prefix
echo "=== Searching for openclaw service registrations ==="
rg -n -C3 "openclaw" --type=ts

echo ""
echo "=== Searching for services that might register openclaw routes ==="
rg -n "ServiceClassInternal|ServiceClass" --type=ts -l | xargs -I{} rg -l "openclaw" {}

echo ""
echo "=== Checking for any 'openclaw' in config files ==="
fd -e toml -e json -e yaml -e yml | xargs rg -l "openclaw" 2>/dev/null || echo "No config files with openclaw found"

Repository: RocketChat/Rocket.Chat

Length of output: 3361


🏁 Script executed:

#!/bin/bash
# Get more context around the routeAsyncTask method
echo "=== Full context of routeAsyncTask method ==="
sed -n '60,75p' apps/meteor/server/services/omnichannel-integrations/service.ts

echo ""
echo "=== Look for api parameter definition and imports ==="
head -50 apps/meteor/server/services/omnichannel-integrations/service.ts

echo ""
echo "=== Search for where api.call is used elsewhere ==="
rg -n "api\.call" apps/meteor/server/services/omnichannel-integrations/service.ts

echo ""
echo "=== Search for router parameter and queue-worker references ==="
rg -n -C2 "router\|queue" apps/meteor/server/services/omnichannel-integrations/service.ts

Repository: RocketChat/Rocket.Chat

Length of output: 2306


🏁 Script executed:

#!/bin/bash
# Find the api export in core-services
echo "=== Search for api export in `@rocket.chat/core-services` ==="
find packages/core-services -type f -name "*.ts" | head -20

echo ""
echo "=== Look for api.call usage in other services ==="
rg -n "api\.call" --type=ts -l | head -10

echo ""
echo "=== Check what core-services exports related to api ==="
rg -n "export.*api" packages/core-services -A2 -B2 | head -40

Repository: RocketChat/Rocket.Chat

Length of output: 1936


🏁 Script executed:

#!/bin/bash
# Read the Api class to understand api.call
echo "=== Reading Api.ts ==="
cat -n packages/core-services/src/lib/Api.ts

echo ""
echo "=== Read QueueWorker.ts to see api.call usage ==="
cat -n ee/packages/omnichannel-services/src/QueueWorker.ts

Repository: RocketChat/Rocket.Chat

Length of output: 9548


Update the routeAsyncTask call to handle missing openclaw. routes properly.*

The call api.call(task.route, [task.payload]) at line 72 directly invokes the broker's call method. Unlike the QueueWorker's api.call (which catches "service not found" errors and retries), this direct call will throw an error if the openclaw.* service is not registered. No openclaw.* service registrations were found in the codebase—only type definitions and route validation.

Either:

  1. Ensure all expected openclaw.* routes are registered in the broker at startup, or
  2. Add error handling in routeAsyncTask to catch and handle unregistered service calls (consider reusing QueueWorker's retry logic via queue instead of direct api.call)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@apps/meteor/server/services/omnichannel-integrations/service.ts` around lines
70 - 72, The direct api.call in routeAsyncTask (inside the method using
validateOpenClawTaskRoute) will throw if an openclaw.* service isn't registered;
update routeAsyncTask to catch the broker "service not found" error and handle
it by retrying via the QueueWorker path or enqueueing the task instead of
letting the error bubble. Specifically, wrap the api.call(task.route,
[task.payload]) in a try/catch, detect the broker/service-not-found error (same
check used by QueueWorker's api.call retry logic), and on that case forward the
task to the queue/retry mechanism (or re-use QueueWorker's call) so unregistered
openclaw.* routes are handled safely; keep validateOpenClawTaskRoute as-is to
ensure route format.

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

Labels

community stat: conflict type: feature Pull requests that introduces new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants