Skip to content

Commit 7133305

Browse files
authored
fix(config): reject ignored audio transcription settings (#109226)
* fix(config): reject retired audio transcription config * fix(config): align dead audio cleanup contracts * fix(doctor): detect retired audio config
1 parent b35fc16 commit 7133305

16 files changed

Lines changed: 44 additions & 100 deletions
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
644812f4bad7795ad2176e518ac1d2a7aed65ba004d738c31b08bea899793179 config-baseline.json
2-
bffe3c4e08c881864a08c48a4d633328dc8ed2ad902f2e127af57f3a75cceb30 config-baseline.core.json
3-
b03d17b85699d6afaee87ec6f5a71e5f0ab0e12ec12d7a57a06b9ab076c466a6 config-baseline.channel.json
4-
94c4a99b19db7e1e3b516e491000b402ad419787026e94aade8b235ca0a27b04 config-baseline.plugin.json
1+
dd14463b775df18f8d4d3daa9be29c600b84231a7a1aed7a5cc536047c2ec722 config-baseline.json
2+
337632b33a9e0c27c5e4f1ed8229216e9a0a54d3f277d95d0782840f4e1ae4f9 config-baseline.core.json
3+
f07df3b6f6cee20859a4e14bb9d873a5317d7ad0760a5998246c0c468e0cac42 config-baseline.channel.json
4+
fa32635fd2107390917447f9f5573234c81ee55fb3a01b279ccb027592c11220 config-baseline.plugin.json
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
e59682fe6e11b4bd6e47d585105b75f417ccc774e7085569336fffd478200be2 plugin-sdk-api-baseline.json
2-
4db490b8a21d1b4ce20f3e4d2f053b034d3ae039c79b2dbba995d13a5c4b0150 plugin-sdk-api-baseline.jsonl
1+
f47ce0245855b3e89eba5cf87c7f155dd3b74582d5e47f933abb0eda32b3c31f plugin-sdk-api-baseline.json
2+
085aaa0b5c98b604bb0463fb49a63e9d1f2ebb64e979647b33bb90c0534497b7 plugin-sdk-api-baseline.jsonl

‎scripts/plugin-sdk-surface-report.mjs‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,8 @@ export function readPluginSdkSurfaceBudgets(env = process.env) {
242242
// +1: shared speech-provider API key resolver.
243243
// +32: shared channel setup, config-schema, policy, and status helpers.
244244
// +2: shared channel replay-guard factory and claim handle.
245-
7986,
245+
// Harvest: retired AudioConfig type -1.
246+
7985,
246247
env,
247248
),
248249
publicFunctionExports: readPluginSdkSurfaceBudgetEnv(

‎src/commands/doctor/shared/legacy-config-migrate.test.ts‎

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1807,31 +1807,42 @@ describe("legacy migrate audio transcription", () => {
18071807
});
18081808

18091809
it("drops invalid audio.transcription payloads", () => {
1810-
const res = migrateLegacyConfigForTest({
1810+
const raw = {
18111811
audio: {
18121812
transcription: {
18131813
command: [{}],
18141814
},
18151815
},
1816-
});
1816+
};
1817+
1818+
expect(findLegacyConfigIssues(raw)).toEqual([
1819+
{
1820+
path: "audio.transcription",
1821+
message: "Use tools.media.audio.models instead.",
1822+
},
1823+
]);
1824+
const res = migrateLegacyConfigForTest(raw);
18171825

18181826
expect(res.changes).toStrictEqual(["Removed audio.transcription (invalid or empty command)."]);
1819-
expect(res.config?.audio).toBeUndefined();
1827+
expect(res.config).not.toHaveProperty("audio");
18201828
expect(res.config?.tools?.media?.audio).toBeUndefined();
18211829
});
18221830

18231831
it("rewrites legacy audio {input} placeholders to media templates", () => {
1824-
const res = migrateLegacyConfigForTest({
1832+
const raw = {
18251833
audio: {
18261834
transcription: {
18271835
command: ["whisper-cli", "--model", "small", "{input}", "--input={input}"],
18281836
timeoutSeconds: 30,
18291837
},
18301838
},
1831-
});
1839+
};
1840+
1841+
expect(findLegacyConfigIssues(raw).map((issue) => issue.path)).toEqual(["audio.transcription"]);
1842+
const res = migrateLegacyConfigForTest(raw);
18321843

18331844
expect(res.changes).toStrictEqual(["Moved audio.transcription → tools.media.audio.models."]);
1834-
expect(res.config?.audio).toBeUndefined();
1845+
expect(res.config).not.toHaveProperty("audio");
18351846
expect(res.config?.tools?.media?.audio?.models).toEqual([
18361847
{
18371848
type: "cli",

‎src/commands/doctor/shared/legacy-config-migrations.audio.ts‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,12 @@ export const LEGACY_CONFIG_MIGRATIONS_AUDIO: LegacyConfigMigrationSpec[] = [
3838
defineLegacyConfigMigration({
3939
id: "audio.transcription-v2",
4040
describe: "Move audio.transcription to tools.media.audio.models",
41+
legacyRules: [
42+
{
43+
path: ["audio", "transcription"],
44+
message: "Use tools.media.audio.models instead.",
45+
},
46+
],
4147
apply: (raw, changes) => {
4248
const audio = getRecord(raw.audio);
4349
if (audio?.transcription === undefined) {

‎src/config/config.legacy-config-detection.accepts-imessage-dmpolicy.test.ts‎

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
// Regresses accepted legacy iMessage dmPolicy config detection.
22
import { describe, expect, it } from "vitest";
3-
import {
4-
expectSchemaConfigValue,
5-
expectSchemaValid,
6-
} from "./legacy-config-detection.test-support.js";
7-
import { AudioSchema, BindingsSchema } from "./zod-schema.agents.js";
3+
import { expectSchemaConfigValue } from "./legacy-config-detection.test-support.js";
4+
import { BindingsSchema } from "./zod-schema.agents.js";
85
import { OpenClawSchema } from "./zod-schema.js";
96

107
function expectOpenClawSchemaInvalidPreservesField(params: {
@@ -30,11 +27,6 @@ function expectOpenClawSchemaInvalidPreservesField(params: {
3027
}
3128

3229
describe("legacy config detection", () => {
33-
it("accepts tools audio transcription without cli", () => {
34-
expectSchemaValid(AudioSchema, {
35-
transcription: { command: ["whisper", "--model", "base"] },
36-
});
37-
});
3830
it("rejects legacy agent.model string", () => {
3931
const res = OpenClawSchema.safeParse({
4032
agent: { model: "anthropic/claude-opus-4-6" },

‎src/config/dead-config-keys.test.ts‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,14 @@ function expectUnknownKey(params: { config: Record<string, unknown>; path: strin
1919
}
2020

2121
describe("dead config keys", () => {
22+
it("rejects retired audio.transcription", () => {
23+
expectUnknownKey({
24+
config: { audio: { transcription: { command: ["whisper"] } } },
25+
path: "",
26+
key: "audio",
27+
});
28+
});
29+
2230
it("rejects legacy session.maintenance.rotateBytes", () => {
2331
expectUnknownKey({
2432
config: { session: { maintenance: { rotateBytes: "10mb" } } },

‎src/config/legacy-config-detection.test-support.ts‎

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,3 @@ export function expectSchemaConfigValue(params: {
1919
}
2020
expect(params.readValue(res.data)).toBe(params.expectedValue);
2121
}
22-
23-
export function expectSchemaValid(
24-
schema: { safeParse: (value: unknown) => SchemaParseResult },
25-
config: unknown,
26-
) {
27-
const res = schema.safeParse(config);
28-
expect(res.success).toBe(true);
29-
}

‎src/config/schema.help.quality.test.ts‎

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ const ROOT_SECTIONS = [
2525
"tools",
2626
"bindings",
2727
"broadcast",
28-
"audio",
2928
"media",
3029
"messages",
3130
"commands",
@@ -212,10 +211,6 @@ const TARGET_KEYS = [
212211
"nodeHost.skills.enabled",
213212
"media",
214213
"media.preserveFilenames",
215-
"audio",
216-
"audio.transcription",
217-
"audio.transcription.command",
218-
"audio.transcription.timeoutSeconds",
219214
"bindings",
220215
"bindings[].agentId",
221216
"bindings[].match",
@@ -890,14 +885,7 @@ describe("config help copy quality", () => {
890885
expect(/differs|per provider/i.test(targetTo)).toBe(true);
891886
});
892887

893-
it("documents broadcast and audio command examples", () => {
894-
const audioCmd = expectDefined(
895-
FIELD_HELP["audio.transcription.command"],
896-
'FIELD_HELP["audio.transcription.command"] test invariant',
897-
);
898-
expect(audioCmd.includes("whisper-cli")).toBe(true);
899-
expect(audioCmd.includes("{input}")).toBe(true);
900-
888+
it("documents broadcast command examples", () => {
901889
const broadcastMap = expectDefined(
902890
FIELD_HELP["broadcast.*"],
903891
'FIELD_HELP["broadcast.*"] test invariant',

‎src/config/schema.help.ts‎

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -716,14 +716,6 @@ export const FIELD_HELP: Record<string, string> = {
716716
"When enabled, uploaded media keeps its original filename instead of a generated temp-safe name. Turn this on when downstream automations depend on stable names, and leave off to reduce accidental filename leakage.",
717717
"media.ttlHours":
718718
"Optional retention window in hours for persisted media cleanup across the full media tree. Leave unset to disable automatic cleanup (media writes never prune), or set values like 24 (1 day) or 168 (7 days) to periodically remove media older than the window.",
719-
audio:
720-
"Global audio ingestion settings used before higher-level tools process speech or media content. Configure this when you need deterministic transcription behavior for voice notes and clips.",
721-
"audio.transcription":
722-
"Command-based transcription settings for converting audio files into text before agent handling. Keep a simple, deterministic command path here so failures are easy to diagnose in logs.",
723-
"audio.transcription.command":
724-
'Executable + args used to transcribe audio (first token must be a safe binary/path), for example `["whisper-cli", "--model", "small", "{{MediaPath}}"]`. Deprecated `{input}` placeholders are migrated to `{{MediaPath}}` by `openclaw doctor --fix`.',
725-
"audio.transcription.timeoutSeconds":
726-
"Maximum time allowed for the transcription command to finish before it is aborted. Increase this for longer recordings, and keep it tight in latency-sensitive deployments.",
727719
bindings:
728720
"Top-level binding rules for routing and persistent ACP conversation ownership. Use type=route for normal routing and type=acp for persistent ACP harness bindings.",
729721
"bindings[].type":

0 commit comments

Comments
 (0)