← Back to PRs

#21008: fix: Rename --url to --cookie-url in browser cookies set

by chilu18 open 2026-02-19 14:55 View on GitHub →
docs cli size: XS
## Summary Fixes #20976 The `browser` parent command has `--url` (Gateway WebSocket URL) via `addGatewayClientOptions`, which collides with `--url` needed by the `cookies set` subcommand (cookie domain URL). Commander.js can't distinguish between parent and child options with the same name, causing: ```bash $ openclaw browser cookies set name value --url "https://x.com" error: required option '--url <url>' not specified ``` ## Changes - Renamed `--url` → `--cookie-url` in cookies set command - Updated `opts.url` → `opts.cookieUrl` in cookie body - Updated description to reference `--cookie-url` ## Testing Updated test suite: - Added `addGatewayClientOptions` to test to properly simulate the collision - Updated existing test to use `--cookie-url` - Added new test case verifying parent `--url` + child `--cookie-url` coexist ```bash $ pnpm test src/cli/browser-cli-state.option-collisions.test.ts Test Files 1 passed (1) Tests 3 passed (3) ✅ ``` ## Usage After Fix ```bash $ openclaw browser cookies set session_id 12345 --cookie-url "https://x.com" cookie set: session_id ✅ ``` ## Impact **Low risk** - Changes only CLI flag name. The old `--url` flag was broken due to collision, so no existing working usage is affected. Closes #20976 <!-- greptile_comment --> <h3>Greptile Summary</h3> Renamed `--url` to `--cookie-url` in `browser cookies set` command to resolve Commander.js option collision with parent command's `--url` flag (Gateway WebSocket URL). **Key changes:** - Updated flag name from `--url` to `--cookie-url` in command definition - Updated option access from `opts.url` to `opts.cookieUrl` in cookie body - Added `addGatewayClientOptions` to test setup to properly simulate collision scenario - Added test case verifying parent `--url` and child `--cookie-url` coexist correctly **Issues found:** - Documentation in `docs/tools/browser.md` and `docs/zh-CN/tools/browser.md` still references old `--url` flag and needs updating <h3>Confidence Score: 4/5</h3> - Safe to merge after updating documentation to reflect the new flag name - The code change correctly resolves the Commander.js option collision and is well-tested. Test coverage includes verification that both parent and child options coexist properly. The only issue is outdated documentation that still references `--url` instead of `--cookie-url`, which prevents a score of 5. - Documentation files `docs/tools/browser.md` and `docs/zh-CN/tools/browser.md` need updates to match the new flag name <sub>Last reviewed commit: 09abbce</sub> <!-- greptile_other_comments_section --> <!-- /greptile_comment -->

Most Similar PRs