fix(cli): honor AGENT_BROWSER_DEFAULT_TIMEOUT env var for wait commands (#1153)
* fix(cli): honor AGENT_BROWSER_DEFAULT_TIMEOUT env var for wait commands The `AGENT_BROWSER_DEFAULT_TIMEOUT` environment variable was being ignored by CLI wait commands, causing them to use hardcoded 30-second timeouts instead of the configured default. ## Changes Made - **Centralized timeout injection**: Modified `parse_command()` to automatically inject `flags.default_timeout` into any wait-family command that doesn't already have an explicit `--timeout` flag - **Environment variable parsing**: Added `default_timeout` field to `Flags` struct that reads from `AGENT_BROWSER_DEFAULT_TIMEOUT` env var - **Daemon propagation**: Updated daemon spawning to pass through the default timeout via environment variables - **Unified timeout handling**: Added `timeout_ms()` helper method in `DaemonState` that all wait handlers now use instead of scattered `unwrap_or()` calls - **Comprehensive test coverage**: Added 10 regression tests covering all wait command variants and edge cases ## Implementation Details The fix uses a two-stage approach: 1. CLI parses the env var and injects timeout values into command JSON for any `wait*` action 2. Daemon reads the env var and provides a centralized fallback via `timeout_ms()` helper This ensures new wait variants automatically inherit the default timeout without requiring per-variant wiring. Fixes #1147 * fix: preserve 30s default timeout for backward compatibility The default_timeout_ms fallback was set to 25_000ms, which silently changes the existing 30_000ms behavior for users who haven't set AGENT_BROWSER_DEFAULT_TIMEOUT. Restore the original 30s default. --------- Co-authored-by: ctate <366502+ctate@users.noreply.github.com>
This commit is contained in:
@@ -826,6 +826,7 @@ fn main() {
|
||||
engine: flags.engine.as_deref(),
|
||||
auto_connect: flags.auto_connect,
|
||||
idle_timeout: flags.idle_timeout.as_deref(),
|
||||
default_timeout: flags.default_timeout,
|
||||
cdp: flags.cdp.as_deref(),
|
||||
no_auto_dialog: flags.no_auto_dialog,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user