Commit Graph

207 Commits

Author SHA1 Message Date
Gustavo Madeira Santana
0c298b7e13 Matrix: fix secrets scan false positives 2026-03-12 11:54:30 +00:00
Gustavo Madeira Santana
47634c4219 Matrix: cover client wrapper helpers 2026-03-12 11:54:30 +00:00
Gustavo Madeira Santana
3179a20b50 Matrix: harden timer-driven tests 2026-03-12 11:54:30 +00:00
Gustavo Madeira Santana
f0b247b091 Matrix: add profile action coverage 2026-03-12 11:54:30 +00:00
Gustavo Madeira Santana
9104f8efec Matrix: align CLI guidance with resolved account 2026-03-12 11:54:30 +00:00
Gustavo Madeira Santana
02bcdd6036 Matrix: share room action helpers 2026-03-12 11:54:30 +00:00
Gustavo Madeira Santana
8547d6a6a4 Matrix: share started action client helper 2026-03-12 11:54:30 +00:00
Gustavo Madeira Santana
91d30bccc4 Matrix: share config field path helpers 2026-03-12 11:54:30 +00:00
Gustavo Madeira Santana
80176ac522 Matrix: scope encryption guidance by account 2026-03-12 11:54:30 +00:00
Gustavo Madeira Santana
7c00255aba Matrix: honor action gates per resolved account 2026-03-12 11:54:30 +00:00
Gustavo Madeira Santana
249b429e7c Matrix: share room config normalization 2026-03-12 11:54:30 +00:00
Gustavo Madeira Santana
a3a7da7532 Matrix: point room warnings at active config path 2026-03-12 11:54:30 +00:00
Gustavo Madeira Santana
31d2e78432 Matrix: show account-scoped onboarding paths 2026-03-12 11:54:30 +00:00
Gustavo Madeira Santana
02ffd358b6 Matrix: scope onboarding config to selected account 2026-03-12 11:54:30 +00:00
Gustavo Madeira Santana
5fcc468b7e Matrix: harden thread binding persistence 2026-03-12 11:54:30 +00:00
Gustavo Madeira Santana
32935a32d9 Matrix: align reaction routing with thread bindings 2026-03-12 11:54:30 +00:00
Gustavo Madeira Santana
25324fbdf8 Matrix: extract startup maintenance flow 2026-03-12 11:54:30 +00:00
Gustavo Madeira Santana
44d709e20d Matrix: split monitor verification event routing 2026-03-12 11:54:30 +00:00
Gustavo Madeira Santana
9103bfcc01 Matrix: remove orphaned inbound body helpers 2026-03-12 11:54:30 +00:00
Gustavo Madeira Santana
30c3afe473 Matrix: extract inbound route resolution 2026-03-12 11:54:30 +00:00
Gustavo Madeira Santana
886d01b6ad Matrix: dedupe monitor handler tests 2026-03-12 11:54:30 +00:00
Gustavo Madeira Santana
9e4725c2a2 Matrix: centralize monitor config normalization 2026-03-12 11:54:30 +00:00
Gustavo Madeira Santana
ff68229754 Matrix: extract monitor access state 2026-03-12 11:54:30 +00:00
Gustavo Madeira Santana
1387941f54 Matrix: remove orphaned send queue 2026-03-12 11:54:30 +00:00
Gustavo Madeira Santana
925a25eafc Matrix: dedupe resolver test harness 2026-03-12 11:54:30 +00:00
Gustavo Madeira Santana
3438a04710 Matrix: remove unused internal helpers 2026-03-12 11:54:30 +00:00
Gustavo Madeira Santana
31075acb3b Matrix: share reusable client bootstrap 2026-03-12 11:54:30 +00:00
Gustavo Madeira Santana
edad61320e Matrix: register thread bindings before client sync 2026-03-12 11:54:30 +00:00
Gustavo Madeira Santana
21b63be7ca Matrix: harden live directory lookups 2026-03-12 11:54:30 +00:00
Gustavo Madeira Santana
64946825cf Matrix: centralize target normalization 2026-03-12 11:54:30 +00:00
Gustavo Madeira Santana
84d7863bf4 Matrix: centralize account config helpers 2026-03-12 11:54:30 +00:00
Gustavo Madeira Santana
69d842137f Matrix: warn and clean stale managed devices 2026-03-12 11:54:30 +00:00
Gustavo Madeira Santana
77850b2043 Matrix: fix verification client lifecycle and quiet CLI noise 2026-03-12 11:54:30 +00:00
Gustavo Madeira Santana
a6a5bd0099 Matrix: retry cross-signing after secret storage repair 2026-03-12 11:54:30 +00:00
Gustavo Madeira Santana
fe0cc4b8f0 Matrix: repair explicit secret storage bootstrap 2026-03-12 11:54:29 +00:00
Gustavo Madeira Santana
3e7e919495 Matrix: preserve owner-signed verification state 2026-03-12 11:54:29 +00:00
Gustavo Madeira Santana
febe568327 Plugins: scope SDK imports and harden Matrix routing 2026-03-12 11:54:29 +00:00
Gustavo Madeira Santana
bb6839f565 poll and profile fixes 2026-03-12 11:54:29 +00:00
Gustavo Madeira Santana
99a6d99a00 Matrix: tighten verification trust and expose profile updates 2026-03-12 11:54:29 +00:00
Gustavo Madeira Santana
dfc7d9bb9c Matrix: keep default account device fields scoped 2026-03-12 11:54:29 +00:00
Gustavo Madeira Santana
aa5d29c96a Matrix: replace legacy plugin with new implementation 2026-03-12 11:54:26 +00:00
Peter Steinberger
f4a4b50cd5 refactor: compile allowlist matchers 2026-03-11 00:07:47 +00:00
Peter Steinberger
50ded5052f refactor: share channel config schema fragments 2026-03-10 22:18:04 +00:00
Peter Steinberger
4a8e039a5f refactor: share channel config security scaffolding 2026-03-10 22:18:04 +00:00
Bronko
d4a960fcca fix(matrix): restore robust DM routing without the memberCount heuristic (#19736)
* fix(matrix): remove memberCount heuristic from DM detection

The memberCount === 2 check in isDirectMessage() misclassifies 2-person
group rooms (admin channels, monitoring rooms) as DMs, routing them to
the main session instead of their room-specific session.

Matrix already distinguishes DMs from groups at the protocol level via
m.direct account data and is_direct member state flags. Both are already
checked by client.dms.isDm() and hasDirectFlag(). The memberCount
heuristic only adds false positives for 2-person groups.

Move resolveMemberCount() below the protocol-level checks so it is only
reached for rooms not matched by m.direct or is_direct. This narrows its
role to diagnostic logging for confirmed group rooms.

Refs: #19739

* fix(matrix): add conservative fallback for broken DM flags

Some homeservers (notably Continuwuity) have broken m.direct account
data or never set is_direct on invite events. With the memberCount
heuristic removed, these DMs are no longer detected.

Add a conservative fallback that requires two signals before classifying
as DM: memberCount === 2 AND no explicit m.room.name. Group rooms almost
always have explicit names; DMs almost never do.

Error handling distinguishes M_NOT_FOUND (missing state event, expected
for unnamed rooms) from network/auth errors. Non-404 errors fall through
to group classification rather than guessing.

This is independently revertable — removing this commit restores pure
protocol-based detection without any heuristic fallback.

* fix(matrix): add parentPeer for DM room binding support

Add parentPeer to DM routes so conversations are bindable by room ID
while preserving DM trust semantics (secure 1:1, no group restrictions).

Suggested by @KirillShchetinin.

* fix(matrix): override DM detection for explicitly configured rooms

Builds on @robertcorreiro's config-driven approach from #9106.

Move resolveMatrixRoomConfig() before the DM check. If a room matches
a non-wildcard config entry (matchSource === "direct") and was
classified as DM, override the classification to group. This gives users
a deterministic escape hatch for misclassified rooms.

Wildcards are excluded from the override to avoid breaking DM routing
when a "*" catch-all exists. roomConfig is gated behind isRoom so DMs
never inherit group settings (skills, systemPrompt, autoReply).

This commit is independently droppable if the scope is too broad.

* test(matrix): add DM detection and config override tests

- 15 unit tests for direct.ts: all detection paths, priority order,
  M_NOT_FOUND vs network error handling, edge cases (whitespace names,
  API failures)
- 8 unit tests for rooms.ts: matchSource classification, wildcard
  safety for DM override, direct match priority over wildcard

* Changelog: note matrix DM routing follow-up

* fix(matrix): preserve DM fallback and room bindings

---------

Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
2026-03-08 23:26:48 -05:00
Peter Steinberger
141738f717 refactor: harden browser runtime profile handling 2026-03-09 00:25:43 +00:00
Peter Steinberger
8d7778d1d6 refactor: dedupe plugin runtime stores 2026-03-08 23:38:24 +00:00
Vincent Koc
4b0d55dadf Matrix: use scoped plugin SDK resolve-target imports 2026-03-07 16:26:59 -08:00
Vincent Koc
4b02a4eacf Matrix: use scoped plugin SDK channel imports 2026-03-07 16:26:59 -08:00
Vincent Koc
7c5d6c3dc9 Matrix: default missing media kind to unknown 2026-03-07 16:07:41 -08:00