Skip to content

[Bug]: Matrix health probe overwrites storage-meta.json with null deviceId, breaking connectivity (easy fix) #61317

@jjhvlabs

Description

@jjhvlabs

Bug type

Behavior bug (incorrect output/state without crash)

Beta release blocker

No

Summary

The Matrix health probe doesn't pass deviceId through the call chain (probeAccount → probeMatrix → createMatrixClient), causing writeStorageMeta to overwrite storage-meta.json with
"deviceId": null. This breaks Matrix connectivity after every update or health check cycle.

The deviceId is correctly resolved by resolveMatrixAuth, but probeAccount omits it when calling probeMatrix (similar pattern to #46014 where the gateway probe drops device identity).

The fix is two pass-throughs:

  1. probeAccount: add deviceId: auth.deviceId to the probeMatrix call
  2. probeMatrix: accept and forward deviceId: params.deviceId to createMatrixClient

Steps to reproduce

1.Configure one or more Matrix accounts with valid deviceId values in openclaw.json
2. Update OpenClaw (or wait for the health probe to run)
3. Check ~/.openclaw/matrix/accounts/*/storage-meta.json

Expected behavior

storage-meta.json retains the correct deviceId after a health probe. Matrix accounts remain connected and responsive.

Actual behavior

storage-meta.json is overwritten with "deviceId": null. Matrix accounts stop responding until the deviceId is manually restored.

OpenClaw version

2026.4.2

Operating system

Homebrew, macOS

Install method

npm

Model

not applicable

Provider / routing chain

not applicable

Additional provider/model setup details

No response

Logs, screenshots, and evidence

1.probe Account calls resolve MatrixAuth() which correctly returns auth.deviceId, but then omits it when calling probeMatrix:

//extensions/matrix/src/channel.ts—probeAccount
const auth=await resolveMatrixAuth({cfg,accountId:account.accountId});
return await probeMatrix({
  homeserver:auth.homeserver,
  accessToken:auth.accessToken,
  userId:auth.userId,
  timeoutMs,
  accountId:account.accountId,
  allowPrivateNetwork:auth.allowPrivateNetwork,
  ssrfPolicy:auth.ssrfPolicy,
  dispatcherPolicy:auth.dispatcherPolicy
  //deviceId:auth.deviceId←missing
});

2.probeMatrix calls createMatrixClient without deviceId:

//extensions/matrix/src/matrix/probe.ts—probeMatrix
const userId=await(await createMatrixClient({
  homeserver:params.homeserver,
  userId:inputUserId,
  accessToken:params.accessToken,
  localTimeoutMs:params.timeoutMs,
  accountId:params.accountId,
  allowPrivateNetwork:params.allowPrivateNetwork,
  ssrfPolicy:params.ssrfPolicy,
  dispatcherPolicy:params.dispatcherPolicy
  //deviceId:params.deviceId←missing
})).getUserId();

3.createMatrixClient calls writeStorageMeta with deviceId:undefined, which becomes null:
//extensions/matrix/src/matrix/client/create-client.ts

writeStorageMeta({
  storagePaths,
  homeserver,
  userId,
  accountId:params.accountId,
  deviceId:params.deviceId//undefined→null
});

Impact and severity

  • Affected users/systems/channels: All Matrix accounts configured with a deviceId. Both encrypted and unencrypted accounts are affected, since the probe overwrites storage-meta.json
    regardless of encryption settings.
  • Severity: Blocks workflow — Matrix accounts become unresponsive and require manual editing of storage-meta.json files to restore.
  • Frequency: Always — happens on every OpenClaw update and on every health probe cycle.
    -Consequence: messages on all affected Matrix channels until manually fixed. For encrypted accounts, may also break E2EE session continuity.

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingbug:behaviorIncorrect behavior without a crash

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions