惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

The GitHub Blog
The GitHub Blog
博客园 - 三生石上(FineUI控件)
V
V2EX
博客园 - 司徒正美
小众软件
小众软件
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
T
Tailwind CSS Blog
Last Week in AI
Last Week in AI
雷峰网
雷峰网
月光博客
月光博客
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Apple Machine Learning Research
Apple Machine Learning Research
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
S
SegmentFault 最新的问题
美团技术团队
Hugging Face - Blog
Hugging Face - Blog
WordPress大学
WordPress大学
宝玉的分享
宝玉的分享
爱范儿
爱范儿
博客园 - 聂微东
量子位
J
Java Code Geeks
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Vercel News
Vercel News

Recent Commits to openclaw:main

test: merge chat side-result checks · openclaw/openclaw@ddd2c2a test: merge cron history checks · openclaw/openclaw@f7eb746 test: merge responsive navigation shell checks · openclaw/openclaw@c2e4b47 docs(changelog): add codex oauth fixes · openclaw/openclaw@628e6cd test: merge navigation routing cases · openclaw/openclaw@5d8cecb Tests: mock channel registry bundled fallback · openclaw/openclaw@2b08233 Secrets: avoid broad web search discovery for single plugin config · openclaw/openclaw@a464f59 test: merge config view browser checks · openclaw/openclaw@20cf511 fix(status): align oauth health with runtime · openclaw/openclaw@eed7116 feat: add macOS screen snapshots for monitor preview (#67954) thanks … · openclaw/openclaw@f377db1 fix: report shared auth scopes in hello-ok (#67810) thanks @BunsDev · openclaw/openclaw@0b6c39b Auto-reply: avoid eager bundled route fallback · openclaw/openclaw@3ea1bf4 Tests: narrow session binding contract setup · openclaw/openclaw@54e4e16 fix(macOS): enable undo/redo in webchat composer text input (#34962) · openclaw/openclaw@00951dc Tests: speed up channel setup promotion · openclaw/openclaw@82b529a Docs: refresh agent instructions · openclaw/openclaw@5775fe2 fix(auth): serialize OAuth refresh across agents to fix #26322 (#67876) · openclaw/openclaw@8e79080 test: allow ollama public surface boundary test · openclaw/openclaw@7d4f1a6 Docs: add test performance guardrails · openclaw/openclaw@89706d3 Tests: restore context-engine usage proof · openclaw/openclaw@e4c4f95 Tests: slim context engine runtime coverage · openclaw/openclaw@74c198f ci: retry failed custom checkouts · openclaw/openclaw@0ee5baf test: trim duplicate provider auth onboarding cases · openclaw/openclaw@1ffc02e matrix: fix sessions_spawn --thread subagent session spawning (#67643) · openclaw/openclaw@1ce2596 test: reduce auth choice fixture churn · openclaw/openclaw@857b9cd test: mock health status config boundaries · openclaw/openclaw@9d5ab4a test: mock onboard config io boundary · openclaw/openclaw@299694d test: mock legacy state plugin boundaries · openclaw/openclaw@2713089 test: mock channel install boundaries · openclaw/openclaw@b945248 test: mock doctor preview channel boundaries · openclaw/openclaw@b1a3ad4
fix(discord): make realtime barge-in guard tunable · open...
steipete · 2026-05-09 · via Recent Commits to openclaw:main

@@ -703,7 +703,7 @@ describe("buildOpenAIRealtimeVoiceProvider", () => {

703703

}),

704704

),

705705

);

706-

bridge.setMediaTimestamp(1240);

706+

bridge.setMediaTimestamp(1300);

707707708708

bridge.handleBargeIn?.({ audioPlaybackActive: true });

709709

@@ -714,7 +714,7 @@ describe("buildOpenAIRealtimeVoiceProvider", () => {

714714

type: "conversation.item.truncate",

715715

item_id: "item_1",

716716

content_index: 0,

717-

audio_end_ms: 240,

717+

audio_end_ms: 300,

718718

});

719719

});

720720

@@ -904,6 +904,7 @@ describe("buildOpenAIRealtimeVoiceProvider", () => {

904904

"message",

905905

Buffer.from(JSON.stringify({ type: "response.created", response: { id: "resp_1" } })),

906906

);

907+

bridge.setMediaTimestamp(1000);

907908

socket.emit(

908909

"message",

909910

Buffer.from(

@@ -914,6 +915,7 @@ describe("buildOpenAIRealtimeVoiceProvider", () => {

914915

}),

915916

),

916917

);

918+

bridge.setMediaTimestamp(1300);

917919918920

bridge.handleBargeIn?.({ audioPlaybackActive: true });

919921

bridge.handleBargeIn?.({ audioPlaybackActive: true });

@@ -927,7 +929,106 @@ describe("buildOpenAIRealtimeVoiceProvider", () => {

927929

expect(onEvent).toHaveBeenCalledWith({

928930

direction: "client",

929931

type: "conversation.item.truncate",

930-

detail: "reason=barge-in audioEndMs=0",

932+

detail: "reason=barge-in audioEndMs=300",

933+

});

934+

});

935+936+

it("ignores zero-length playback barge-in without clearing audio", async () => {

937+

const provider = buildOpenAIRealtimeVoiceProvider();

938+

const onClearAudio = vi.fn();

939+

const onEvent = vi.fn();

940+

const bridge = provider.createBridge({

941+

providerConfig: { apiKey: "sk-test" }, // pragma: allowlist secret

942+

onAudio: vi.fn(),

943+

onClearAudio,

944+

onEvent,

945+

});

946+

const connecting = bridge.connect();

947+

const socket = FakeWebSocket.instances[0];

948+

if (!socket) {

949+

throw new Error("expected bridge to create a websocket");

950+

}

951+952+

socket.readyState = FakeWebSocket.OPEN;

953+

socket.emit("open");

954+

socket.emit("message", Buffer.from(JSON.stringify({ type: "session.updated" })));

955+

await connecting;

956+

bridge.setMediaTimestamp(1000);

957+

socket.emit(

958+

"message",

959+

Buffer.from(JSON.stringify({ type: "response.created", response: { id: "resp_1" } })),

960+

);

961+

socket.emit(

962+

"message",

963+

Buffer.from(

964+

JSON.stringify({

965+

type: "response.audio.delta",

966+

item_id: "item_1",

967+

delta: Buffer.from("assistant audio").toString("base64"),

968+

}),

969+

),

970+

);

971+972+

bridge.handleBargeIn?.({ audioPlaybackActive: true });

973+974+

expect(onClearAudio).not.toHaveBeenCalled();

975+

expect(parseSent(socket)).not.toContainEqual({ type: "response.cancel" });

976+

expect(parseSent(socket).some((event) => event.type === "conversation.item.truncate")).toBe(

977+

false,

978+

);

979+

expect(onEvent).toHaveBeenCalledWith({

980+

direction: "client",

981+

type: "conversation.item.truncate.skipped",

982+

detail: "reason=barge-in audioEndMs=0 minAudioEndMs=250",

983+

});

984+

});

985+986+

it("allows immediate playback barge-in when the minimum audio window is zero", async () => {

987+

const provider = buildOpenAIRealtimeVoiceProvider();

988+

const onClearAudio = vi.fn();

989+

const bridge = provider.createBridge({

990+

providerConfig: {

991+

apiKey: "sk-test", // pragma: allowlist secret

992+

minBargeInAudioEndMs: 0,

993+

},

994+

onAudio: vi.fn(),

995+

onClearAudio,

996+

});

997+

const connecting = bridge.connect();

998+

const socket = FakeWebSocket.instances[0];

999+

if (!socket) {

1000+

throw new Error("expected bridge to create a websocket");

1001+

}

1002+1003+

socket.readyState = FakeWebSocket.OPEN;

1004+

socket.emit("open");

1005+

socket.emit("message", Buffer.from(JSON.stringify({ type: "session.updated" })));

1006+

await connecting;

1007+

bridge.setMediaTimestamp(1000);

1008+

socket.emit(

1009+

"message",

1010+

Buffer.from(JSON.stringify({ type: "response.created", response: { id: "resp_1" } })),

1011+

);

1012+

socket.emit(

1013+

"message",

1014+

Buffer.from(

1015+

JSON.stringify({

1016+

type: "response.audio.delta",

1017+

item_id: "item_1",

1018+

delta: Buffer.from("assistant audio").toString("base64"),

1019+

}),

1020+

),

1021+

);

1022+1023+

bridge.handleBargeIn?.({ audioPlaybackActive: true });

1024+1025+

expect(onClearAudio).toHaveBeenCalledTimes(1);

1026+

expect(parseSent(socket)).toContainEqual({ type: "response.cancel" });

1027+

expect(parseSent(socket)).toContainEqual({

1028+

type: "conversation.item.truncate",

1029+

item_id: "item_1",

1030+

content_index: 0,

1031+

audio_end_ms: 0,

9311032

});

9321033

});

9331034