← Back to PRs

#23189: feat(browser): add custom userDataDir support for Chrome profiles

by delta8z open 2026-02-22 03:10 View on GitHub →
size: S
## Summary - Allow browser profiles to specify a custom `userDataDir` path, overriding the default `~/.openclaw/browser/{profile}/user-data` location - Merge `cdpPort`/`color` defaults into existing default profile when only `userDataDir` is set in config - Validate `userDataDir` is an absolute path at schema parse time (cross-platform: Windows and Unix) - Add runtime `path.isAbsolute` guard in `launchOpenClawChrome` as defense-in-depth - Restore `cdpPort||cdpUrl` refine validation that was missing - Make profile `color` optional in schema (fallback to resolved global color) ## Test plan - [ ] Set `userDataDir` to a custom absolute path in browser profile config and verify Chrome launches using that directory - [ ] Verify that omitting `userDataDir` still uses the default `~/.openclaw/browser/{profile}/user-data` path - [ ] Verify schema rejects relative paths for `userDataDir` - [ ] Verify schema still requires `cdpPort` or `cdpUrl` on profiles - [ ] Verify profile with only `userDataDir` set on the default profile auto-fills `cdpPort` and `color` 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- greptile_comment --> <h3>Greptile Summary</h3> Added `userDataDir` field to browser profile configuration, allowing custom Chrome user data directory paths. The implementation includes schema validation for absolute paths (cross-platform), runtime validation in `launchOpenClawChrome`, and default merging for partial profiles. Made profile `color` optional in schema with fallback to global/resolved color. The changes integrate with existing browser profile system without breaking current functionality. <h3>Confidence Score: 4/5</h3> - Safe to merge with minor documentation concerns - Implementation is sound with proper validation at both schema and runtime levels. Path validation correctly handles cross-platform absolute paths and rejects relative/tilde paths. The PR description contains an inaccuracy about restoring cdpPort/cdpUrl validation (it was never missing) and a misleading test plan item (cannot set only userDataDir without cdpPort/cdpUrl due to schema validation). No tests were added for the new feature. Code changes follow existing patterns and don't introduce security issues. - No files require special attention - changes are straightforward and properly validated <sub>Last reviewed commit: 0500ef9</sub> <!-- greptile_other_comments_section --> <sub>(2/5) Greptile learns from your feedback when you react with thumbs up/down!</sub> <!-- /greptile_comment -->

Most Similar PRs