fix(matrix): keep DM invite promotion stable

This commit is contained in:
Gustavo Madeira Santana 2026-03-30 23:29:24 -04:00
parent a06ec156fc
commit 4209cf3509
No known key found for this signature in database
5 changed files with 6 additions and 5 deletions

View File

@ -140,7 +140,7 @@ Docs: https://docs.openclaw.ai
- xAI/Responses: normalize image-bearing tool results for xAI responses payloads, including OpenResponses-style `input_image.source` parts, so image tool replays no longer 422 on the follow-up turn. (#58017) Thanks @neeravmakwana.
- Cron/isolated sessions: carry the full live-session provider, model, and auth-profile selection across retry restarts so cron jobs with model overrides no longer fail or loop on mid-run model-switch requests. (#57972) Thanks @issaba1.
- Matrix/direct rooms: stop trusting remote `is_direct`, honor explicit local `is_direct: false` for discovered DM candidates, and avoid extra member-state lookups for shared rooms so DM routing and repair stay aligned. (#57124) Thanks @w-sss.
- Matrix/DM threads: only promote fresh invite rooms when Matrix marks the invite as direct, keep failed local DM repairs stable across later replies, and keep thread-isolated Matrix sessions reporting the correct route policy.
- Matrix/DM threads: keep strict unnamed fresh-invite rooms promotable even when Matrix omits the optional direct hint, preserve repair-failed local DM promotions across later member churn, and keep thread-isolated Matrix sessions reporting the correct route policy. (#58099) Thanks @gumadeiras.
- Agents/sandbox: make remote FS bridge reads pin the parent path and open the file atomically in the helper so read access cannot race path resolution. Thanks @AntAISecurityLab and @vincentkoc.
- Tools/web_fetch: add an explicit trusted env-proxy path for proxy-only installs while keeping strict SSRF fetches on the pinned direct path, so trusted proxy routing does not weaken strict destination binding. (#50650) Thanks @kkav004.
- Exec/env: block Python package index override variables from request-scoped host exec environment sanitization so package fetches cannot be redirected through a caller-supplied index. Thanks @nexrin and @vincentkoc.

View File

@ -341,6 +341,8 @@ describe("createDirectRoomTracker", () => {
}),
).resolves.toBe(true);
tracker.invalidateRoom("!room:example.org");
vi.setSystemTime(new Date("2026-03-30T23:01:00Z"));
await expect(

View File

@ -154,7 +154,6 @@ export function createDirectRoomTracker(client: MatrixClient, opts: DirectRoomTr
directMemberFlagCache.delete(key);
}
}
locallyPromotedDirectRooms.delete(roomId);
lastDmUpdateMs = 0;
log(`matrix: invalidated dm cache room=${roomId}`);
},

View File

@ -306,7 +306,7 @@ describe("registerMatrixMonitorEvents verification routing", () => {
expect(rememberInvite).not.toHaveBeenCalled();
});
it("does not remember invite provenance when Matrix does not mark the invite as direct", async () => {
it("remembers invite provenance even when Matrix omits the direct invite hint", async () => {
const { invalidateRoom, rememberInvite, roomInviteListener } = createHarness();
if (!roomInviteListener) {
throw new Error("room.invite listener was not registered");
@ -324,7 +324,7 @@ describe("registerMatrixMonitorEvents verification routing", () => {
});
expect(invalidateRoom).toHaveBeenCalledWith("!room:example.org");
expect(rememberInvite).not.toHaveBeenCalled();
expect(rememberInvite).toHaveBeenCalledWith("!room:example.org", "@alice:example.org");
});
it("does not synthesize invite provenance from room joins", async () => {

View File

@ -131,7 +131,7 @@ export function registerMatrixMonitorEvents(params: {
const senderIsInvitee =
typeof event?.sender === "string" && invitee && event.sender.trim() === invitee;
const isDirect = (event?.content as { is_direct?: boolean } | undefined)?.is_direct === true;
if (isDirect && typeof event?.sender === "string" && event.sender.trim() && !senderIsInvitee) {
if (typeof event?.sender === "string" && event.sender.trim() && !senderIsInvitee) {
directTracker?.rememberInvite?.(roomId, event.sender);
}
logVerboseMessage(