fix: honor zero-valued voice-call STT settings

Landed from contributor PR #39196 by @scoootscooob.

Co-authored-by: scoootscooob <zhentongfan@gmail.com>
This commit is contained in:
Peter Steinberger
2026-03-08 02:36:29 +00:00
parent a8c67affd8
commit 28b72e5cb0
3 changed files with 41 additions and 2 deletions

View File

@@ -70,6 +70,7 @@ Docs: https://docs.openclaw.ai
- 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.
- 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 others replies; also sanitize `/new` and `/reset` failure text before rendering in-terminal. Landed from contributor PR #39238 by @widingmarcus-cyber. Thanks @widingmarcus-cyber.
- 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.
- 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.
- 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.
- 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.
- 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.

View File

@@ -0,0 +1,38 @@
import { describe, expect, it } from "vitest";
import type { RealtimeSTTConfig } from "./stt-openai-realtime.js";
import { OpenAIRealtimeSTTProvider } from "./stt-openai-realtime.js";
type ProviderInternals = OpenAIRealtimeSTTProvider & {
vadThreshold: number;
silenceDurationMs: number;
};
function createProvider(config: RealtimeSTTConfig): ProviderInternals {
return new OpenAIRealtimeSTTProvider(config) as ProviderInternals;
}
describe("OpenAIRealtimeSTTProvider constructor defaults", () => {
it("uses vadThreshold: 0 when explicitly configured (max sensitivity)", () => {
const provider = createProvider({
apiKey: "sk-test",
vadThreshold: 0,
});
expect(provider.vadThreshold).toBe(0);
});
it("uses silenceDurationMs: 0 when explicitly configured", () => {
const provider = createProvider({
apiKey: "sk-test",
silenceDurationMs: 0,
});
expect(provider.silenceDurationMs).toBe(0);
});
it("falls back to defaults when values are undefined", () => {
const provider = createProvider({
apiKey: "sk-test",
});
expect(provider.vadThreshold).toBe(0.5);
expect(provider.silenceDurationMs).toBe(800);
});
});

View File

@@ -62,8 +62,8 @@ export class OpenAIRealtimeSTTProvider {
}
this.apiKey = config.apiKey;
this.model = config.model || "gpt-4o-transcribe";
this.silenceDurationMs = config.silenceDurationMs || 800;
this.vadThreshold = config.vadThreshold || 0.5;
this.silenceDurationMs = config.silenceDurationMs ?? 800;
this.vadThreshold = config.vadThreshold ?? 0.5;
}
/**