fix(browser): preserve explicit cdpPort when cdpUrl omits port#83707
Conversation
|
Codex review: passed. Workflow note: Future ClawSweeper reviews update this same comment in place. How this review workflow works
Summary Reproducibility: yes. Source inspection shows current main resolves a portless profile PR rating Rank-up moves:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. PR egg Rarity: 🥚 common. What is this egg doing here?
Real behavior proof Risk before merge Maintainer options:
Next step before merge Security Review detailsBest possible solution: Land the browser parser/profile-resolution fix with the regression tests once maintainers accept the explicit-port precedence rule; add a short docs or release-note sentence only if maintainers want that upgrade behavior spelled out. Do we have a high-confidence way to reproduce the issue? Yes. Source inspection shows current main resolves a portless profile Is this the best way to solve the issue? Yes. The fix belongs in browser profile resolution and URL parsing because that is where URL-derived defaults currently replace configured profile ports; the helper handles WHATWG default-port normalization and the tests cover the edge cases. Label justifications:
What I checked:
Likely related people:
Codex review notes: model gpt-5.5, reasoning high; reviewed against 06a39015f21c. |
|
🦞✅ Source: What merged:
Automerge notes:
The automerge loop is complete. Automerge progress:
|
When a browser profile sets both cdpPort (e.g. 18800) and a cdpUrl without an explicit port (e.g. "http://127.0.0.1"), resolveProfile unconditionally overwrote cdpPort with the URL's protocol default (80). This caused Chrome to attempt binding port 80, which fails without root privileges. Now cdpPort from the URL only overrides an existing cdpPort when the URL contains an explicit port. When the URL omits the port and cdpPort is already set, the existing value is preserved.
The previous implementation checked parsed.parsed.port in resolveProfile, which missed WHATWG-normalized default ports (:80/:443) and was vulnerable to false positives on IPv6 hosts and userinfo colons. Move explicit-port detection into parseBrowserHttpUrl as hasExplicitPort using a robust raw-string parser that handles: - IPv6 bracket notation ([::1] vs [::1]:9222) - userinfo (user:pass@host — colon is not a port) - WHATWG default-port normalization (:80/:443 → empty .port) Return normalizedWithPort alongside normalized so callers never need raw-string URL hacks. resolveProfile now reads: explicit URL port → use it no URL port + cdpPort → inject cdpPort no URL port + no cdpPort → protocol default Consolidate scattered port-precedence tests into a focused describe block covering all 9 cases including IPv6, default ports, stale WS, and error.
92dca8f to
070c31c
Compare
…law#83707) Summary: - The PR adds raw explicit-port detection for browser CDP URLs, updates profile resolution precedence, adds regression tests, and records the browser fix in the changelog. - Reproducibility: yes. Source inspection shows current main resolves a portless profile `cdpUrl` through `par ... 443, and overwrites the configured `cdpPort`; the source PR also provides live before/after Chrome output. Automerge notes: - PR branch already contained follow-up commit before automerge: fix(browser): encapsulate explicit-port detection in parseBrowserHttpUrl - PR branch already contained follow-up commit before automerge: fix(browser): preserve explicit cdpPort when cdpUrl omits port Validation: - ClawSweeper review passed for head 070c31c. - Required merge gates passed before the squash merge. Prepared head SHA: 070c31c Review: openclaw#83707 (comment) Co-authored-by: Hongwei Ma <marvae24@gmail.com> Co-authored-by: clawsweeper <274271284+clawsweeper[bot]@users.noreply.github.com> Co-authored-by: clawsweeper[bot] <274271284+clawsweeper[bot]@users.noreply.github.com> Approved-by: takhoffman Co-authored-by: takhoffman <781889+takhoffman@users.noreply.github.com>
Makes #82166 merge-ready for the ClawSweeper automerge loop.
The edit pass should inspect the live PR diff, review comments, and failing checks; rebase if needed; keep the contributor branch credited; and stop only when validation is green or an external blocker is proven.
ClawSweeper 🐠 replacement reef notes:
Co-author credit kept:
fish notes: model gpt-5.5, reasoning high; reviewed against 92dca8f.