Open-source Grok Bot alternative with a virtual machine that bots can use
TypeScript ai-agentsclaude-codecodexcomputer-usedockerelectrongrokgrok-botgrok-bot-alternativeself-hostedtypescript
fix(brief): count attempted reads, not skipped rows; drop a row once replied after it even when it no longer waits
AdityaUmale3ebfe32030bb
diff --git a/server/host/brief.test.ts b/server/host/brief.test.tsindex ac1160007b..a22242bd55 100644--- a/server/host/brief.test.ts+++ b/server/host/brief.test.ts@@ -477,6 +477,31 @@ describe("the brief's email rows", () => {expect(s.shown()).not.toContain("Q3 numbers");});+ it("does not let rows of an app it can't read use up the reads for other rows", async () => {+ const session: ReadSession = { ...mailSession({ t1: [{ id: "m1", at: 0, from: "[email protected]", unread: false }] }), outlookMessage: async () => { throw new Error("signed out"); } };+ const outlookRows = Array.from({ length: 10 }, (_, n) => ({ email: { ...bob, id: `o${n}`, threadId: `conv-${n}`, subject: `Invoice ${n}` }, why: "Due Friday.", needsReply: true }));+ const s = setup();+ await s.brief.active("desktop", "UTC");+ await s.brief.report({ routine: {} as never, at: s.now(), trouble: [], picked: [...outlookRows, { email: ada, why: "Ada needs the numbers.", needsReply: false }] });+ await s.brief.report({ routine: {} as never, at: s.now(), trouble: [], session });+ expect(s.shown()).not.toContain("Q3 numbers");+ });++ it("drops a row it stopped calling waiting once the person replies after it", async () => {+ const at = Date.parse("2026-10-22T07:00:00Z");+ const threads: Record<string, ThreadMessage[]> = { t1: [{ id: "m0", at: at - 60 * MINUTE, from: "[email protected]" }, { id: "m1", at, from: "[email protected]" }] };+ const session = mailSession(threads);+ const s = setup();+ await s.brief.active("desktop", "UTC");+ await s.brief.report({ routine: {} as never, at: s.now(), trouble: [], session, picked: [{ email: { ...ada, at, subject: "Re: Q3 numbers" }, why: "Ada says thanks.", needsReply: true }] });+ expect(s.shown()).toContain("Ada says thanks.");+ expect(s.shown()).not.toContain("Waiting on your reply");++ threads.t1 = [...threads.t1!, { id: "m2", at: at + MINUTE, from: "[email protected]" }];+ await s.brief.report({ routine: {} as never, at: s.now(), trouble: [], session });+ expect(s.shown()).not.toContain("Q3 numbers");+ });+it("checks a watch run's picks the same way before showing them", async () => {const at = Date.parse("2026-10-22T07:00:00Z");const s = setup({ session: mailSession({ t1: [{ id: "m0", at: at - 60 * MINUTE, from: "[email protected]" }, { id: "m1", at, from: "[email protected]" }] }) });diff --git a/server/host/brief.ts b/server/host/brief.tsindex 911dd88f8f..c9af1957e6 100644--- a/server/host/brief.ts+++ b/server/host/brief.ts@@ -461,9 +461,11 @@ export function createBrief(deps: BriefDeps) {state.important = state.important.filter((one) => one.messageId !== row.messageId);changed = true;};- for (const row of open.slice(0, 10)) {+ let reads = 0;+ for (const row of open) {const app = row.app ?? "gmail";if (unreadable.has(app)) continue;+ if (reads++ >= 10) break;try {if (app === "outlook") {const header = await session.outlookMessage?.(row.messageId);@@ -471,7 +473,7 @@ export function createBrief(deps: BriefDeps) {continue;}const thread = await session.thread(row.threadId);- if (thread.find((message) => message.id === row.messageId)?.unread === false || (row.needsReply && answered(row, thread, address))) drop(row);+ if (thread.find((message) => message.id === row.messageId)?.unread === false || answered(row, thread, address)) drop(row);else if (row.needsReply && repliedEarlier(row, thread, address)) {state.important = state.important.map((one) => (one.messageId === row.messageId ? { ...one, needsReply: false } : one));changed = true;