diff --git a/CHANGELOG.md b/CHANGELOG.md index 8b3bdc50e..cb4e8cb6e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ ### Fixed +- Browser: preserve authenticated model-picker errors instead of appending a misleading cookie/login hint after login has already been verified. - Browser: distinguish requested CLI model keys from verified ChatGPT picker labels without inferring a server-side GPT version from a generic label. Fixes #317. Thanks @DragonFSKY! - Browser: recognize GPT-5.6 Sol as the selected model when ChatGPT exposes Pro in its independent effort pill. Thanks @jung0han! - Browser: treat WSL's systemd-resolved loopback DNS stub as localhost when connecting to a freshly launched Chrome DevTools endpoint. Thanks @Rokurolize! diff --git a/src/browser/index.ts b/src/browser/index.ts index 87952949d..01977367c 100644 --- a/src/browser/index.ts +++ b/src/browser/index.ts @@ -172,6 +172,10 @@ function shouldPreserveBrowserOnError(error: unknown, headless: boolean): boolea return classifyPreservedBrowserError(error, headless) !== null; } +function normalizeAuthenticatedModelSelectionError(error: unknown): Error { + return error instanceof Error ? error : new Error(String(error)); +} + function shouldKeepLocalBrowserOpen(options: { effectiveKeepBrowser: boolean; preserveBrowserOnError: boolean; @@ -1474,12 +1478,9 @@ export async function runBrowserMode(options: BrowserRunOptions): Promise { - const base = error instanceof Error ? error.message : String(error); - const hint = - appliedCookies === 0 - ? " No cookies were applied; log in to ChatGPT in Chrome or provide inline cookies (--browser-inline-cookies[(-file)] or ORACLE_BROWSER_COOKIES_JSON)." - : ""; - throw new Error(`${base}${hint}`); + // Login has already been verified above. Preserve the picker failure instead of + // misdiagnosing an unavailable model as missing cookies. + throw normalizeAuthenticatedModelSelectionError(error); }); await raceWithDisconnect(ensurePromptReady(Runtime, config.inputTimeoutMs, logger)); logger( @@ -3881,6 +3882,7 @@ export const __test__ = { isManualLoginProfileInitialized, isImageOnlyUiChromeText, listIgnoredRemoteChromeFlags, + normalizeAuthenticatedModelSelectionError, resolveManualLoginWaitMs, shouldCleanupBlankTabsAfterLastLease, shouldCloseOwnedRunTargetAfterRun, diff --git a/tests/browser/index.test.ts b/tests/browser/index.test.ts index 7a01559b8..b583664c5 100644 --- a/tests/browser/index.test.ts +++ b/tests/browser/index.test.ts @@ -73,6 +73,21 @@ describe("shouldPreserveBrowserOnErrorForTest", () => { }); }); +describe("authenticated model-selection errors", () => { + test("preserves picker diagnostics without adding cookie guidance", () => { + const error = new BrowserAutomationError( + 'Unable to find model option matching "GPT-5.2 Instant". Available: GPT-5.6 Sol.', + { stage: "model-selection" }, + ); + + const normalized = __test__.normalizeAuthenticatedModelSelectionError(error); + + expect(normalized).toBe(error); + expect(normalized.message).toContain("Available: GPT-5.6 Sol"); + expect(normalized.message).not.toMatch(/cookies|log in/i); + }); +}); + describe("browser run target cleanup", () => { test("never retains a copied profile after a preserved browser error", () => { expect(