Skip to content

Commit 9a364d5

Browse files
committed
Auto-merge upstream openclaw/openclaw
2 parents bfbb92a + 3608028 commit 9a364d5

100 files changed

Lines changed: 6583 additions & 2322 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ Docs: https://docs.openclaw.ai
5151

5252
- Security: preserve restrictive plugin-only tool allowlists, require owner access for `/allowlist add` and `/allowlist remove`, fail closed when `before_tool_call` hooks crash, block browser SSRF redirect bypasses earlier, and keep non-interactive auth-choice inference scoped to bundled and already-trusted plugins. (#58476, #59836, #59822, #58771, #59120) Thanks @eleqtrizit and @pgondhi987.
5353
- Auto-reply: unify reply lifecycle ownership across preflight compaction, session rotation, CLI-backed runs, and gateway restart handling so `/stop` and same-session overlap checks target the right active turn and restart-interrupted turns return the restart notice instead of being silently dropped. (#61267) Thanks @dutifulbob.
54+
- Exec/remote skills: stop advertising `exec host=node` when the current exec policy cannot route to a node, and clarify blocked exec-host override errors with both the requested host and allowed config path.
5455
- Agents/Claude CLI/security: clear inherited Claude Code config-root and plugin-root env overrides like `CLAUDE_CONFIG_DIR` and `CLAUDE_CODE_PLUGIN_*`, so OpenClaw-launched Claude CLI runs cannot be silently pointed at an alternate Claude config/plugin tree with different hooks, plugins, or auth context. Thanks @vincentkoc.
5556
- Agents/Claude CLI/security: clear inherited Claude Code provider-routing and managed-auth env overrides, and mark OpenClaw-launched Claude CLI runs as host-managed, so Claude CLI backdoor sessions cannot be silently redirected to proxy, Bedrock, Vertex, Foundry, or parent-managed token contexts. Thanks @vincentkoc.
5657
- Agents/Claude CLI/security: force host-managed Claude CLI backdoor runs to `--setting-sources user`, even under custom backend arg overrides, so repo-local `.claude` project/local settings, hooks, and plugin discovery do not silently execute inside non-interactive OpenClaw sessions. Thanks @vincentkoc.
@@ -200,6 +201,7 @@ Docs: https://docs.openclaw.ai
200201
- Agents/video generation: accept `agents.defaults.videoGenerationModel` in strict config validation and `openclaw config set/get`, so gateways using `video_generate` no longer fail to boot after enabling a video model.
201202
- Discord/image generation: persist volatile workspace-generated media into durable outbound media before final reply delivery so generated image replies stop failing with missing local workspace paths.
202203
- Matrix: move legacy top-level `avatarUrl` into the default account during multi-account promotion and keep env-backed account setup avatar config persisted. (#61437) Thanks @gumadeiras.
204+
- Matrix/DM sessions: add `channels.matrix.dm.sessionScope`, shared-session collision notices, and aligned outbound session reuse so separate Matrix DM rooms can keep distinct context when configured. (#61373) Thanks @gumadeiras.
203205

204206
## 2026.4.2
205207

docs/channels/matrix.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ This is a practical baseline config with DM pairing, room allowlist, and E2EE en
152152

153153
dm: {
154154
policy: "pairing",
155+
sessionScope: "per-room",
155156
threadReplies: "off",
156157
},
157158

@@ -522,12 +523,17 @@ The repair flow does not delete old rooms automatically. It only picks the healt
522523

523524
Matrix supports native Matrix threads for both automatic replies and message-tool sends.
524525

526+
- `dm.sessionScope: "per-user"` (default) keeps Matrix DM routing sender-scoped, so multiple DM rooms can share one session when they resolve to the same peer.
527+
- `dm.sessionScope: "per-room"` isolates each Matrix DM room into its own session key while still using normal DM auth and allowlist checks.
528+
- Explicit Matrix conversation bindings still win over `dm.sessionScope`, so bound rooms and threads keep their chosen target session.
525529
- `threadReplies: "off"` keeps replies top-level and keeps inbound threaded messages on the parent session.
526530
- `threadReplies: "inbound"` replies inside a thread only when the inbound message was already in that thread.
527531
- `threadReplies: "always"` keeps room replies in a thread rooted at the triggering message and routes that conversation through the matching thread-scoped session from the first triggering message.
528532
- `dm.threadReplies` overrides the top-level setting for DMs only. For example, you can keep room threads isolated while keeping DMs flat.
529533
- Inbound threaded messages include the thread root message as extra agent context.
530534
- Message-tool sends now auto-inherit the current Matrix thread when the target is the same room, or the same DM user target, unless an explicit `threadId` is provided.
535+
- Same-session DM user-target reuse only kicks in when the current session metadata proves the same DM peer on the same Matrix account; otherwise OpenClaw falls back to normal user-scoped routing.
536+
- When OpenClaw sees a Matrix DM room collide with another DM room on the same shared Matrix DM session, it posts a one-time `m.notice` in that room with the `/focus` escape hatch when thread bindings are enabled and the `dm.sessionScope` hint.
531537
- Runtime thread bindings are supported for Matrix. `/focus`, `/unfocus`, `/agents`, `/session idle`, `/session max-age`, and thread-bound `/acp spawn` now work in Matrix rooms and DMs.
532538
- Top-level Matrix room/DM `/focus` creates a new Matrix thread and binds it to the target session when `threadBindings.spawnSubagentSessions=true`.
533539
- Running `/focus` or `/acp spawn --thread here` inside an existing Matrix thread binds that current thread instead.
@@ -842,8 +848,9 @@ Live directory lookup uses the logged-in Matrix account:
842848
- `mediaMaxMb`: media size cap in MB for Matrix media handling. It applies to outbound sends and inbound media processing.
843849
- `autoJoin`: invite auto-join policy (`always`, `allowlist`, `off`). Default: `off`.
844850
- `autoJoinAllowlist`: rooms/aliases allowed when `autoJoin` is `allowlist`. Alias entries are resolved to room IDs during invite handling; OpenClaw does not trust alias state claimed by the invited room.
845-
- `dm`: DM policy block (`enabled`, `policy`, `allowFrom`, `threadReplies`).
851+
- `dm`: DM policy block (`enabled`, `policy`, `allowFrom`, `sessionScope`, `threadReplies`).
846852
- `dm.allowFrom` entries should be full Matrix user IDs unless you already resolved them through live directory lookup.
853+
- `dm.sessionScope`: `per-user` (default) or `per-room`. Use `per-room` when you want each Matrix DM room to keep separate context even if the peer is the same.
847854
- `dm.threadReplies`: DM-only thread policy override (`off`, `inbound`, `always`). It overrides the top-level `threadReplies` setting for both reply placement and session isolation in DMs.
848855
- `execApprovals`: Matrix-native exec approval delivery (`enabled`, `approvers`, `target`, `agentFilter`, `sessionFilter`).
849856
- `execApprovals.approvers`: Matrix user IDs allowed to approve exec requests. Optional when `dm.allowFrom` already identifies the approvers.

docs/gateway/configuration-reference.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -655,6 +655,7 @@ Matrix is extension-backed and configured under `channels.matrix`.
655655
- `sessionFilter`: optional session key patterns (substring or regex).
656656
- `target`: where to send approval prompts. `"dm"` (default), `"channel"` (originating room), or `"both"`.
657657
- Per-account overrides: `channels.matrix.accounts.<id>.execApprovals`.
658+
- `channels.matrix.dm.sessionScope` controls how Matrix DMs group into sessions: `per-user` (default) shares by routed peer, while `per-room` isolates each DM room.
658659
- Matrix status probes and live directory lookups use the same proxy policy as runtime traffic.
659660
- Full Matrix configuration, targeting rules, and setup examples are documented in [Matrix](/channels/matrix).
660661

docs/pi.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -503,7 +503,7 @@ if (sandboxRoot) {
503503

504504
- Refusal magic string scrubbing
505505
- Turn validation for consecutive roles
506-
- Claude Code parameter compatibility
506+
- Strict upstream Pi tool parameter validation
507507

508508
### Google/Gemini
509509

extensions/matrix/src/config-schema.test.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,18 @@ describe("MatrixConfigSchema SecretInput", () => {
3131
expect(result.success).toBe(true);
3232
});
3333

34+
it("accepts dm sessionScope overrides", () => {
35+
const result = MatrixConfigSchema.safeParse({
36+
homeserver: "https://matrix.example.org",
37+
accessToken: "token",
38+
dm: {
39+
policy: "pairing",
40+
sessionScope: "per-room",
41+
},
42+
});
43+
expect(result.success).toBe(true);
44+
});
45+
3446
it("accepts room-level account assignments", () => {
3547
const result = MatrixConfigSchema.safeParse({
3648
homeserver: "https://matrix.example.org",

extensions/matrix/src/config-schema.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ export const MatrixConfigSchema = z.object({
104104
autoJoinAllowlist: AllowFromListSchema,
105105
groupAllowFrom: AllowFromListSchema,
106106
dm: buildNestedDmConfigSchema({
107+
sessionScope: z.enum(["per-user", "per-room"]).optional(),
107108
threadReplies: z.enum(["off", "inbound", "always"]).optional(),
108109
}),
109110
execApprovals: matrixExecApprovalsSchema,

extensions/matrix/src/matrix/monitor/handler.test-helpers.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ type MatrixHandlerTestHarnessOptions = {
3131
replyToMode?: ReplyToMode;
3232
threadReplies?: "off" | "inbound" | "always";
3333
dmThreadReplies?: "off" | "inbound" | "always";
34+
dmSessionScope?: "per-user" | "per-room";
3435
streaming?: "partial" | "off";
3536
blockStreamingEnabled?: boolean;
3637
dmEnabled?: boolean;
@@ -214,6 +215,7 @@ export function createMatrixHandlerTestHarness(
214215
replyToMode: options.replyToMode ?? "off",
215216
threadReplies: options.threadReplies ?? "inbound",
216217
dmThreadReplies: options.dmThreadReplies,
218+
dmSessionScope: options.dmSessionScope,
217219
streaming: options.streaming ?? "off",
218220
blockStreamingEnabled: options.blockStreamingEnabled ?? false,
219221
dmEnabled: options.dmEnabled ?? true,

0 commit comments

Comments
 (0)