Skip to content

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

Waits: a follow-up that never started gets its own notice key

milind-soni8bd999ca7802
diff --git a/server/chat-notices.ts b/server/chat-notices.ts
index c98fa2a715..1a00570bf8 100644
--- a/server/chat-notices.ts
+++ b/server/chat-notices.ts
@@ -151,6 +151,7 @@ export const CHAT_NOTICE = {
"chat.notice.waitDone.processGone": "{label}: done. {process} stopped.",
"chat.notice.waitDone.botIdle": "{label}: done. {botName} finished.",
"chat.notice.waitBotGone": "Stopped waiting for {label}: {botName} no longer exists.",
+ "chat.notice.waitFollowUpLost": "{label}: its follow-up could not be started, so the work did not run.",
"chat.notice.waitExpiredOne": "Stopped waiting for {label} after {hours} hour.",
"chat.notice.waitExpiredMany": "Stopped waiting for {label} after {hours} hours.",
"chat.notice.computerDesktopOnly": "Only the OpenMausBot app on this computer can let a bot use it. Open the app here, or let the bot work in its own browser or on a cloud desktop instead.",
diff --git a/server/wait-notice-text.test.ts b/server/wait-notice-text.test.ts
index 692a13747a..d5b557306f 100644
--- a/server/wait-notice-text.test.ts
+++ b/server/wait-notice-text.test.ts
@@ -40,4 +40,14 @@ describe("wait notice codes", () => {
expect(chatNotice("chat.notice.waitBotGone", words.params)).toBe(notice.text);
expect(waitNoticeText(wait({ kind: "file_missing", path: "/fixture/Report.txt" }), notice)).toBeUndefined();
});
+
+ it("codes a fired wait whose follow-up never started as that, even when it waited on a bot", () => {
+ for (const condition of [{ kind: "bot_idle", botId: "peer", botName: "Scout", sawBusy: true }, { kind: "file_exists", path: "/fixture/Report.txt" }] as const) {
+ const record = { ...wait(condition), followUpTries: 5 };
+ const text = chatNotice("chat.notice.waitFollowUpLost", { label: record.label });
+ const words = waitNoticeText(record, { status: "stopped", text })!;
+ expect(words.key).toBe("chat.notice.waitFollowUpLost");
+ expect(chatNotice("chat.notice.waitFollowUpLost", words.params)).toBe(text);
+ }
+ });
});
diff --git a/server/wait-notice-text.ts b/server/wait-notice-text.ts
index 92e71fda4a..d8756d5243 100644
--- a/server/wait-notice-text.ts
+++ b/server/wait-notice-text.ts
@@ -13,7 +13,11 @@ export function waitNoticeText(wait: WaitRecord, notice: WaitNotice): ServerText
return { key: hours === 1 ? "chat.notice.waitExpiredOne" : "chat.notice.waitExpiredMany", params: { ...params, hours } };
}
const condition = wait.condition;
- if (notice.status === "stopped") return condition.kind === "bot_idle" ? { key: "chat.notice.waitBotGone", params: { ...params, botName: condition.botName } } : undefined;
+ if (notice.status === "stopped") {
+ // A fired wait whose follow-up never started is told apart by its failed attempts, never by its English.
+ if (wait.followUpTries) return { key: "chat.notice.waitFollowUpLost", params };
+ return condition.kind === "bot_idle" ? { key: "chat.notice.waitBotGone", params: { ...params, botName: condition.botName } } : undefined;
+ }
const key = `chat.notice.waitDone.${FIRED_KEY[condition.kind]}`;
switch (condition.kind) {
case "url_contains": case "url_missing": return { key, params: { ...params, url: condition.url, text: condition.text } };
diff --git a/server/waits.ts b/server/waits.ts
index b82cd8a958..6203a86cfc 100644
--- a/server/waits.ts
+++ b/server/waits.ts
@@ -6,6 +6,7 @@ import { z } from "zod";
import { WAIT_HOURS, type WaitKind } from "../shared/waits.ts";
import { writeFileAtomic } from "./atomic.ts";
+import { chatNotice } from "./chat-notices.ts";
import { DATA_DIR } from "./config.ts";
import { startDueTimer, type DueTimer } from "./due-timer.ts";
import {
@@ -498,7 +499,7 @@ export class WaitManager {
* went out under that status, and the host posts one notice per wait id and status, so this one needs another. */
private followUpLost(wait: WaitRecord): void {
try {
- this.options.post(wait, { status: "stopped", text: `${wait.label}: its follow-up could not be started, so the work did not run.` });
+ this.options.post(wait, { status: "stopped", text: chatNotice("chat.notice.waitFollowUpLost", { label: wait.label }) });
} catch (error) {
console.error(`wait ${wait.id}: could not post`, error);
}
diff --git a/src/locales/en.json b/src/locales/en.json
index 0eceb2f2dc..9e14b402e4 100644
--- a/src/locales/en.json
+++ b/src/locales/en.json
@@ -10598,6 +10598,7 @@
"chat.notice.waitDone.processGone": "{label}: done. {process} stopped.",
"chat.notice.waitDone.botIdle": "{label}: done. {botName} finished.",
"chat.notice.waitBotGone": "Stopped waiting for {label}: {botName} no longer exists.",
+ "chat.notice.waitFollowUpLost": "{label}: its follow-up could not be started, so the work did not run.",
"chat.notice.waitExpiredOne": "Stopped waiting for {label} after {hours} hour.",
"chat.notice.waitExpiredMany": "Stopped waiting for {label} after {hours} hours.",
"mcp.personal.oneHeader": "Personal MCP connections support one header. Remove the extra headers before saving.",
diff --git a/src/locales/pt-br.json b/src/locales/pt-br.json
index ccc22fb8ca..2c5af79796 100644
--- a/src/locales/pt-br.json
+++ b/src/locales/pt-br.json
@@ -10518,6 +10518,7 @@
"chat.notice.waitDone.processGone": "Espera concluída: {label}. {process} parou.",
"chat.notice.waitDone.botIdle": "Espera concluída: {label}. {botName} terminou.",
"chat.notice.waitBotGone": "A espera por {label} foi encerrada: {botName} não existe mais.",
+ "chat.notice.waitFollowUpLost": "{label}: não foi possível iniciar a continuação, então o trabalho não foi feito.",
"chat.notice.waitExpiredOne": "A espera por {label} foi encerrada após {hours} h.",
"chat.notice.waitExpiredMany": "A espera por {label} foi encerrada após {hours} h.",
"mcp.personal.oneHeader": "Conexões MCP pessoais aceitam um cabeçalho. Remova os cabeçalhos extras antes de salvar.",