fix(browser): support configurable CDP auto-port range start (#31352)

* config(browser): add cdpPortRangeStart type

* config(schema): validate browser.cdpPortRangeStart

* config(labels): add browser.cdpPortRangeStart label

* config(help): document browser.cdpPortRangeStart

* browser(config): resolve custom cdp port range start

* browser(profiles): allocate ports from resolved CDP range

* test(browser): cover cdpPortRangeStart config behavior

* test(browser): cover cdpPortRangeStart profile allocation

* test(browser): include CDP range fields in remote tab harness

* test(browser): include CDP range fields in ensure-tab harness

* test(browser): include CDP range fields in bridge auth config

* build(browser): add resolved CDP range metadata

* fix(browser): fallback CDP port allocation to derived range

* test(browser): cover missing resolved CDP range fallback

* fix(browser): remove duplicate resolved CDP range fields

* fix(agents): provide resolved CDP range in sandbox browser config

* chore(browser): format sandbox bridge resolved config

* chore(browser): reformat sandbox imports to satisfy oxfmt
This commit is contained in:
Vincent Koc
2026-03-01 23:50:50 -08:00
committed by GitHub
parent c6e5026edf
commit 22be0c5801
12 changed files with 130 additions and 2 deletions

View File

@@ -220,6 +220,8 @@ export const FIELD_HELP: Record<string, string> = {
"Disables Chromium sandbox isolation flags for environments where sandboxing fails at runtime. Keep this off whenever possible because process isolation protections are reduced.",
"browser.attachOnly":
"Restricts browser mode to attach-only behavior without starting local browser processes. Use this when all browser sessions are externally managed by a remote CDP provider.",
"browser.cdpPortRangeStart":
"Starting local CDP port used for auto-allocated browser profile ports. Increase this when host-level port defaults conflict with other local services.",
"browser.defaultProfile":
"Default browser profile name selected when callers do not explicitly choose a profile. Use a stable low-privilege profile as the default to reduce accidental cross-context state use.",
"browser.profiles":

View File

@@ -105,6 +105,7 @@ export const FIELD_LABELS: Record<string, string> = {
"browser.headless": "Browser Headless Mode",
"browser.noSandbox": "Browser No-Sandbox Mode",
"browser.attachOnly": "Browser Attach-only Mode",
"browser.cdpPortRangeStart": "Browser CDP Port Range Start",
"browser.defaultProfile": "Browser Default Profile",
"browser.profiles": "Browser Profiles",
"browser.profiles.*.cdpPort": "Browser Profile CDP Port",

View File

@@ -48,6 +48,8 @@ export type BrowserConfig = {
noSandbox?: boolean;
/** If true: never launch; only attach to an existing browser. Default: false */
attachOnly?: boolean;
/** Starting local CDP port for auto-assigned browser profiles. Default derives from gateway port. */
cdpPortRangeStart?: number;
/** Default profile to use when profile param is omitted. Default: "chrome" */
defaultProfile?: string;
/** Named browser profiles with explicit CDP ports or URLs. */

View File

@@ -250,6 +250,7 @@ export const OpenClawSchema = z
headless: z.boolean().optional(),
noSandbox: z.boolean().optional(),
attachOnly: z.boolean().optional(),
cdpPortRangeStart: z.number().int().min(1).max(65535).optional(),
defaultProfile: z.string().optional(),
snapshotDefaults: BrowserSnapshotDefaultsSchema,
ssrfPolicy: z