fix(voice-call): use full config for realtime transcription (#61224)

* fix(voice-call): use full config for realtime transcription

* fix(changelog): note voice-call transcription regression

* Update CHANGELOG.md
This commit is contained in:
Vincent Koc
2026-04-05 08:14:41 +01:00
committed by GitHub
parent 42bc411c46
commit 155f4300ba
4 changed files with 34 additions and 1 deletions

View File

@@ -1,3 +1,4 @@
import type { OpenClawConfig } from "openclaw/plugin-sdk/core";
import { beforeEach, describe, expect, it, vi } from "vitest";
import type { VoiceCallConfig } from "./config.js";
import type { CoreConfig } from "./core-bridge.js";
@@ -10,6 +11,7 @@ const mocks = vi.hoisted(() => ({
webhookStart: vi.fn(),
webhookStop: vi.fn(),
webhookGetMediaStreamHandler: vi.fn(),
webhookCtorArgs: [] as unknown[][],
startTunnel: vi.fn(),
setupTailscaleExposure: vi.fn(),
cleanupTailscaleExposure: vi.fn(),
@@ -28,6 +30,9 @@ vi.mock("./manager.js", () => ({
vi.mock("./webhook.js", () => ({
VoiceCallWebhookServer: class {
constructor(...args: unknown[]) {
mocks.webhookCtorArgs.push(args);
}
start = mocks.webhookStart;
stop = mocks.webhookStop;
getMediaStreamHandler = mocks.webhookGetMediaStreamHandler;
@@ -58,6 +63,7 @@ describe("createVoiceCallRuntime lifecycle", () => {
mocks.webhookStart.mockResolvedValue("http://127.0.0.1:3334/voice/webhook");
mocks.webhookStop.mockResolvedValue(undefined);
mocks.webhookGetMediaStreamHandler.mockReturnValue(undefined);
mocks.webhookCtorArgs.length = 0;
mocks.startTunnel.mockResolvedValue(null);
mocks.setupTailscaleExposure.mockResolvedValue(null);
mocks.cleanupTailscaleExposure.mockResolvedValue(undefined);
@@ -106,4 +112,25 @@ describe("createVoiceCallRuntime lifecycle", () => {
expect(mocks.cleanupTailscaleExposure).toHaveBeenCalledTimes(1);
expect(mocks.webhookStop).toHaveBeenCalledTimes(1);
});
it("passes fullConfig to the webhook server for streaming provider resolution", async () => {
const coreConfig = { messages: { tts: { provider: "openai" } } } as CoreConfig;
const fullConfig = {
plugins: {
entries: {
openai: { enabled: true },
},
},
} as OpenClawConfig;
await createVoiceCallRuntime({
config: createBaseConfig(),
coreConfig,
fullConfig,
agentRuntime: {} as never,
});
expect(mocks.webhookCtorArgs[0]?.[3]).toBe(coreConfig);
expect(mocks.webhookCtorArgs[0]?.[4]).toBe(fullConfig);
});
});

View File

@@ -231,6 +231,7 @@ export async function createVoiceCallRuntime(params: {
manager,
provider,
coreConfig,
(fullConfig ?? (coreConfig as OpenClawConfig)) as OpenClawConfig,
agentRuntime,
);
if (realtimeProvider) {

View File

@@ -84,6 +84,7 @@ export class VoiceCallWebhookServer {
private manager: CallManager;
private provider: VoiceCallProvider;
private coreConfig: CoreConfig | null;
private fullConfig: OpenClawConfig | null;
private agentRuntime: CoreAgentDeps | null;
private stopStaleCallReaper: (() => void) | null = null;
private readonly webhookInFlightLimiter = createWebhookInFlightLimiter();
@@ -100,12 +101,14 @@ export class VoiceCallWebhookServer {
manager: CallManager,
provider: VoiceCallProvider,
coreConfig?: CoreConfig,
fullConfig?: OpenClawConfig,
agentRuntime?: CoreAgentDeps,
) {
this.config = normalizeVoiceCallConfig(config);
this.manager = manager;
this.provider = provider;
this.coreConfig = coreConfig ?? null;
this.fullConfig = fullConfig ?? null;
this.agentRuntime = agentRuntime ?? null;
}
@@ -159,7 +162,8 @@ export class VoiceCallWebhookServer {
*/
private async initializeMediaStreaming(): Promise<void> {
const streaming = this.config.streaming;
const pluginConfig = this.coreConfig as unknown as OpenClawConfig | undefined;
const pluginConfig =
this.fullConfig ?? (this.coreConfig as unknown as OpenClawConfig | undefined);
const { getRealtimeTranscriptionProvider, listRealtimeTranscriptionProviders } =
await import("./realtime-transcription.runtime.js");
const resolution = resolveConfiguredCapabilityProvider({