Open-source Grok Bot alternative with a virtual machine that bots can use
TypeScript ai-agentsclaude-codecodexcomputer-usedockerelectrongrokgrok-botgrok-bot-alternativeself-hostedtypescript
fix(browser): count a downloaded Chrome that fails its checks for the headless-shell hint
AdityaUmaledc1f46b05364
diff --git a/server/browser/chrome/launcher.test.ts b/server/browser/chrome/launcher.test.tsindex 94850d200a..4197ff2de9 100644--- a/server/browser/chrome/launcher.test.ts+++ b/server/browser/chrome/launcher.test.ts@@ -231,6 +231,21 @@ describe("the Chrome launcher", () => {expect(managed.runsShellForWantOfChrome()).toBe(false);});+ it("counts a downloaded Chrome that then fails its checks as the engine's own shell", async () => {+ const install = vi.fn(async (options: Parameters<typeof installChromeForTesting>[0]) => {+ const path = chromeForTestingExecutable(options.dataDir, options.pin);+ mkdirSync(dirname(path), { recursive: true });+ writeFileSync(path, "#!/bin/sh\n", { mode: 0o755 });+ return path;+ });+ const cached = launcher(mac({ chrome: false }), { install, calibrate: async () => { throw new Error("the browser exited (1) before it answered"); } });+ await cached.prepare();+ expect(install).toHaveBeenCalledTimes(1);+ expect(cached.plan()).toMatchObject({ kind: "chrome", chrome: { source: "downloaded" } });+ expect(cached.env()).toEqual({});+ expect(cached.runsShellForWantOfChrome()).toBe(true);+ });+it("keeps what the host needs behind the error a viewer gets, when Chrome cannot start there", async () => {const named = mkdtempSync(join(tmpdir(), "omb-named-"));folders.push(named);diff --git a/server/browser/chrome/launcher.ts b/server/browser/chrome/launcher.tsindex 01c12b0cf7..140d564394 100644--- a/server/browser/chrome/launcher.ts+++ b/server/browser/chrome/launcher.ts@@ -120,8 +120,9 @@ export class ChromeLauncher implements BrowserLaunch {runsShellForWantOfChrome(): boolean {const plan = this.plan();if (plan.kind === "legacy") return plan.noChrome === true;- // A download that failed leaves the engine on its own shell; an installed Chrome it would use instead does not.- return this.state.kind === "failed" && plan.kind === "download" && installedGoogleChrome(this.host) === null;+ // A download that failed, or a downloaded Chrome that then failed its checks, leaves the engine on its own shell; an installed Chrome it would use instead does not.+ const downloadFailed = plan.kind === "download" || (plan.kind === "chrome" && plan.chrome.source === "downloaded");+ return this.state.kind === "failed" && downloadFailed && installedGoogleChrome(this.host) === null;}/** Keep the shared agent-browser launcher and sidecar in the application's current language. */