Skip to content

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

Merged
vincentkoc merged 19 commits intoopenclaw:mainfrom
vincentkoc:vincentkoc-code/cdp-port-range-start
Mar 2, 2026
Merged

fix(browser): support configurable CDP auto-port range start#31352
vincentkoc merged 19 commits intoopenclaw:mainfrom
vincentkoc:vincentkoc-code/cdp-port-range-start

Conversation

@vincentkoc
Copy link
Member

Summary

  • Add browser.cdpPortRangeStart to let operators move auto-assigned local CDP ports away from the default range when host port conflicts exist.
  • Wire this value through resolved browser config and profile auto-allocation.
  • Validate range overflow (for example values that would exceed 65535 once range width is applied).
  • Add focused tests for config resolution and profile allocation behavior.

Fixes #22211

Validation

  • pnpm vitest run src/browser/config.test.ts src/browser/profiles-service.test.ts src/config/schema.help.quality.test.ts

@openclaw-barnacle openclaw-barnacle bot added size: S maintainer Maintainer-authored PR labels Mar 2, 2026
@vincentkoc vincentkoc marked this pull request as ready for review March 2, 2026 07:25
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 64a14df935

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Mar 2, 2026

Greptile Summary

Added configurable browser.cdpPortRangeStart to allow operators to move auto-assigned CDP ports away from default range when host port conflicts exist.

Key Changes

  • Introduced browser.cdpPortRangeStart config option with Zod schema validation (1-65535)
  • Added resolveCdpPortRangeStart function in src/browser/config.ts:68 with overflow validation
  • Wired the new config through ResolvedBrowserConfig type, adding both cdpPortRangeStart and cdpPortRangeEnd fields
  • Updated createBrowserProfilesService in src/browser/profiles-service.ts:82 to use resolved range from state instead of recalculating
  • Added comprehensive tests for config resolution, overflow validation, and profile allocation
  • Updated all test fixtures to include the new required config fields
  • Added documentation in schema help and labels

Implementation Quality

The implementation is clean and well-structured. The validation logic correctly prevents port range overflow by calculating maxStart = 65535 - rangeSpan and rejecting values that would exceed the maximum valid port. The error messages are clear and informative. Test coverage includes both happy path (custom range start) and error cases (overflow rejection). The change maintains backward compatibility by using the derived default range as fallback when the config option is not set.

Confidence Score: 5/5

  • This PR is safe to merge with no risk of runtime issues or regressions
  • The implementation is thoroughly tested, properly validated, and backward compatible. The validation logic correctly handles edge cases including port overflow, invalid values, and boundary conditions. All test fixtures have been updated, and the change follows TypeScript best practices with strong typing throughout.
  • No files require special attention

Last reviewed commit: 64a14df

@openclaw-barnacle openclaw-barnacle bot added the agents Agent runtime and tooling label Mar 2, 2026
@vincentkoc vincentkoc merged commit 22be0c5 into openclaw:main Mar 2, 2026
20 of 21 checks passed
@vincentkoc vincentkoc deleted the vincentkoc-code/cdp-port-range-start branch March 2, 2026 07:51
mrosmarin added a commit to mrosmarin/openclaw that referenced this pull request Mar 2, 2026
* main: (212 commits)
  fix(ci): annotate feishu hoisted mock type
  fix(ci): align strict nullable typing across channels and ui
  refactor(tests): dedupe macos ipc smoke setup blocks
  refactor(tests): dedupe ios gateway and deeplink fixtures
  refactor(tests): dedupe openclawkit chat test helpers
  test(runtime): trim timer-heavy regression suites
  test(config): reuse fixtures for faster validation
  test(cli): reduce update/program suite overhead
  refactor(tests): dedupe ios defaults and setup-code helpers
  refactor(tests): dedupe swift gateway and chat fixtures
  Diffs: extend image quality configs and add PDF as a format option (openclaw#31342)
  refactor(scripts): dedupe installer CLI verification
  refactor(extensions): dedupe channel config, onboarding, and monitors
  refactor(core): extract shared usage, auth, and display helpers
  refactor(ui): dedupe state, views, and usage helpers
  refactor(scripts): dedupe guard checks and smoke helpers
  fix(browser): honor profile attachOnly for loopback CDP (openclaw#31429)
  [AI-assisted] test: fix typing and test fixture issues (openclaw#31444)
  chore(tsgo/lint): fix CI errors
  fix(browser): support configurable CDP auto-port range start (openclaw#31352)
  ...
hanqizheng pushed a commit to hanqizheng/openclaw that referenced this pull request Mar 2, 2026
…w#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
execute008 pushed a commit to execute008/openclaw that referenced this pull request Mar 2, 2026
…w#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
dawi369 pushed a commit to dawi369/davis that referenced this pull request Mar 3, 2026
…w#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
OWALabuy pushed a commit to kcinzgg/openclaw that referenced this pull request Mar 4, 2026
…w#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
zooqueen pushed a commit to hanzoai/bot that referenced this pull request Mar 6, 2026
…w#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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling maintainer Maintainer-authored PR size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Browser service CDP port (18800) conflicts with Clawline's default network port

1 participant