Skip to content

Commit 11f06b3

Browse files
committed
fix(ui): acquire voice microphone before session allocation
1 parent 725222d commit 11f06b3

24 files changed

Lines changed: 571 additions & 438 deletions

‎docs/nodes/talk.md‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,10 @@ and allow access if prompted. The browser can keep an unanswered permission
6161
request pending. In Talk, **Stop voice input** cancels startup and releases any
6262
microphone stream granted after cancellation.
6363

64+
Browser Talk acquires the microphone before creating the provider session, so
65+
time spent granting permission does not consume a short-lived connection token.
66+
If session creation fails, Talk releases the microphone before reporting the error.
67+
6468
If the microphone disconnects or its permission is revoked, browser Talk ends
6569
the call and shows an error. Choose an available **Microphone input**, restore
6670
permission if needed, and start Talk again. An unexpected GPT-Live connection

‎ui/src/e2e/browser-talk-microphone-lifetime.e2e.test.ts‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ const suite = createControlUiE2eSuite({
1919
suite.define(() => {
2020
it("guides a pending microphone request and clears guidance when voice connects", async () => {
2121
await suite.withPage({ permissions: ["microphone"] }, async ({ page }) => {
22-
await installMockGateway(page, {
22+
const gateway = await installMockGateway(page, {
2323
methodResponses: {
2424
"talk.catalog": videoTalkCatalog("openai"),
2525
"talk.client.create": {
@@ -55,7 +55,8 @@ suite.define(() => {
5555
),
5656
)
5757
.toBe(true);
58-
await captureMicrophoneLossProof(page, "microphone-access-pending.png");
58+
expect(await gateway.getRequests("talk.client.create")).toHaveLength(0);
59+
await captureMicrophoneLossProof(page, "prepared-input-pending.png");
5960
const guidance = page.locator('.agent-chat__talk-status[role="status"]');
6061
await expect
6162
.poll(() => guidance.allTextContents())
@@ -74,7 +75,8 @@ suite.define(() => {
7475
.poll(() => page.locator('.agent-chat__voice-activity[data-status="listening"]').count())
7576
.toBe(1);
7677
await expect.poll(() => guidance.count()).toBe(0);
77-
await captureMicrophoneLossProof(page, "microphone-access-ready.png");
78+
expect(await gateway.getRequests("talk.client.create")).toHaveLength(1);
79+
await captureMicrophoneLossProof(page, "prepared-input-ready.png");
7880
await page.getByRole("button", { name: "Stop voice input" }).click();
7981
});
8082
});

0 commit comments

Comments
 (0)