Skip to content

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

Browser pane: CI fixes: the sign-in import dialog uses the app's own dropdowns, and two test fixes

milind-soni2867c22c817c
diff --git a/server/bot-box/env.test.ts b/server/bot-box/env.test.ts
index 993c3efc6a..366f78d3a4 100644
--- a/server/bot-box/env.test.ts
+++ b/server/bot-box/env.test.ts
@@ -51,7 +51,7 @@ const SERVER_ONLY_OMB: ReadonlySet<string> = new Set([
"OMB_SHARED_WORKSPACE_FULL_ACCESS", "OMB_SIGNIN_EMAILS", "OMB_SIGNIN_MEMBER_EMAILS", "OMB_SIGNIN_SMTP_FROM",
"OMB_SIGNIN_SMTP_URL", "OMB_SKILLS_DIR", "OMB_SMOKE_BUNDLED_CUA", "OMB_SMOKE_CUA", "OMB_SMOKE_KEEP_OPEN",
"OMB_SMOKE_TEST", "OMB_SSE_HEARTBEAT_MS", "OMB_STATIC_DIR", "OMB_SYNC_ROOT", "OMB_TAILNET_ADDRESSES", "OMB_TAILNET_NAME", "OMB_TAILNET_SERVED", "OMB_TEAM_AWAY_WINDOW_MS",
- "OMB_TEAM_PRESENCE_GRACE_MS", "OMB_TEST_INTERNAL_CAPABILITY_KEY", "OMB_TEST_ORG_LIBRARY_KEY",
+ "OMB_TEAM_PRESENCE_GRACE_MS", "OMB_TEST_COOKIE_KEY", "OMB_TEST_INTERNAL_CAPABILITY_KEY", "OMB_TEST_ORG_LIBRARY_KEY",
"OMB_TEST_PLAN_USAGE_FILE", "OMB_TEST_TAILNET_STAND_IN", "OMB_THREAD_CACHE_MB", "OMB_TOOL_STALL_MS", "OMB_TREG_KEY", "OMB_TREG_URL", "OMB_TTS_DEFAULT_VOICE",
"OMB_TTS_KEY", "OMB_TUNNEL_ORIGIN_PORT", "OMB_TUNNEL_SOCKET", "OMB_TURNS_MAX_RUNNING", "OMB_TURN_STALL_MS", "OMB_UNATTENDED_TURN_MAX_DENIALS", "OMB_UNATTENDED_TURN_MAX_MS", "OMB_UNATTENDED_TURN_MAX_REQUESTS", "OMB_UNDER_IMAGE_INIT", "OMB_UPDATE_CHANNEL", "OMB_UPDATE_INSTALL",
"OMB_USAGE_CAP_DAILY_TOKENS", "OMB_USAGE_CAP_DAILY_USD", "OMB_USAGE_CAP_MONTHLY_TOKENS", "OMB_USAGE_CAP_MONTHLY_USD",
diff --git a/server/browser/cookies/cookies.test.ts b/server/browser/cookies/cookies.test.ts
index e6b85035be..798a2ac8de 100644
--- a/server/browser/cookies/cookies.test.ts
+++ b/server/browser/cookies/cookies.test.ts
@@ -247,6 +247,8 @@ describe("importing one site", () => {
const sink = new RecordingSink();
expect(await importCookies(request(folder, "darwin", fakeKeys({}), { source: "safari", profile: "default", sink }))).toMatchObject({ ok: true, imported: 1 });
expect(sink.written).toEqual([{ url: "https://example.com/", name: "safari", value: "apple", domain: ".example.com", path: "/", secure: true, httpOnly: true, sameSite: "unspecified", expirationDate: LATER }]);
+ // Windows has no mode bits that refuse the file's owner, and Safari's file only exists on a Mac.
+ if (process.platform === "win32") return;
chmodSync(file, 0o000);
try {
expect(await importCookies(request(folder, "darwin", fakeKeys({}), { source: "safari", profile: "default" }))).toEqual({ ok: false, reason: "full-disk-access" });
diff --git a/src/components/browser/CookieImportDialog.dom.test.ts b/src/components/browser/CookieImportDialog.dom.test.ts
index 3daa4067ee..4bae82b747 100644
--- a/src/components/browser/CookieImportDialog.dom.test.ts
+++ b/src/components/browser/CookieImportDialog.dom.test.ts
@@ -52,6 +52,20 @@ describe("the sign-in import dialog", () => {
expect(host.querySelector('[role="status"]')?.textContent).toBe("Imported 4 cookies for github.com.");
});
+ it("picks the browser and profile in the app's own dropdowns, a new browser starting at its first profile", async () => {
+ bridge.import.mockResolvedValue({ ok: true, site: "github.com", imported: 1, sessionOnly: 0, skipped: {} });
+ await render();
+ const [from, profile] = [...host.querySelectorAll<HTMLSelectElement>('select[data-look="select"]')];
+ expect([from, profile].map((select) => select!.value)).toEqual(["chrome", "Default"]);
+ await act(async () => { profile!.value = "Profile 1"; profile!.dispatchEvent(new Event("change", { bubbles: true })); });
+ expect(text()).toContain("from Google Chrome (Work)");
+ await act(async () => { from!.value = "firefox"; from!.dispatchEvent(new Event("change", { bubbles: true })); });
+ await settle();
+ expect(host.querySelectorAll<HTMLSelectElement>('select[data-look="select"]')[1]!.value).toBe("abc.default");
+ await submit();
+ expect(bridge.import).toHaveBeenCalledWith({ botId: "scout", threadId: null, site: "github.com", source: "firefox", profile: "abc.default" });
+ });
+
it("says plainly why nothing was imported", async () => {
bridge.import.mockResolvedValue({ ok: false, reason: "full-disk-access" });
await render("example.com");
diff --git a/src/components/browser/CookieImportDialog.tsx b/src/components/browser/CookieImportDialog.tsx
index 60801ce7c3..fdffb5dc0a 100644
--- a/src/components/browser/CookieImportDialog.tsx
+++ b/src/components/browser/CookieImportDialog.tsx
@@ -3,6 +3,7 @@ import { X } from "lucide-react";
import { loginSite } from "../../../shared/logins";
import { t } from "@/lib/i18n";
+import { Select } from "../Select";
import type { LocaleKey } from "@/locales";
const button = "rounded-md p-1.5 text-ink-secondary hover:bg-inset hover:text-ink";
@@ -126,18 +127,18 @@ export function CookieImportDialog({ open, botId, botName, threadId, site: initi
<form className="flex flex-col gap-3" onSubmit={(event) => { event.preventDefault(); if (ready) void start(); }}>
<div className="grid grid-cols-2 gap-2">
<label className="flex flex-col gap-1 text-[12px] text-ink-secondary">{t("browser.cookieImport.from")}
- <select className={field} value={sourceId} disabled={busy} onChange={(event) => {
+ <Select className="w-full" value={sourceId} disabled={busy} onChange={(event) => {
const next = sources.find((candidate) => candidate.id === event.target.value);
setSourceId(event.target.value);
setProfileId(next?.profiles[0]?.id ?? "");
}}>
{sources.map((candidate) => <option key={candidate.id} value={candidate.id}>{candidate.name}</option>)}
- </select>
+ </Select>
</label>
<label className="flex flex-col gap-1 text-[12px] text-ink-secondary">{t("browser.cookieImport.profile")}
- <select className={field} value={profileId} disabled={busy} onChange={(event) => setProfileId(event.target.value)}>
+ <Select className="w-full" value={profileId} disabled={busy} onChange={(event) => setProfileId(event.target.value)}>
{source?.profiles.map((candidate) => <option key={candidate.id} value={candidate.id}>{candidate.name}</option>)}
- </select>
+ </Select>
</label>
</div>
<label className="flex flex-col gap-1 text-[12px] text-ink-secondary">{t("browser.cookieImport.site")}