Skip to content

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

fix(logins): say plainly why fill_login won't fill on a computer screen

AdityaUmalec6ff2844f60b
diff --git a/server/host/fill-login-turn.test.ts b/server/host/fill-login-turn.test.ts
index 3b7be8340c..bc26630b6f 100644
--- a/server/host/fill-login-turn.test.ts
+++ b/server/host/fill-login-turn.test.ts
@@ -45,12 +45,22 @@ describe("fill_login outside the bot's own browser", () => {
expect(moveToBrowser).toHaveBeenCalledWith(turn);
expect(target).not.toHaveBeenCalled();
expect(answer.ok).toBe(false);
- expect(answer.text).toContain("never types one on the screen of");
+ expect(answer.text).toContain("it never types one there");
expect(answer.text).toContain("moving this conversation to your own browser");
expect(answer.text).toContain("End this turn now");
expect(answer.text).not.toContain("request_sign_in");
});
+ it.each([
+ ["can move", {}],
+ ["cannot move", { moveToBrowser: () => false }],
+ ["has no browser here", { browserSelectable: () => false }],
+ ] as const)("says plainly why a saved login is not filled on a screen when the run %s", async (_case, over) => {
+ const { fill } = harness(over);
+ const answer = await fill(bot, turn, undefined, undefined);
+ expect(answer.text).toMatch(/^Saved logins are filled only in your own browser, the one your browser tools drive, where OpenMausBot checks the page's site before it types a password\. On the screen of this computer it cannot prove which site a box belongs to, so it never types one there[,.]/);
+ });
+
it("names the person's own Chrome when the bot's profile is My Chrome", async () => {
const { fill } = harness({ myChrome: () => true });
expect((await fill(bot, turn, undefined, undefined)).text).toContain("the person's own Chrome (My Chrome)");
diff --git a/server/host/fill-login-turn.ts b/server/host/fill-login-turn.ts
index 304db33e0f..5da6716ed4 100644
--- a/server/host/fill-login-turn.ts
+++ b/server/host/fill-login-turn.ts
@@ -39,14 +39,14 @@ export interface FillLoginTurnDeps {
turnActive?(turn: Turn): boolean;
}
-const ONLY_IN_BROWSER = "fill_login types a password only into a page of your own browser, where OpenMausBot checks the page's site first";
+const ONLY_IN_BROWSER = "Saved logins are filled only in your own browser, the one your browser tools drive, where OpenMausBot checks the page's site before it types a password";
export function createFillLoginTurn(deps: FillLoginTurnDeps) {
// Security: on a screen the server cannot prove which site a focused box belongs to, so a secret is never typed there.
function elsewhere(bot: BotRecord, turn: Turn, place: Surface | null, signsInByEmail: boolean): Answer {
const current = deps.current(bot, turn.threadId);
const where = place ? surfaceLabel(place) : null;
- const notHere = where ? `; it never types one on the screen of ${where}` : "";
+ const notHere = where ? `. On the screen of ${where} it cannot prove which site a box belongs to, so it never types one there` : "";
const signIn = where ? `Call request_sign_in so the person signs in on ${where}.` : "Call request_sign_in instead.";
if (!deps.browserSelectable(current)) {
const why = current.browser === false || current.computer === "off" || !deps.builtInBrowserOn()
diff --git a/server/index.test.ts b/server/index.test.ts
index d8cbb0aab8..67a7061d11 100644
--- a/server/index.test.ts
+++ b/server/index.test.ts
@@ -6807,7 +6807,7 @@ describe("harness HTTP API", () => {
expect((await api("PATCH", `/api/bots/${bot.id}`, { computer: "local" })).status).toBe(200);
const onScreen = await fill();
expect(onScreen.ok).toBe(false);
- expect(onScreen.text).toContain("it never types one on the screen of this computer");
+ expect(onScreen.text).toContain("On the screen of this computer it cannot prove which site a box belongs to, so it never types one there");
expect(onScreen.text).toContain("Call request_sign_in so the person signs in on this computer.");
expect((await api("PATCH", `/api/bots/${bot.id}`, { computer: "browser" })).status).toBe(200);
const inBrowser = await fill();