Skip to content

Commit 28b72e5

Browse files
fix: honor zero-valued voice-call STT settings
Landed from contributor PR openclaw#39196 by @scoootscooob. Co-authored-by: scoootscooob <zhentongfan@gmail.com>
1 parent a8c67af commit 28b72e5

File tree

3 files changed

+41
-2
lines changed

3 files changed

+41
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ Docs: https://docs.openclaw.ai
7070
- Cron/OpenAI Codex OAuth refresh hardening: when `openai-codex` token refresh fails specifically on account-id extraction, reuse the cached access token instead of failing the run immediately, with regression coverage to keep non-Codex and unrelated refresh failures unchanged. (#36604) Thanks @laulopezreal.
7171
- TUI/session isolation for `/new`: make `/new` allocate a unique `tui-<uuid>` session key instead of resetting the shared agent session, so multiple TUI clients on the same agent stop receiving each other’s replies; also sanitize `/new` and `/reset` failure text before rendering in-terminal. Landed from contributor PR #39238 by @widingmarcus-cyber. Thanks @widingmarcus-cyber.
7272
- Synology Chat/rate-limit env parsing: honor `SYNOLOGY_RATE_LIMIT=0` as an explicit value while still falling back to the default limit for malformed env values instead of partially parsing them. Landed from contributor PR #39197 by @scoootscooob. Thanks @scoootscooob.
73+
- Voice-call/OpenAI Realtime STT config defaults: honor explicit `vadThreshold: 0` and `silenceDurationMs: 0` instead of silently replacing them with defaults. Landed from contributor PR #39196 by @scoootscooob. Thanks @scoootscooob.
7374
- Cron/file permission hardening: enforce owner-only (`0600`) cron store/backup/run-log files and harden cron store + run-log directories to `0700`, including pre-existing directories from older installs. (#36078) Thanks @aerelune.
7475
- Gateway/remote WS break-glass hostname support: honor `OPENCLAW_ALLOW_INSECURE_PRIVATE_WS=1` for `ws://` hostname URLs (not only private IP literals) across onboarding validation and runtime gateway connection checks, while still rejecting public IP literals and non-unicast IPv6 endpoints. (#36930) Thanks @manju-rn.
7576
- Routing/binding lookup scalability: pre-index route bindings by channel/account and avoid full binding-list rescans on channel-account cache rollover, preventing multi-second `resolveAgentRoute` stalls in large binding configurations. (#36915) Thanks @songchenghao.
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import { describe, expect, it } from "vitest";
2+
import type { RealtimeSTTConfig } from "./stt-openai-realtime.js";
3+
import { OpenAIRealtimeSTTProvider } from "./stt-openai-realtime.js";
4+
5+
type ProviderInternals = OpenAIRealtimeSTTProvider & {
6+
vadThreshold: number;
7+
silenceDurationMs: number;
8+
};
9+
10+
function createProvider(config: RealtimeSTTConfig): ProviderInternals {
11+
return new OpenAIRealtimeSTTProvider(config) as ProviderInternals;
12+
}
13+
14+
describe("OpenAIRealtimeSTTProvider constructor defaults", () => {
15+
it("uses vadThreshold: 0 when explicitly configured (max sensitivity)", () => {
16+
const provider = createProvider({
17+
apiKey: "sk-test",
18+
vadThreshold: 0,
19+
});
20+
expect(provider.vadThreshold).toBe(0);
21+
});
22+
23+
it("uses silenceDurationMs: 0 when explicitly configured", () => {
24+
const provider = createProvider({
25+
apiKey: "sk-test",
26+
silenceDurationMs: 0,
27+
});
28+
expect(provider.silenceDurationMs).toBe(0);
29+
});
30+
31+
it("falls back to defaults when values are undefined", () => {
32+
const provider = createProvider({
33+
apiKey: "sk-test",
34+
});
35+
expect(provider.vadThreshold).toBe(0.5);
36+
expect(provider.silenceDurationMs).toBe(800);
37+
});
38+
});

extensions/voice-call/src/providers/stt-openai-realtime.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ export class OpenAIRealtimeSTTProvider {
6262
}
6363
this.apiKey = config.apiKey;
6464
this.model = config.model || "gpt-4o-transcribe";
65-
this.silenceDurationMs = config.silenceDurationMs || 800;
66-
this.vadThreshold = config.vadThreshold || 0.5;
65+
this.silenceDurationMs = config.silenceDurationMs ?? 800;
66+
this.vadThreshold = config.vadThreshold ?? 0.5;
6767
}
6868

6969
/**

0 commit comments

Comments
 (0)