Commit Graph

266 Commits

Author SHA1 Message Date
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
ce5dd742f8 build: sync versions to 2026.3.11 2026-03-12 04:01:57 +00:00
Peter Steinberger
0e397e62b7 chore: bump version to 2026.3.10 2026-03-11 23:29:53 +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
Peter Steinberger
f6d0712f50 build: sync plugin versions for 2026.3.9 2026-03-09 08:39:52 +00:00
Peter Steinberger
5fca4c0de0 chore: prepare 2026.3.8-beta.1 release 2026-03-09 07:09:37 +00:00
Peter Steinberger
2e79d82198 build: update app deps except carbon 2026-03-09 06:09:33 +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
Peter Steinberger
64d4d9aabb refactor: move bundled extension gap allowlists into manifests 2026-03-08 18:26:35 +00:00
Peter Steinberger
05217845a7 build: bump version to 2026.3.8 2026-03-08 05:59:04 +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
Peter Steinberger
cc03c097c5 refactor: share provider group-policy warning collectors 2026-03-08 00:05:24 +00:00
Peter Steinberger
846ec320e2 refactor: share account-scoped config adapter accessors 2026-03-08 00:05:24 +00:00
Peter Steinberger
c9128e1f3f refactor: share trimmed list normalization in provider helpers 2026-03-07 23:27:51 +00:00
Peter Steinberger
556aa8a702 refactor: share config adapter allowFrom and defaultTo helpers 2026-03-07 23:27:51 +00:00
Peter Steinberger
c91bfa830a refactor: share route-level group gating decisions 2026-03-07 23:27:51 +00:00
Peter Steinberger
5bbca5be91 refactor: share sender-scoped group policy derivation 2026-03-07 23:27:51 +00:00
Peter Steinberger
b456649974 refactor: unify account-scoped dm security policy resolver 2026-03-07 23:27:51 +00:00
Peter Steinberger
7230b96cc7 refactor: unify extension allowlist resolver and directory scaffolding 2026-03-07 23:27:51 +00:00
Peter Steinberger
8e0e76697a refactor: unify channel open-group-policy warning builders 2026-03-07 23:27:51 +00:00
Peter Steinberger
5eba663c38 refactor: unify onboarding secret-input prompt state wiring 2026-03-07 23:27:51 +00:00
Peter Steinberger
6b1c82c4f1 refactor: unify onboarding dm/group policy scaffolding 2026-03-07 23:27:51 +00:00