Skip to content

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

fix(rooms): with tool calls off, a room hides a failed step like a 1:1 chat (#3846)

Aditya Umale62f1c02645df
diff --git a/src/lib/room-activity.test.ts b/src/lib/room-activity.test.ts
index 360563f419..48e996f8d6 100644
--- a/src/lib/room-activity.test.ts
+++ b/src/lib/room-activity.test.ts
@@ -1,5 +1,6 @@
import { describe, expect, it } from "vitest";
+import { quietRow } from "@/components/chat-bubble";
import { roomActivityVisible } from "./room-activity";
import type { Message } from "@/state/store";
@@ -24,11 +25,24 @@ describe("roomActivityVisible", () => {
expect(roomActivityVisible(chip({ tool: { name: "recovery: Automatic recovery: trying a backup once.", ok: true } }), false)).toBe(true);
});
- it("always shows a failure", () => {
- expect(roomActivityVisible(chip({ tool: { name: "Ran a command", ok: false } }), false)).toBe(true);
+ it("hides a failed step like a 1:1 chat, and always shows a failed turn", () => {
+ const failedStep = chip({ tool: { name: "Ran a command", ok: false } });
+ expect(roomActivityVisible(failedStep, false)).toBe(false);
+ expect(roomActivityVisible(failedStep, true)).toBe(true);
expect(roomActivityVisible(chip({ tool: { name: "error: engine missing" } }), false)).toBe(true);
});
+ it("shows the same activity a 1:1 chat shows when tool calls are off", () => {
+ const rows = [
+ chip({}),
+ chip({ tool: { name: "Ran a command", ok: false } }),
+ chip({ tool: { name: "error: engine missing" } }),
+ chip({ tool: { name: "stopped: Stopped", ok: true } }),
+ chip({ tool: { name: "Messaged @Ada" }, comm: { groupId: "g1", withBotId: "ada", withName: "Ada", withColor: "teal" } }),
+ ];
+ for (const row of rows) expect(roomActivityVisible(row, false), row.tool?.name).toBe(!quietRow(row, false));
+ });
+
it("always shows an opened-thread chip, the only trace a bot started a thread", () => {
const opened = chip({
tool: { name: "Opened thread #QA PR 245 on Scout", ok: true },
diff --git a/src/lib/room-activity.ts b/src/lib/room-activity.ts
index 40751417fb..09b797818c 100644
--- a/src/lib/room-activity.ts
+++ b/src/lib/room-activity.ts
@@ -6,5 +6,5 @@ export function roomActivityVisible(message: Message, showToolCalls: boolean): b
const tool = message.tool;
if (message.kind !== "activity" || !tool) return false;
if (message.comm || message.threadRef || message.relay || message.dataResult || isStatusActivity(message)) return true;
- return tool.ok === false || failedTurnCause(tool.name) !== null || showToolCalls;
+ return failedTurnCause(tool.name) !== null || showToolCalls;
}