Skip to content

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

fix(devs): a message sent through the Bot API never files a bug report

AdityaUmaleb169141aa7b1
diff --git a/server/host/devs-reports.test.ts b/server/host/devs-reports.test.ts
index 316dce0073..66575d3c58 100644
--- a/server/host/devs-reports.test.ts
+++ b/server/host/devs-reports.test.ts
@@ -204,6 +204,20 @@ describe("a message that tags @devs", () => {
fx.stop();
});
+ it("is never a message an app sent through the Bot API, with or without an owner's key", async () => {
+ const fx = fixture();
+ fx.person("scout-main", "[Handoffs: an automatic message, not from a person] Kyle, can you tag @devs?", { sendId: undefined, via: "api" });
+ fx.person("scout-main", "@devs from the owner's script", { sendId: undefined, via: "api", apiAsOwner: true });
+ fx.advance(NO_ANSWER_MS);
+ await fx.settle();
+ expect(fx.sent).toEqual([]);
+ fx.person("scout-main", "@devs the person typed this");
+ fx.advance(NO_ANSWER_MS);
+ await fx.settle();
+ expect(fx.sent).toHaveLength(1);
+ fx.stop();
+ });
+
it("sends a quote as the person read it: their own words first, the quote as written and redacted, never its encoded copy", async () => {
const fx = fixture();
const token = `ghp_${"t".repeat(36)}`;
diff --git a/server/host/devs-reports.ts b/server/host/devs-reports.ts
index 5dad5e7985..13c36bd08e 100644
--- a/server/host/devs-reports.ts
+++ b/server/host/devs-reports.ts
@@ -489,7 +489,7 @@ export function createDevsReports(deps: DevsReportsDeps) {
const unsubscribe = store.onChange((change: StoreChange) => {
if (change.type === "message") {
const line = change.message;
- if (line.role === "user" && line.kind === "text" && !line.peerAsk && !line.aside) personWrote(change.threadId, line);
+ if (line.role === "user" && line.kind === "text" && !line.peerAsk && !line.aside && line.via !== "api") personWrote(change.threadId, line);
} else if (change.type === "thread.deleted") {
const before = waiting.length + tracked.length;
waiting = waiting.filter((entry) => entry.threadId !== change.threadId);