Skip to content
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
a92a1eb
feat(browser): process-wide browser identity, chosen before ready
brennanb2025 Sep 14, 2026
3bf2fb8
test(browser): cover cross-context UA wire identity
brennanb2025 Sep 14, 2026
02b0ed1
refactor(browser): make user agent identity app-wide
brennanb2025 Sep 14, 2026
ae9f1a7
Merge remote-tracking branch 'origin/brennanb2025/ua-b-tests' into br…
brennanb2025 Sep 14, 2026
d3a2065
test(browser): repair process identity wire fixture
brennanb2025 Sep 14, 2026
fe99f62
Fix browser identity startup migration failures
brennanb2025 Sep 14, 2026
7db9c54
WIP: rescue in-flight reduced-design work from a dead worker
brennanb2025 Sep 15, 2026
99383f1
fix(browser): repair the rescued identity work so it typechecks
brennanb2025 Sep 15, 2026
0fe8b12
refactor(browser): make the identity store the only writer
brennanb2025 Sep 15, 2026
26e58f2
feat(browser): make resetting unhealthy identity data explicit and lo…
brennanb2025 Sep 15, 2026
1c0f88b
feat(browser): advertise the identity capability only where it exists
brennanb2025 Sep 15, 2026
f8cf6b4
refactor(browser): delete the identity write queue and guard backup u…
brennanb2025 Sep 15, 2026
13a3461
test(browser): guard the identity capability and harden two weak asse…
brennanb2025 Sep 15, 2026
a08fe66
Merge remote-tracking branch 'origin/main' into brennanb2025/ua-b-finish
brennanb2025 Sep 15, 2026
2683f30
test(browser): classify the identity channels on the preview seam
brennanb2025 Sep 15, 2026
52b3fed
test(browser): audit the identity rig's global-fetch call sites
brennanb2025 Sep 15, 2026
e5ada9d
fix(browser): strip an app name that contains a space
brennanb2025 Sep 15, 2026
9152a46
fix(browser): anchor the cleaner on the gap before Chrome/
brennanb2025 Sep 15, 2026
3a90519
test(browser): repair the cleaner's case table
brennanb2025 Sep 15, 2026
be4cb8c
test(browser): make a CI-only capture failure diagnosable
brennanb2025 Sep 15, 2026
e414942
fix(browser): let an explicit choice retire the migration notice for …
brennanb2025 Sep 15, 2026
b4e7d02
fix(browser): stop reporting an unhydratable profile as a retired choice
brennanb2025 Sep 15, 2026
b9bb777
fix(browser): stop rewriting worker requests for viewport emulation
brennanb2025 Sep 15, 2026
131559b
test(browser): point the identity tests at keys and writers that exist
brennanb2025 Sep 15, 2026
26bd10f
fix(browser): let an unavailable process identity reject instead of t…
brennanb2025 Sep 15, 2026
a20223e
docs(browser): scope the meta-store claim about dropped legacy keys
brennanb2025 Sep 15, 2026
1a14ae4
test(browser): pin the unmapped-webContents path beside an emulated tab
brennanb2025 Sep 15, 2026
11ba454
test(browser): make the ordering fixture exhibit a multi-word app name
brennanb2025 Sep 15, 2026
68593f4
test(settings): cover the local branch of the browser identity setting
brennanb2025 Sep 15, 2026
0ec9662
test(browser): run the real registry path in the ready identity pin
brennanb2025 Sep 15, 2026
be0def2
fix(browser): reject an unrecognized identity mode at the IPC door
brennanb2025 Sep 15, 2026
d92e400
fix(settings): name the reset command where identity data is unusable
brennanb2025 Sep 15, 2026
17b3565
fix(i18n): add the browser identity keys to the localization catalog
brennanb2025 Sep 15, 2026
c95411e
Merge remote-tracking branch 'origin/main' into brennanb2025/ua-b-finish
brennanb2025 Sep 15, 2026
816df28
fix(i18n): regenerate the runtime-required English catalog
brennanb2025 Sep 15, 2026
5f169b4
fix(browser): attach nested CDP targets paused before enabling Network
brennanb2025 Sep 15, 2026
a423936
fix(settings): localize the browser identity search keywords
brennanb2025 Sep 15, 2026
ac246d2
Merge remote-tracking branch 'origin/main' into brennanb2025/ua-b-finish
brennanb2025 Sep 15, 2026
b30e7c4
fix(browser): await route policy setup
brennanb2025 Sep 15, 2026
f8c4f45
fix(browser): satisfy strict static analysis
brennanb2025 Sep 15, 2026
f96dc0f
test(browser): update live identity fixture API
brennanb2025 Sep 15, 2026
1b60eb4
test(browser): preserve native UA in live probe
brennanb2025 Sep 15, 2026
9dde34e
Merge remote-tracking branch 'origin/main' into brennanb2025/ua-b-finish
brennanb2025 Sep 15, 2026
71e6e44
fix(browser): close the open review findings on the identity revert
brennanb2025 Sep 15, 2026
abc6b71
test(browser): model a real Electron fallback in the startup UA fixture
brennanb2025 Sep 15, 2026
21e253b
Merge remote-tracking branch 'origin/main' into brennanb2025/ua-b-finish
brennanb2025 Sep 15, 2026
d47738b
Merge remote-tracking branch 'origin/main' into brennanb2025/ua-b-finish
brennanb2025 Sep 16, 2026
56f460d
Merge remote-tracking branch 'origin/main' into brennanb2025/ua-b-finish
brennanb2025 Sep 16, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/site/content/docs/browser/overview.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,4 @@ The browser is also scriptable by agents via the [Orca CLI](/docs/cli/overview)
## Next steps

- [Design Mode](/docs/browser/design-mode) — turn the browser into a pointer-to-code feedback loop.
- [Browser-use profiles](/docs/browser/profiles) — run the browser with a specific login, cookie jar, or user agent.
- [Browser-use profiles](/docs/browser/profiles) — run the browser with a specific login or cookie jar.
11 changes: 7 additions & 4 deletions docs/site/content/docs/browser/profiles.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,19 @@
title: Browser-use profiles
---

Browser-use profiles let you run the Orca browser with a specific identity — a logged-in user, a particular cookie jar, a custom user-agent. Useful when an agent needs to log in, reproduce a session-specific bug, or emulate multiple users.
Browser-use profiles let you run the Orca browser with a specific identity — a logged-in user or a particular cookie jar. Useful when an agent needs to log in, reproduce a session-specific bug, or emulate multiple users.

## Create a profile

1. Open [Settings → Browser → Profiles](/docs/settings).
1. Click **Add profile**, give it a name.
1. Optionally seed it with cookies, a user-agent, and a viewport size.
1. Default profiles remove Orca and Electron tokens from the browser engine's user agent, preserving the Chrome-shaped identity expected by imported sessions. This focused compatibility measure does not make the embedded browser identical to Chrome. Google sign-in hosts use a scoped Firefox identity. If a site rejects the cleaned identity, including some Cloudflare-protected sites, create a profile that keeps the **native Electron user agent** instead.
1. Optionally seed it with cookies and a viewport size.

You can also create a no-spoof profile from the CLI with `orca tab profile create --no-ua-spoof` when you script browser setup.
## Browser identity

The browser user agent is an app-wide choice because documents and web workers must present one coherent identity. Open **Settings → Browser → Browser identity** to choose between the cleaned identity and Electron's native identity. The change takes effect after you restart Orca.

The cleaned identity removes Orca and Electron tokens from the browser engine's user agent, preserving the Chrome-shaped identity expected by imported sessions. This focused compatibility measure does not make the embedded browser identical to Chrome. In **Cleaned** mode, Google sign-in hosts use a scoped Firefox identity. **Native** mode keeps Electron's identity for sites that reject the cleaned identity, including some Cloudflare-protected sites, but Google sign-in is unavailable; switch back to **Cleaned** and restart Orca to sign in.

## Cookie import and Google sign-in

Expand Down
3 changes: 1 addition & 2 deletions src/cli/browser-format.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,7 @@ export function formatBrowserProfileList(result: BrowserProfileListResult): stri
.map((profile) => {
const marker = profile.scope === 'default' ? '* ' : ' '
const source = profile.source?.browserFamily ?? 'none'
const userAgent = profile.userAgentMode === 'native' ? ' ua:native' : ''
return `${marker}${profile.id} ${profile.label} ${profile.scope} source:${source}${userAgent}`
return `${marker}${profile.id} ${profile.label} ${profile.scope} source:${source}`
})
.join('\n')
}
Expand Down
5 changes: 5 additions & 0 deletions src/cli/browser-handler-groups.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ import type { HandlerGroup } from './handler-group-manifest'
// Why split out: the browser command surface is a third of the CLI's groups and
// changes as a unit, so it keeps handler-group-manifest.ts readable at a glance.
export const BROWSER_HANDLER_GROUPS: readonly HandlerGroup[] = [
{
name: 'browser-identity',
keys: ['browser identity get', 'browser identity set'],
load: async () => (await import('./handlers/browser-identity.js')).BROWSER_IDENTITY_HANDLERS
},
{
name: 'browser-nav',
keys: [
Expand Down
120 changes: 70 additions & 50 deletions src/cli/browser.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,76 @@ describe('orca cli browser page targeting', () => {
})
})

describe('orca cli browser identity', () => {
beforeEach(() => {
callMock.mockReset()
})

afterEach(() => {
vi.restoreAllMocks()
})

it('gets the host identity only after capability negotiation', async () => {
queueFixtures(
callMock,
okFixture('status', { capabilities: ['browser.identity.v1'] }),
okFixture('identity', {
identity: {
state: 'valid',
appliedMode: 'clean',
configuredMode: 'native',
explicitSelection: true,
migrationNoticePending: false,
restartRequired: true
},
migrationNotice: null
})
)
vi.spyOn(console, 'log').mockImplementation(() => {})

await main(['browser', 'identity', 'get', '--json'], '/tmp/not-an-orca-worktree')

expect(callMock).toHaveBeenNthCalledWith(1, 'status.get')
expect(callMock).toHaveBeenNthCalledWith(2, 'browser.identity.get')
})

it('sets the host identity through the runtime writer', async () => {
queueFixtures(
callMock,
okFixture('status', { capabilities: ['browser.identity.v1'] }),
okFixture('identity', {
ok: true,
identity: {
state: 'valid',
appliedMode: 'clean',
configuredMode: 'native',
explicitSelection: true,
migrationNoticePending: false,
restartRequired: true
}
})
)
vi.spyOn(console, 'log').mockImplementation(() => {})

await main(
['browser', 'identity', 'set', '--mode', 'native', '--json'],
'/tmp/not-an-orca-worktree'
)

expect(callMock).toHaveBeenNthCalledWith(2, 'browser.identity.set', { mode: 'native' })
})

it('refuses an older runtime instead of guessing at identity support', async () => {
queueFixtures(callMock, okFixture('status', { capabilities: [] }))
const error = vi.spyOn(console, 'error').mockImplementation(() => {})

await main(['browser', 'identity', 'get'], '/tmp/not-an-orca-worktree')

expect(callMock).toHaveBeenCalledTimes(1)
expect(error).toHaveBeenCalledWith(expect.stringContaining('Update or restart Orca'))
})
})

describe('orca cli browser profile management', () => {
beforeEach(() => {
callMock.mockReset()
Expand Down Expand Up @@ -435,29 +505,6 @@ describe('orca cli browser tab profiles', () => {
expect(logSpy).toHaveBeenCalledWith('No browser profiles found.')
})

it('marks native-UA profiles in text output', async () => {
queueFixtures(
callMock,
okFixture('req_profiles_native_ua', {
profiles: [
{
id: 'google',
scope: 'isolated',
label: 'Google',
partition: 'persist:orca-browser-session-google',
source: null,
userAgentMode: 'native'
}
]
})
)
const logSpy = vi.spyOn(console, 'log').mockImplementation(() => {})

await main(['tab', 'profile', 'list'], '/tmp/not-an-orca-worktree')

expect(logSpy).toHaveBeenCalledWith(expect.stringContaining('ua:native'))
})

it('creates isolated browser tab profiles by default', async () => {
queueFixtures(
callMock,
Expand Down Expand Up @@ -509,33 +556,6 @@ describe('orca cli browser tab profiles', () => {
})
})

it('creates a profile with the native user agent when requested', async () => {
queueFixtures(
callMock,
okFixture('req_profile_native_ua', {
profile: {
id: 'google',
scope: 'isolated',
label: 'Google',
partition: 'persist:orca-browser-session-google',
userAgentMode: 'native'
}
})
)
vi.spyOn(console, 'log').mockImplementation(() => {})

await main(
['tab', 'profile', 'create', '--label', 'Google', '--no-ua-spoof', '--json'],
'/tmp/not-an-orca-worktree'
)

expect(callMock).toHaveBeenCalledWith('browser.profileCreate', {
label: 'Google',
scope: 'isolated',
userAgentMode: 'native'
})
})

it('rejects unknown --scope values instead of silently defaulting to isolated', async () => {
const errorSpy = vi.spyOn(console, 'error').mockImplementation(() => {})

Expand Down
63 changes: 63 additions & 0 deletions src/cli/handlers/browser-identity.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
import type {
BrowserIdentityModeSetResult,
BrowserIdentityModeStatus,
BrowserUserAgentMode
} from '../../shared/browser-user-agent-mode'
import { BROWSER_IDENTITY_RUNTIME_CAPABILITY } from '../../shared/protocol-version'
import type { RuntimeStatus } from '../../shared/runtime-types'
import type { CommandHandler, HandlerContext } from '../dispatch'
import { getRequiredStringFlag } from '../flags'
import { printResult } from '../format'
import { RuntimeClientError } from '../runtime-client'

async function assertBrowserIdentitySupported({ client }: HandlerContext): Promise<void> {
const status = await client.call<RuntimeStatus>('status.get')
if (!status.result.capabilities?.includes(BROWSER_IDENTITY_RUNTIME_CAPABILITY)) {
throw new RuntimeClientError(
'incompatible_runtime',
'The running Orca runtime does not support browser identity management. Update or restart Orca and try again.'
)
}
}

function parseMode(flags: Map<string, string | boolean>): BrowserUserAgentMode {
const mode = getRequiredStringFlag(flags, 'mode')
if (mode !== 'clean' && mode !== 'native') {
throw new RuntimeClientError('invalid_argument', '--mode must be "clean" or "native"')
}
return mode
}

function formatStatus(status: BrowserIdentityModeStatus): string {
const { identity } = status
if (identity.configuredMode === null) {
return `Browser identity: ${identity.state}; Cleaned is applied for this launch. Explicit reset required.`
}
return `Browser identity: ${identity.configuredMode} (applied: ${identity.appliedMode}${identity.restartRequired ? ', restart required' : ''})`
}

export const BROWSER_IDENTITY_HANDLERS: Record<string, CommandHandler> = {
'browser identity get': async (context) => {
await assertBrowserIdentitySupported(context)
const result = await context.client.call<BrowserIdentityModeStatus>('browser.identity.get')
printResult(result, context.json, formatStatus)
},
'browser identity set': async (context) => {
const mode = parseMode(context.flags)
// Opt-in only: without it the host refuses to overwrite corrupt or newer-version data.
const reset = context.flags.get('reset') === true
await assertBrowserIdentitySupported(context)
const result = await context.client.call<BrowserIdentityModeSetResult>('browser.identity.set', {
mode,
...(reset ? { reset: true } : {})
})
if (!result.result.ok) {
throw new RuntimeClientError(result.result.error.code, result.result.error.message)
}
printResult(result, context.json, ({ identity }) =>
identity.restartRequired
? `Browser identity set to ${identity.configuredMode}; restart Orca to apply it.`
: `Browser identity set to ${identity.configuredMode}.`
)
}
}
3 changes: 1 addition & 2 deletions src/cli/handlers/browser-profile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@ export const BROWSER_PROFILE_HANDLERS: Record<string, CommandHandler> = {
const scope = parseScopeFlag(flags)
const result = await client.call<BrowserProfileCreateResult>('browser.profileCreate', {
label,
scope,
...(flags.get('no-ua-spoof') === true ? { userAgentMode: 'native' } : {})
scope
})
if (result.result.profile === null) {
// Why: registry refuses non-isolated/imported scopes; we already validated
Expand Down
1 change: 0 additions & 1 deletion src/cli/help.ts
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,6 @@ export function formatFlagHelp(flag: string): string {
page: '--page <id> Stable browser page id from `orca tab list --json`',
profile: '--profile <id> Browser profile id',
'show-profile': '--show-profile Include tab profile in text output',
'no-ua-spoof': "--no-ua-spoof Keep Electron's native user agent",
format: '--format <png|jpeg> Screenshot image format'
}

Expand Down
1 change: 0 additions & 1 deletion src/cli/root-help-text-secondary.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,6 @@ export const ROOT_HELP_TEXT_SECONDARY = [
' --page <id> Stable browser page id (preferred for concurrent workflows)',
' --profile <id> Browser profile id',
" --show-profile Include the tab's browser profile in text output",
" --no-ua-spoof Keep Electron's native user agent for a new profile",
' --format <png|jpeg> Screenshot image format',
' --from <ref> Drag source element ref',
' --to <ref> Drag target element ref',
Expand Down
18 changes: 15 additions & 3 deletions src/cli/specs/browser-basic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,19 @@ import type { CommandSpec } from '../args'
import { GLOBAL_FLAGS } from '../args'

export const BROWSER_BASIC_COMMAND_SPECS: CommandSpec[] = [
{
path: ['browser', 'identity', 'get'],
summary: 'Show the browser identity configured on this Orca host',
usage: 'orca browser identity get [--json]',
aliases: [['browser', 'identity', 'show']],
allowedFlags: [...GLOBAL_FLAGS]
},
{
path: ['browser', 'identity', 'set'],
summary: 'Choose the browser identity for every page on this Orca host',
usage: 'orca browser identity set --mode <clean|native> [--reset] [--json]',
allowedFlags: [...GLOBAL_FLAGS, 'mode', 'reset']
},
{
path: ['open-url'],
summary: 'Open a URL on the paired client that hosts this terminal',
Expand Down Expand Up @@ -196,9 +209,8 @@ export const BROWSER_BASIC_COMMAND_SPECS: CommandSpec[] = [
{
path: ['tab', 'profile', 'create'],
summary: 'Create a browser session profile for browser tabs',
usage:
'orca tab profile create --label <name> [--scope <isolated|imported>] [--no-ua-spoof] [--json]',
allowedFlags: [...GLOBAL_FLAGS, 'label', 'scope', 'no-ua-spoof']
usage: 'orca tab profile create --label <name> [--scope <isolated|imported>] [--json]',
allowedFlags: [...GLOBAL_FLAGS, 'label', 'scope']
},
{
path: ['tab', 'profile', 'delete'],
Expand Down
13 changes: 13 additions & 0 deletions src/main/browser/browser-google-auth-ua.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,19 @@ export function isGoogleAuthUrl(rawUrl: string): boolean {
}
}

export function shouldUseGoogleAuthIdentity(
url: string,
referrer: string,
resourceType: string
): boolean {
if (isGoogleAuthUrl(url)) {
return true
}
// Why: early cross-host subresources can leave before the WebContents Firefox override lands;
// the auth referrer identifies their owning flow. Main-frame exits restore the process identity.
return resourceType !== 'mainFrame' && isGoogleAuthUrl(referrer)
}

// Why: rv:/Gecko/Firefox tokens must line up with a real released build and the
// platform token must match the host OS, or the UA is internally inconsistent and
// itself a bot tell.
Expand Down
Loading
Loading