Skip to content

Commit 4426f8d

Browse files
fix(channels): honor supported account reply-threading policies (#129679)
* fix(channels): honor supported account reply-threading policies Co-authored-by: ayaangazali <[email protected]> * fix(channels): document valid account reply policies Co-authored-by: ayaangazali <[email protected]> --------- Co-authored-by: ayaangazali <[email protected]>
1 parent f0a2920 commit 4426f8d

14 files changed

Lines changed: 96 additions & 22 deletions

File tree

‎docs/channels/feishu.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -646,6 +646,7 @@ Full configuration: [Gateway configuration](/gateway/configuration)
646646
| `channels.feishu.accounts.<id>.appId` | App ID | - |
647647
| `channels.feishu.accounts.<id>.appSecret` | App Secret | - |
648648
| `channels.feishu.accounts.<id>.domain` | Per-account domain override | `feishu` |
649+
| `channels.feishu.accounts.<id>.replyToMode` | Per-account reply-reference mode | inherited |
649650
| `channels.feishu.accounts.<id>.tts` | Per-account TTS override | `tts` |
650651
| `channels.feishu.dmPolicy` | DM policy (`pairing`, `allowlist`, `open`) | `pairing` |
651652
| `channels.feishu.allowFrom` | DM allowlist (open_id list) | - |
@@ -658,6 +659,7 @@ Full configuration: [Gateway configuration](/gateway/configuration)
658659
| `channels.feishu.groups.<chat_id>.enabled` | Enable/disable a specific group | `true` |
659660
| `channels.feishu.groups.<chat_id>.allowFrom` | Per-group sender allowlist (overrides `groupSenderAllowFrom`) | - |
660661
| `channels.feishu.groupSessionScope` | Group session mapping (`group`, `group_sender`, `group_topic`, `group_topic_sender`) | `group` |
662+
| `channels.feishu.replyToMode` | Reply-reference mode (`off`, `first`, `all`, `batched`) | `all` |
661663
| `channels.feishu.replyInThread` | Bot replies create/continue topic threads (`disabled`, `enabled`) | `disabled` |
662664
| `channels.feishu.reactionNotifications` | Inbound reaction events (`off`, `own`, `all`) | `own` |
663665
| `channels.feishu.vcAutoJoin` | Join invited VC meetings after normal DM authorization | `false` |

‎docs/channels/irc.md‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,11 @@ IRC does not provide a replayable delivery ID or resend messages missed by a dis
6060
| `realname` | `OpenClaw` | Realname/GECOS field |
6161
| `password` / `passwordFile` | none | Server password; file must be a regular file |
6262
| `channels` | none | Channels to join (`["#openclaw"]`) |
63+
| `replyToMode` | `all` | Reply-reference mode: `off`, `first`, `all`, or `batched` |
6364
| `accounts` / `defaultAccount` | none | Multi-account setup; env vars fill only the default account |
6465

66+
Named accounts inherit the channel-wide reply mode; override it with `channels.irc.accounts.<id>.replyToMode`.
67+
6568
## Security defaults
6669

6770
- IRC uses raw TCP/TLS sockets outside OpenClaw operator-managed forward proxy routing. In deployments that require all egress through that forward proxy, set `channels.irc.enabled=false` unless direct IRC egress is explicitly approved.

‎docs/channels/nextcloud-talk.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ Provider options:
160160
- `channels.nextcloud-talk.streaming.chunkMode`: `length` (default) or `newline` to split on blank lines (paragraph boundaries) before length chunking.
161161
- `channels.nextcloud-talk.streaming.block.enabled`: enable or disable block streaming for this channel.
162162
- `channels.nextcloud-talk.streaming.block.coalesce`: block streaming coalesce tuning.
163+
- `channels.nextcloud-talk.replyToMode`: reply-reference mode (`off | first | all | batched`; default: `all`). Named accounts can override it with `channels.nextcloud-talk.accounts.<id>.replyToMode`.
163164
- `channels.nextcloud-talk.responsePrefix`: outbound reply prefix.
164165
- `channels.nextcloud-talk.markdown.tables`: markdown table rendering mode (`off | bullets | code | block`).
165166
- `channels.nextcloud-talk.mediaMaxMb`: inbound media cap (MB).

‎extensions/feishu/src/config-schema.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { normalizeAccountId } from "openclaw/plugin-sdk/account-id";
33
import {
44
DmPolicySchema,
55
GroupPolicySchema,
6+
ReplyToModeSchema,
67
buildChannelConfigSchema,
78
buildGroupEntrySchema,
89
buildMultiAccountChannelSchema,
@@ -204,6 +205,7 @@ const FeishuSharedConfigShape = {
204205
capabilities: z.array(z.string()).optional(),
205206
markdown: MarkdownConfigSchema,
206207
configWrites: z.boolean().optional(),
208+
replyToMode: ReplyToModeSchema.optional(),
207209
dmPolicy: DmPolicySchema.optional(),
208210
allowFrom: z.array(z.union([z.string(), z.number()])).optional(),
209211
groupPolicy: FeishuGroupPolicySchema.optional(),

‎extensions/irc/src/config-schema.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {
55
GroupPolicySchema,
66
MarkdownConfigSchema,
77
ReplyRuntimeConfigSchemaShape,
8+
ReplyToModeSchema,
89
buildChannelConfigSchema,
910
buildMultiAccountChannelSchema,
1011
requireOpenAllowFrom,
@@ -37,6 +38,7 @@ const IrcAccountSchemaBase = z
3738
name: z.string().optional(),
3839
enabled: z.boolean().optional(),
3940
configWrites: z.boolean().optional(),
41+
replyToMode: ReplyToModeSchema.optional(),
4042
dangerouslyAllowNameMatching: z.boolean().optional(),
4143
host: z.string().optional(),
4244
port: z.number().int().min(1).max(65535).optional(),

‎extensions/irc/src/runtime-api.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ export type {
1414
GroupToolPolicyBySenderConfig,
1515
GroupToolPolicyConfig,
1616
MarkdownConfig,
17+
ReplyToMode,
1718
} from "openclaw/plugin-sdk/config-contracts";
1819
export type { OutboundReplyPayload } from "openclaw/plugin-sdk/reply-payload";
1920
export { DEFAULT_ACCOUNT_ID } from "openclaw/plugin-sdk/account-id";

‎extensions/irc/src/types.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import type {
88
GroupToolPolicyConfig,
99
MarkdownConfig,
1010
OpenClawConfig,
11+
ReplyToMode,
1112
BaseProbeResult,
1213
} from "./runtime-api.js";
1314

@@ -33,6 +34,7 @@ export type IrcNickServConfig = {
3334
export type IrcAccountConfig = {
3435
name?: string;
3536
enabled?: boolean;
37+
replyToMode?: ReplyToMode;
3638
/** Allow channel-initiated config writes (default: true). */
3739
configWrites?: boolean;
3840
/**

‎extensions/nextcloud-talk/src/config-schema.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import {
44
GroupPolicySchema,
55
MarkdownConfigSchema,
66
ReplyRuntimeConfigSchemaShape,
7+
ReplyToModeSchema,
78
buildGroupEntrySchema,
89
buildMultiAccountChannelSchema,
910
requireOpenAllowFrom,
@@ -29,6 +30,7 @@ const NextcloudTalkAccountSchemaBase = z
2930
name: z.string().optional(),
3031
enabled: z.boolean().optional(),
3132
configWrites: z.boolean().optional(),
33+
replyToMode: ReplyToModeSchema.optional(),
3234
markdown: MarkdownConfigSchema,
3335
baseUrl: z.string().optional(),
3436
botSecret: buildSecretInputSchema().optional(),

‎extensions/nextcloud-talk/src/types.ts‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import type {
33
ChannelDeliveryStreamingConfig,
44
MessageReceipt,
55
} from "openclaw/plugin-sdk/channel-outbound";
6+
import type { ReplyToMode } from "openclaw/plugin-sdk/config-contracts";
67
import type {
78
DmConfig,
89
DmPolicy,
@@ -35,6 +36,8 @@ export type NextcloudTalkAccountConfig = {
3536
name?: string;
3637
/** If false, do not start this Nextcloud Talk account. Default: true. */
3738
enabled?: boolean;
39+
/** Reply-threading mode for this account. */
40+
replyToMode?: ReplyToMode;
3841
/** Base URL of the Nextcloud instance (e.g., "https://cloud.example.com"). */
3942
baseUrl?: string;
4043
/** Bot shared secret from occ talk:bot:install output. */

‎src/auto-reply/reply/reply-threading.test.ts‎

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,31 @@ describe("resolveReplyToMode", () => {
134134
expect(resolveReplyDeliveryAccountId(emptyCfg, "whatsapp")).toBe("work");
135135
expect(resolveReplyDeliveryAccountId(emptyCfg, "whatsapp", "personal")).toBe("personal");
136136
});
137+
138+
it("applies canonical account policy before channel-wide threading defaults", () => {
139+
setActivePluginRegistry(
140+
createTestRegistry([
141+
{ pluginId: "irc", source: "test", plugin: createChannelTestPluginBase({ id: "irc" }) },
142+
]),
143+
);
144+
const cfg: OpenClawConfig = {
145+
channels: {
146+
irc: {
147+
replyToMode: "off",
148+
accounts: {
149+
"Ops Team": { replyToMode: "all" },
150+
support: { replyToMode: "first" },
151+
},
152+
},
153+
},
154+
};
155+
156+
expect(resolveReplyToMode(cfg, "irc", "ops-team", "group")).toBe("all");
157+
expect(resolveReplyToMode(cfg, "irc", "OPS TEAM", "direct")).toBe("all");
158+
expect(resolveReplyToMode(cfg, "irc", "support", "group")).toBe("first");
159+
expect(resolveReplyToMode(cfg, "irc", "unknown", "group")).toBe("off");
160+
expect(resolveReplyToMode(cfg, "irc", null, "direct")).toBe("off");
161+
});
137162
});
138163

139164
describe("createReplyToModeFilterForChannel", () => {

0 commit comments

Comments
 (0)