Skip to content

Open-source Grok Bot alternative with a virtual machine that bots can use

fix(live): a bot frame without liveVoice clears the bot's own call voice

AdityaUmale0eb64b3c0967
diff --git a/src/state/store.test.ts b/src/state/store.test.ts
index ebd137167a..0226aac70b 100644
--- a/src/state/store.test.ts
+++ b/src/state/store.test.ts
@@ -198,6 +198,21 @@ describe("independent bot threads", () => {
expect(open.bots[0]?.onlyPeopleAdded).toBeUndefined();
});
+ it("a frame without liveVoice clears the bot's own call voice", () => {
+ const voiced = reducer(start(), { type: "botPatched", bot: { ...bot, liveVoice: "marin" } });
+ expect(voiced.bots[0]?.liveVoice).toBe("marin");
+ const cleared = reducer(voiced, { type: "botPatched", bot: { ...bot } });
+ expect(cleared.bots[0]?.liveVoice).toBeUndefined();
+ });
+
+ it("a thread-switch snapshot without liveVoice clears the bot's own call voice", () => {
+ const voiced = reducer(start(), { type: "botPatched", bot: { ...bot, liveVoice: "marin" } });
+ const full = { ...bot, threadId: "second", activeLeafId: null, tasks: bot.tasks!.slice(1), messages: [] };
+ const switched = reducer(voiced, { type: "botPatched", bot: full });
+ expect(switched.bots[0]).toMatchObject({ threadId: "second" });
+ expect(switched.bots[0]?.liveVoice).toBeUndefined();
+ });
+
it("keeps background bot frames from switching the visible transcript or clearing unread", () => {
const patched = reducer(start(), { type: "botPatched", bot: { ...bot, threadId: "second", messages: [], activeLeafId: "other" } });
expect(patched.bots[0]?.threadId).toBe("first");
diff --git a/src/state/store.tsx b/src/state/store.tsx
index 3a59e8e6c2..adbe67e5b3 100644
--- a/src/state/store.tsx
+++ b/src/state/store.tsx
@@ -1140,7 +1140,7 @@ export function reducer(state: AppState, action: Action): AppState {
if ((switchedThread || (before.awaitingThreadSnapshot && action.bot.threadId === before.threadId)) &&
Array.isArray(action.bot.messages)) {
// The slim deletion broadcast can beat the full snapshot; later duplicate snapshots must not overwrite newer messages.
- return reducer(switching, { type: "taskSwitched", bot: { ...before, ...action.bot, computer: action.bot.computer, section: action.bot.section, toolScope: action.bot.toolScope, managedSections: action.bot.managedSections, messages: action.bot.messages, browserProfile: action.bot.browserProfile, vpsAlias: action.bot.vpsAlias, phoneApps: action.bot.phoneApps, onlyPeopleAdded: action.bot.onlyPeopleAdded } });
+ return reducer(switching, { type: "taskSwitched", bot: { ...before, ...action.bot, computer: action.bot.computer, section: action.bot.section, toolScope: action.bot.toolScope, managedSections: action.bot.managedSections, messages: action.bot.messages, browserProfile: action.bot.browserProfile, vpsAlias: action.bot.vpsAlias, phoneApps: action.bot.phoneApps, onlyPeopleAdded: action.bot.onlyPeopleAdded, liveVoice: action.bot.liveVoice } });
}
const patched = updateBot(switching, action.bot.id, (b) => ({
...b,
@@ -1153,7 +1153,7 @@ export function reducer(state: AppState, action: Action): AppState {
computer: action.bot.computer,
toolScope: action.bot.toolScope,
section: action.bot.section, managedSections: action.bot.managedSections,
- vpsAlias: action.bot.vpsAlias, phoneApps: action.bot.phoneApps, onlyPeopleAdded: action.bot.onlyPeopleAdded,
+ vpsAlias: action.bot.vpsAlias, phoneApps: action.bot.phoneApps, onlyPeopleAdded: action.bot.onlyPeopleAdded, liveVoice: action.bot.liveVoice,
tasks: action.bot.tasks ? mergeTaskStamps(b.tasks, action.bot.tasks) : b.tasks,
// Old approvals must never be sent to the replacement thread while its transcript loads.
messages: switchedThread ? [] : b.messages,