Skip to content

Commit 1f2e998

Browse files
fix(channels): bundled channels reject the documented responsePrefix override (#118148)
* fix(channels): bundled channels reject the documented responsePrefix override * fix(feishu): pass channel and account to the reply prefix resolver The ordinary reply dispatcher built the prefix context without channel or accountId, so channels.feishu.responsePrefix and its account override fell through to the global value. The comment dispatcher already passed them. * fix(channels): accept twitch's root responsePrefix and type ClickClack's Twitch validates as a two-branch union with both branches closed, so responsePrefix declared only on the account shape left channels.twitch.responsePrefix rejected whenever accounts is present. Also declares responsePrefix on ClickClackAccountConfig so typed callers can express what its schema already accepts. * fix(clickclack): apply the configured responsePrefix in model mode Model mode sends the completion straight to ClickClack instead of going through the agent reply pipeline, so the documented responsePrefix parsed and then did nothing. Resolve it through the public reply-pipeline seam so template variables like {model} render from the completion's own provider and model. * fix(clickclack): do not double the response prefix in model mode systemPrompt is operator-owned, so a model can be instructed to emit the configured prefix itself and the unconditional concatenation then sent it twice. Match the shared reply normalizer's startsWith guard. * test(clickclack): resolve inbound access through the real resolver Main now requires access.channelIngress, which the hand-built fixture did not provide, so the model-mode messages never dispatched. Drop the fixture and let handleClickClackInbound resolve access from a DM-shaped message, matching the sibling bot-loop tests. * test(channels): reject a key missing from any composed branch A union alternative is a configuration mode an operator can pick, so a key present in only one mode is unusable in the other even though the union still validates. Treat any rejecting alternative as a rejection, and walk allOf when collecting account schemas. * fix(channels): offer responsePrefix only where the reply path applies it Applying the prefix to an outbound reply is per-channel wiring, not a shared step. Buzz, Nostr, QA Channel, Raft, Reef and SMS never read it, so accepting the key there validated a setting their delivery path ignores. Anchor the contract to the channels that consume the prefix. * fix(channels): complete shared response prefix delivery Co-authored-by: ayaangazali <[email protected]> * docs(config): refresh response prefix baseline * test(tlon): use canonical prefix fixture helpers * test(channels): prove Twitch reply prefix delivery Exercise schema admission and the real shared reply dispatcher at the Twitch native send boundary, replacing redundant schema-only coverage. Keep Tlon fixtures on canonical imports and recording options. * docs(channels): clarify explicit message prefix behavior --------- Co-authored-by: Peter Steinberger <[email protected]>
1 parent 3dd18cc commit 1f2e998

28 files changed

Lines changed: 611 additions & 164 deletions
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
22
"core": 2358,
3-
"channel": 3636,
3+
"channel": 3643,
44
"plugin": 4046
55
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
965e18819e05c18ef70b4bb5daed9ed7bd4ca38b32fd19f4e5e02b44d2034136 config-baseline.json
1+
344e49725558cf7a68babaf6d4c46ab6fa10a81f77dc93389035847895de450e config-baseline.json
22
173e52ecb34783db1303c1df04d87a0304bdf52c2c4494f984834b7012f26213 config-baseline.core.json
3-
3381bd98091ddce0be17730be345c7c08a30d7681432852c2fd17638933ef0c6 config-baseline.channel.json
3+
a504d47beada75a256ca897dbc64c12dc87af72019ee440cba96083ca4dc8a80 config-baseline.channel.json
44
580d4bb93216d5a12fc715f3fbbaf5fff7bef548237fc168be7dc1a922407567 config-baseline.plugin.json

‎docs/channels/buzz.md‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -400,6 +400,16 @@ directory, but automation should use `buzz:<ROOM_UUID>` to avoid ambiguity.
400400
For manual configuration, `groupAllowFrom` entries must use the 64-character
401401
hexadecimal form.
402402

403+
### Reply prefix
404+
405+
Set `channels.buzz.responsePrefix` to prefix automatic agent replies, for
406+
example `"[Support]"`. Use `"auto"` for the routed agent's identity name,
407+
`"[{model}]"` for its selected model, or `""` to disable an inherited global
408+
prefix. Explicit `message` tool and CLI text sends also apply literal and
409+
identity prefixes; see [shared prefix behavior](/concepts/messages#prefixes-threading-and-replies)
410+
for model-dependent templates. Buzz uses one account per Gateway, so there is
411+
no nested `accounts` override.
412+
403413
### Bot key storage
404414

405415
The default guided path reuses the current bot identity or generates a private

‎docs/channels/clickclack.md‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,13 @@ safety bound can omit an older active thread.
301301
- `replyMode: "agent"` (default) dispatches inbound messages through the normal agent pipeline, including session recording and tool policy.
302302
- `replyMode: "model"` skips the agent pipeline and uses the plugin runtime's `llm.complete` for direct bot replies, optionally shaped by `model` and `systemPrompt`. The selected provider and model own the completion budget.
303303

304+
Both modes honor `responsePrefix` at the channel or account level. Account
305+
values win, including `""` to disable an inherited prefix. Use `"auto"` for
306+
the routed agent's identity name or `"[{model}]"` for the selected model.
307+
Explicit `message` tool and CLI text sends follow the
308+
[shared prefix behavior](/concepts/messages#prefixes-threading-and-replies),
309+
including omission of unresolved model-dependent prefixes.
310+
304311
Model mode runs completions against the resolved bot agent id, which requires
305312
the explicit `plugins.entries.clickclack.llm.allowAgentIdOverride: true` trust
306313
bit:

‎docs/channels/qa-channel.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ Account keys:
4040

4141
- `enabled` - master toggle for this account.
4242
- `name` - optional display label.
43+
- `responsePrefix` - automatic reply prefix; account overrides win. Accepts a literal, `"auto"` for the agent identity name, a template such as `"[{model}]"`, or `""` to disable an inherited prefix.
4344
- `baseUrl` - synthetic bus URL. The account counts as configured once this is set.
4445
- `botUserId` - synthetic bot user id used in target grammar (default: `openclaw`).
4546
- `botDisplayName` - display name for outbound messages (default: `OpenClaw QA`).

‎docs/channels/tlon.md‎

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -290,26 +290,26 @@ Common failures:
290290

291291
Full configuration: [Configuration](/gateway/configuration)
292292

293-
| Key | Meaning |
294-
| ------------------------------------------------------ | -------------------------------------------------------------- |
295-
| `channels.tlon.enabled` | Enable/disable channel startup. |
296-
| `channels.tlon.ship` | Bot's Urbit ship name (e.g. `~sampel-palnet`). |
297-
| `channels.tlon.url` | Ship URL (e.g. `https://sampel-palnet.tlon.network`). |
298-
| `channels.tlon.code` | Ship login code. |
299-
| `channels.tlon.network.dangerouslyAllowPrivateNetwork` | Allow localhost/LAN ship URLs (SSRF opt-in). |
300-
| `channels.tlon.ownerShip` | Owner ship: always authorized, receives approval requests. |
301-
| `channels.tlon.dmAllowlist` | Ships allowed to DM (empty = none besides owner). |
302-
| `channels.tlon.autoAcceptDmInvites` | Auto-accept DMs from ships in `dmAllowlist`. |
303-
| `channels.tlon.autoAcceptGroupInvites` | Auto-accept group invites from `groupInviteAllowlist`. |
304-
| `channels.tlon.groupInviteAllowlist` | Ships whose group invites are auto-accepted. |
305-
| `channels.tlon.autoDiscoverChannels` | Auto-discover joined group channels (default: `false`). |
306-
| `channels.tlon.implicitMentions.threadParticipation` | Let participated-thread follow-ups bypass mention gating. |
307-
| `channels.tlon.groupChannels` | Manually pinned channel nests. |
308-
| `channels.tlon.defaultAuthorizedShips` | Ships authorized for all channels (used when no rule matches). |
309-
| `channels.tlon.authorization.channelRules` | Per-channel-nest auth mode + allowlist. |
310-
| `channels.tlon.showModelSignature` | Append `_[Generated by <model>]_` to replies. |
311-
| `channels.tlon.responsePrefix` | Static prefix prepended to outbound replies. |
312-
| `channels.tlon.accounts.<id>` | Additional named accounts (multi-ship setups). |
293+
| Key | Meaning |
294+
| ------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------- |
295+
| `channels.tlon.enabled` | Enable/disable channel startup. |
296+
| `channels.tlon.ship` | Bot's Urbit ship name (e.g. `~sampel-palnet`). |
297+
| `channels.tlon.url` | Ship URL (e.g. `https://sampel-palnet.tlon.network`). |
298+
| `channels.tlon.code` | Ship login code. |
299+
| `channels.tlon.network.dangerouslyAllowPrivateNetwork` | Allow localhost/LAN ship URLs (SSRF opt-in). |
300+
| `channels.tlon.ownerShip` | Owner ship: always authorized, receives approval requests. |
301+
| `channels.tlon.dmAllowlist` | Ships allowed to DM (empty = none besides owner). |
302+
| `channels.tlon.autoAcceptDmInvites` | Auto-accept DMs from ships in `dmAllowlist`. |
303+
| `channels.tlon.autoAcceptGroupInvites` | Auto-accept group invites from `groupInviteAllowlist`. |
304+
| `channels.tlon.groupInviteAllowlist` | Ships whose group invites are auto-accepted. |
305+
| `channels.tlon.autoDiscoverChannels` | Auto-discover joined group channels (default: `false`). |
306+
| `channels.tlon.implicitMentions.threadParticipation` | Let participated-thread follow-ups bypass mention gating. |
307+
| `channels.tlon.groupChannels` | Manually pinned channel nests. |
308+
| `channels.tlon.defaultAuthorizedShips` | Ships authorized for all channels (used when no rule matches). |
309+
| `channels.tlon.authorization.channelRules` | Per-channel-nest auth mode + allowlist. |
310+
| `channels.tlon.showModelSignature` | Append `_[Generated by <model>]_` to replies. |
311+
| `channels.tlon.responsePrefix` | Automatic reply prefix: literal, `"auto"`, or a template such as `"[{model}]"`; account overrides win, and `""` disables it. |
312+
| `channels.tlon.accounts.<id>` | Additional named accounts (multi-ship setups). |
313313

314314
## Notes
315315

‎docs/concepts/messages.md‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,8 @@ Details: [Thinking + reasoning directives](/tools/thinking) and [Token use](/ref
139139

140140
## Prefixes, threading, and replies
141141

142-
- Outbound prefixes live at `channels.<channel>.responsePrefix` and `channels.<channel>.accounts.<id>.responsePrefix`. Account values win. Doctor copies the global fallback into configured channel blocks when those canonical fields are unset; `messages.responsePrefix` remains as a fallback for implicit and custom channels.
142+
- Channels with reply-prefix support use `channels.<channel>.responsePrefix` and, when multi-account configuration is supported, `channels.<channel>.accounts.<id>.responsePrefix`. Account values win, including `""` to disable an inherited prefix. Use `"auto"` for the agent identity name or templates such as `"[{model}]"` for the selected model. Automatic-reply support is channel-specific. Doctor copies the global fallback into supported configured channel blocks when those canonical fields are unset; `messages.responsePrefix` remains as a fallback for implicit and custom channels.
143+
- Explicit `message` tool and CLI text sends also apply the resolved prefix, without duplicating a prefix already present. They resolve identity placeholders but do not select a model; a prefix containing unresolved model, provider, or thinking-level placeholders is omitted entirely.
143144
- Reply threading via `replyToMode` and per-channel defaults.
144145

145146
Details: [Configuration](/gateway/config-agents#messages) and channel docs.

‎extensions/buzz/openclaw.plugin.json‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@
2626
"enabled": {
2727
"type": "boolean"
2828
},
29+
"responsePrefix": {
30+
"type": "string"
31+
},
2932
"markdown": {
3033
"type": "object",
3134
"properties": {

‎extensions/buzz/src/config-schema.test.ts‎

Lines changed: 30 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,18 @@ import { validateJsonSchemaValue } from "openclaw/plugin-sdk/json-schema-runtime
33
import { describe, expect, it } from "vitest";
44
import { BuzzConfigSchema } from "./config-schema.js";
55

6+
const pluginManifest = JSON.parse(
7+
readFileSync(new URL("../openclaw.plugin.json", import.meta.url), "utf8"),
8+
) as {
9+
channelConfigs: {
10+
buzz: { schema: Parameters<typeof validateJsonSchemaValue>[0]["schema"] };
11+
};
12+
};
13+
const configSchemas = [
14+
["runtime", BuzzConfigSchema.schema],
15+
["manifest", pluginManifest.channelConfigs.buzz.schema],
16+
] as const;
17+
618
function parseBuzzConfig(value: unknown) {
719
const runtime = BuzzConfigSchema.runtime;
820
if (!runtime) {
@@ -24,6 +36,23 @@ function expectRelayUrlValidity(relayUrl: string, valid: boolean) {
2436
}
2537

2638
describe("BuzzConfigSchema", () => {
39+
it.each(["[bot]", "auto", "", "[{model}]"])(
40+
"accepts responsePrefix %j in runtime and manifest schemas",
41+
(responsePrefix) => {
42+
const config = { groupPolicy: "allowlist", responsePrefix };
43+
expect(parseBuzzConfig(config).success).toBe(true);
44+
for (const [name, schema] of configSchemas) {
45+
expect(
46+
validateJsonSchemaValue({
47+
cacheKey: `buzz.config-schema.prefix.${name}`,
48+
schema,
49+
value: config,
50+
}).ok,
51+
).toBe(true);
52+
}
53+
},
54+
);
55+
2756
it.each([
2857
"ws://localhost:3000",
2958
"wss://buzz.example.com/relay",
@@ -72,17 +101,7 @@ describe("BuzzConfigSchema", () => {
72101
};
73102

74103
expect(parseBuzzConfig(config).success).toBe(true);
75-
const pluginManifest = JSON.parse(
76-
readFileSync(new URL("../openclaw.plugin.json", import.meta.url), "utf8"),
77-
) as {
78-
channelConfigs: {
79-
buzz: { schema: Parameters<typeof validateJsonSchemaValue>[0]["schema"] };
80-
};
81-
};
82-
for (const [name, schema] of [
83-
["runtime", BuzzConfigSchema.schema],
84-
["manifest", pluginManifest.channelConfigs.buzz.schema],
85-
] as const) {
104+
for (const [name, schema] of configSchemas) {
86105
expect(
87106
validateJsonSchemaValue({
88107
cacheKey: `buzz.config-schema.room-sender-policy.${name}`,

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ const RawBuzzConfigSchema = z
2121
name: z.string().optional(),
2222
enabled: z.boolean().optional(),
2323
configWrites: z.boolean().optional(),
24+
responsePrefix: z.string().optional(),
2425
markdown: MarkdownConfigSchema,
2526
relayUrl: z
2627
.string()

0 commit comments

Comments
 (0)