-
Notifications
You must be signed in to change notification settings - Fork 1.6k
wait --url glob pattern matching broken after Rust rewrite #1061
Description
Bug Description
The wait --url command does not support glob patterns, despite the documentation and help text showing glob examples. This is a regression introduced during the Native Rust rewrite (f341c0a).
Current Behavior
wait --url uses JavaScript String.includes() for matching, which treats glob characters (*, **) as literal strings. This means any pattern containing wildcards will never match.
agent-browser open https://github.com/settings/profile --headed
# Browser redirects to login page, user logs in, page navigates back
agent-browser wait --url "**/settings/profile"
# BUG: never resolves, times outThe built-in help text (agent-browser wait --help) shows glob examples that don't actually work:
agent-browser wait --url "**/dashboard"
Expected Behavior
Glob patterns should work as they did in the previous TypeScript implementation, which used Playwright's page.waitForURL() with native glob support:
// Old implementation (src/actions.ts)
await page.waitForURL(command.url, { timeout: command.timeout });Playwright's matching semantics:
- No wildcards → exact match
*→ matches any characters except/**→ matches any characters including/{a,b}→ alternation
Root Cause
In the Rust rewrite, wait_for_url (cli/src/native/actions.rs) was implemented as:
let check_fn = format!(
"location.href.includes({})",
serde_json::to_string(pattern).unwrap_or_default()
);This passes the raw glob pattern to JS String.includes(), which does literal substring matching only.
The same issue also affects:
- Route matching (simplified glob logic that only handles a single
*split into prefix/suffix) response-bodyURL matching (usesString::contains())
Environment
- agent-browser version: 0.23.0
- Introduced in: f341c0a (Native Rust rewrite of agent-browser daemon)
- Previously worked in: v0.15.x and earlier (TypeScript daemon using Playwright)