fix(call): actually resolve .well-known rtc_foci for MSC4515 — SDK cache is empty at runtime
CI / Build & Quality Checks (push) Successful in 1m30s
CI / Docker image build & smoke test (push) Skipped
CI / Secret scan (gitleaks) (push) Successful in 11s
CI / Trigger Desktop Build (push) Successful in 9s
CI / Playwright smoke (e2e) (push) Successful in 2m59s

81a6d9c9 wired getRtcTransports() but its .well-known fallback read
mx.getClientWellKnown(), which the SDK only populates when the client
is started with clientWellKnownPollPeriod — cinny never sets it, so on
the live client the fallback returned [] and calls still failed with
MISSING_MATRIX_RTC_TRANSPORT after deploy. (The unit test faked a
populated cache and hid this.)

The driver now fetches the client .well-known itself, once, via
AutoDiscovery.getRawClientConfig(domain) — the same resolver Element
Call used before 0.22 — and only when the SDK has nothing cached. Test
added for the uncached path (asserts a single fetch); verified the
resolver returns the livekit focus for matrix.lotusguild.org.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PPmy3tPq869XDW4njjVaKA
This commit is contained in:
2026-09-14 19:39:40 -04:00
co-authored by Claude Opus 5
parent 62f214f441
commit b74f9f5699
2 changed files with 56 additions and 7 deletions
+18 -1
View File
@@ -24,6 +24,7 @@ import {
type StateEvents,
type TimelineEvents,
MatrixClient,
AutoDiscovery,
} from 'matrix-js-sdk';
import { getCallCapabilities } from './utils';
import { downloadMedia, mxcUrlToHttp } from '../../utils/matrix';
@@ -33,6 +34,9 @@ export class CallWidgetDriver extends WidgetDriver {
private readonly mx: MatrixClient;
// Memoised client .well-known fetch for getRtcTransports (MSC4515).
private wellKnownPromise: Promise<unknown> | undefined;
public constructor(
mx: MatrixClient,
private inRoomId: string,
@@ -303,9 +307,22 @@ export class CallWidgetDriver extends WidgetDriver {
} catch {
// 404 / M_UNRECOGNIZED on homeservers without MSC4143 — fall through.
}
const wellKnown = this.mx.getClientWellKnown() as
// The SDK only caches the client .well-known when started with
// `clientWellKnownPollPeriod`, which we don't set — so getClientWellKnown()
// is normally undefined here. Fetch it ourselves (once per driver) via the
// SDK's own resolver; this is exactly what Element Call did pre-0.22.
let wellKnown = this.mx.getClientWellKnown() as
| { 'org.matrix.msc4143.rtc_foci'?: unknown }
| undefined;
if (!wellKnown?.['org.matrix.msc4143.rtc_foci']) {
const domain = this.mx.getDomain();
if (domain) {
if (!this.wellKnownPromise) {
this.wellKnownPromise = AutoDiscovery.getRawClientConfig(domain).catch(() => ({}));
}
wellKnown = (await this.wellKnownPromise) as typeof wellKnown;
}
}
const foci = wellKnown?.['org.matrix.msc4143.rtc_foci'];
const transports = Array.isArray(foci)
? (foci.filter(